My admin fly command is bugged
#1

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)