My admin fly command is bugged - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: My admin fly command is bugged (
/showthread.php?tid=540507)
My admin fly command is bugged -
AndySedeyn - 05.10.2014
Hi
I have an administrator command that makes it able for admins to fly in the sky and clip through objects.
Now, the problem is that it gets bugged and shows a flashing "Loading" screen until you disconnect.
Screenshot:
http://i.imgur.com/1o6qBkd.png
COMMAND:
pawn Код:
CMD:fly(playerid, params[])
{
if(!gPlayerLogged[playerid]) return SCM(playerid, COLOR_RED, NOTLOGGED);
if(!gPlayerSpawned[playerid]) return SCM(playerid, COLOR_RED, NOTSPAWNED);
if(pData[playerid][pAdmin] < 2 && !IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_RED, NOTADMIN);
if(gPlayerInFlyMode[playerid] == true)
{
CancelFlyMode(playerid);
}
else
{
FlyMode(playerid);
}
return 1;
}
STOCKS:
pawn Код:
stock CancelFlyMode(playerid)
{
new Float:vx,Float:vy,Float:vz;
GetPlayerPos(playerid,vx,vy,vz);
gPlayerInFlyMode[playerid] = false;
CancelEdit(playerid);
TogglePlayerSpectating(playerid, false);
DestroyPlayerObject(playerid, noclipdata[playerid][flyobject]);
noclipdata[playerid][cameramode] = CAMERA_MODE_NONE;
SetPlayerPos(playerid,vx,vy,vz);
return 1;
}
stock FlyMode(playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
noclipdata[playerid][flyobject] = CreatePlayerObject(playerid, 19300, X, Y, Z, 0.0, 0.0, 0.0);
TogglePlayerSpectating(playerid, true);
AttachCameraToPlayerObject(playerid, noclipdata[playerid][flyobject]);
gPlayerInFlyMode[playerid] = true;
noclipdata[playerid][cameramode] = CAMERA_MODE_FLY;
return 1;
}
Help would be appreciated.