/sp (spec) does not work
#1

The command is to spec another player if he is Admin Level 5 or higher.
Then the script check if I am InCamMod (in Camera Modus) if no then I can use spec and if I type /sp again it turns off
If I type /sp I only get the Error Message "* Sorry, player is not connected"

Код HTML:
dcmd_sp(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
    {
        if(AccInfo[playerid][InCamMod] == 0)
        {
            AccInfo[playerid][InCamMod] = 1;
            if(AccInfo[playerid][pGps] != -1)
            return SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you need to disable the GPS first (/gps off)");

            if(!strlen(params) || !IsNumeric(params))
            {
            SendClientMessage(playerid, COLOR_YELLOW, "** Usage: /sp [PlayerID]");
            SendClientMessage(playerid, COLOR_YELLOW, "* Will spec a specified Player");
            return true;
            }

            new specplayerid = ReturnUser(params);
            if(AccInfo[specplayerid][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
            return SendClientMessage(playerid,COLOR_MESSAGE_YELLOW,"* Sorry, You cannot use this command on this admin!");

            if(IsPlayerConnected(specplayerid) && specplayerid != INVALID_PLAYER_ID)
            {
                if(specplayerid == playerid)
                return SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, You cannot spectate yourself!");

                if(GetPlayerState(specplayerid) == PLAYER_STATE_SPECTATING && AccInfo[specplayerid][SpecID] != INVALID_PLAYER_ID)
                return SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, this player is spectating someone else!");

                if(GetPlayerState(specplayerid) != 1 && GetPlayerState(specplayerid) != 2 && GetPlayerState(specplayerid) != 3)
                return SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, the player has not Spawned!");

                if((AccInfo[specplayerid][Level] != ServerInfo[MaxAdminLevel]) || (AccInfo[specplayerid][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] == ServerInfo[MaxAdminLevel]))
                {
                    GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
                    GetPlayerFacingAngle(playerid,Pos[playerid][3]);
                    SendCommandToAdmins(playerid,"LSpec");
                    SendClientMessage(playerid,COLOR_MESSAGE_YELLOW,"|- Spectating On -|");
                   	return StartSpectate(playerid, specplayerid);
                }
                else return SendClientMessage(playerid,COLOR_MESSAGE_YELLOW,"* Sorry, You cannot spectate the highest level admin");
            }
            else
        	{
	            AccInfo[playerid][God] = 0;
	            StopSpectate(playerid);
	            TogglePlayerControllable(playerid, 0);
	            SetTimerEx("ReturnPosition",1000,0,"d",playerid);
	            return SendClientMessage(playerid,blue,"|- Spectating Off -|");
        	}

        }
        else return SendClientMessage(playerid, COLOR_MESSAGE_YELLOW,"* Sorry, player is not connected!");

    }
    else return SendClientMessage(playerid, COLOR_MESSAGE_YELLOW,"* Sorry, you are not allowed to use this command!");
}
The command was working, I just added the little else part if he typed /sp again then sp turns off but now nothing works
Reply


Messages In This Thread
/sp (spec) does not work - by AwokenNeoX - 09.02.2017, 13:18
Re: /sp (spec) does not work - by oMa37 - 09.02.2017, 13:25
Re: /sp (spec) does not work - by AwokenNeoX - 09.02.2017, 13:45

Forum Jump:


Users browsing this thread: 1 Guest(s)