Hali, ismét.
Elhoztam egy új scriptet, egy másik, fejletlen script ihletett ennek a megírására.
A lényege, hogy a /ballon parancs segítségével leraksz magad alá egy ballont, és repeszthetsz bármelyik irányba.
Irányítógombok:
H = Elõre
CTRL + H = Hátra
F = Balra
CTRL + F = Jobbra
N = Fel
CTRL + N = LeA CTRL-os gombokat így csináljátok: lenyomjátok a CTRL-t + az adott gombot, majd elengeded azt és a CTRL-t nyomva tartod.
Kép:[hs width=300 height=300]
http://kepfeltoltes.hu/130102/168562216sa-mp-016_www.kepfeltoltes.hu_.png[/hs]
Letöltés: http://www.solidfiles.com/d/8c0abfb15d/
Kód: #include <a_samp>
#define HOLDING(%0) ((newkeys & (%0)) == (%0))
#define RELEASED(%0) \\
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
new ballon[MAX_PLAYERS];
new nyomja[MAX_PLAYERS];
new Float:x[MAX_PLAYERS], Float:y[MAX_PLAYERS], Float:z[MAX_PLAYERS];
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" rupBallon betoltve.\");
print(\"--------------------------------------\\n\");
return 1;
}
public OnFilterScriptExit()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(ballon != 0) DestroyObject(ballon);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
nyomja[playerid] = 0;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
nyomja[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, \"/ballon\", true))
{
if(ballon[playerid] != 0) DestroyObject(ballon[playerid]);
GetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]);
ballon[playerid] = CreateObject(19332, x[playerid], y[playerid], z[playerid], 0.00, 0.00, 0.00);
SetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]+1);
return 1;
}
if(!strcmp(cmdtext, \"/törölballon\", true))
{
if(ballon[playerid] == 0) return SendClientMessage(playerid, -1, \"Eddig sem volt ballonod!\");
DestroyObject(ballon[playerid]);
SendClientMessage(playerid, -1, \"Az ejtõernyõ törölve!\");
return 1;
}
return 0;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(ballon[playerid] == 1)
{
if(HOLDING(KEY_CTRL_BACK))
{
return nyomja[playerid] = 1;
}
else if(RELEASED(KEY_FIRE | KEY_CTRL_BACK))
{
return nyomja[playerid] = 2;
}
else if(HOLDING(KEY_SECONDARY_ATTACK))
{
return nyomja[playerid] = 3;
}
else if(RELEASED(KEY_FIRE | KEY_SECONDARY_ATTACK))
{
return nyomja[playerid] = 4;
}
else if(HOLDING(KEY_NO))
{
return nyomja[playerid] = 5;
}
else if(RELEASED(KEY_FIRE | KEY_NO))
{
return nyomja[playerid] = 6;
}
else return nyomja[playerid] = 0;
}
return 0;
}
public OnPlayerUpdate(playerid)
{
if(nyomja[playerid] == 0) return 1;
if(nyomja[playerid] == 1) {
SetObjectPos(ballon[playerid], x[playerid], y[playerid]+1, z[playerid]);
GetObjectPos(ballon[playerid], x[playerid], y[playerid], z[playerid]);
SetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]+1); }
if(nyomja[playerid] == 2){
SetObjectPos(ballon[playerid], x[playerid], y[playerid]-1, z[playerid]);
GetObjectPos(ballon[playerid], x[playerid], y[playerid], z[playerid]);
SetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]+1); }
if(nyomja[playerid] == 3){
SetObjectPos(ballon[playerid], x[playerid]+1, y[playerid], z[playerid]);
GetObjectPos(ballon[playerid], x[playerid], y[playerid], z[playerid]);
SetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]+1);}
if(nyomja[playerid] == 4){
SetObjectPos(ballon[playerid], x[playerid]-1, y[playerid], z[playerid]);
GetObjectPos(ballon[playerid], x[playerid], y[playerid], z[playerid]);
SetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]+1);}
if(nyomja[playerid] == 5){
SetObjectPos(ballon[playerid], x[playerid], y[playerid], z[playerid]+1);
GetObjectPos(ballon[playerid], x[playerid], y[playerid], z[playerid]);
SetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]+1);}
if(nyomja[playerid] == 6){
SetObjectPos(ballon[playerid], x[playerid], y[playerid], z[playerid]-1);
GetObjectPos(ballon[playerid], x[playerid], y[playerid], z[playerid]);
SetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]+1);}
return 1;
}