29.10.2016, 13:42
Hey guys, my Admin fly function works only for ID 0, that's very weird and honestly I have no clue why
Anyone a clue ?
PHP код:
CMD:fly(playerid)
{
if(!IsAllowed(playerid, 2)) return NoAuth(playerid);
new Float:x, Float:y, Float:z;
if(Fly[playerid] == false)
{
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+5);
SetPlayerArmour(playerid, 1000000000.0);
SetPlayerHealth(playerid, 1000000000.0);
SetTimerEx("AdminFly", 100, 0, "d", playerid);
Fly[playerid] = true;
return 1;
}
else
{
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+0.5);
ClearAnimations(playerid);
SetPlayerArmour(playerid, 100.0);
SetPlayerHealth(playerid, 100.0);
Fly[playerid] = false;
return 1;
}
}
PHP код:
// Admin Fly
forward AdminFly(playerid);
public AdminFly(playerid)
{
if(!IsPlayerConnected(playerid))
return Fly[playerid] = false;
if(Fly[playerid])
{
if(!IsPlayerInAnyVehicle(playerid))
{
new
keys,
ud,
lr,
Float:x[2],
Float:y[2],
Float:z;
GetPlayerKeys(playerid, keys, ud, lr);
GetPlayerVelocity(playerid, x[0], y[0], z);
if(ud == KEY_UP)
{
GetPlayerCameraPos(playerid, x[0], y[0], z);
GetPlayerCameraFrontVector(playerid, x[1], y[1], z);
ApplyAnimation(playerid,"SWIM","SWIM_crawl",6.1,1,1,1,1,0,1);
SetPlayerToFacePos(playerid, x[0] + x[1], y[0] + y[1]);
SetPlayerVelocity(playerid, x[1], y[1], z);
}
else
SetPlayerVelocity(playerid, 0.0, 0.0, 0.01);
}
SetTimerEx("AdminFly", 100, 0, "d", playerid);
}
return 0;
}