Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Problem with spec

$
0
0
Hi
i have added an admin command spec player
not working
code:

Code:

CMD:spec(playerid, params[])
{
        if(PlayerInfo[playerid][pAdmin] < 1&& !IsPlayerAdmin(playerid)) return 1;
        new targetid,pName[MAX_PLAYER_NAME];
        if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, -1 , "Correct Usage: /spec[Playerid]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_RED,"Player not connected.");
        GetPlayerName(targetid,pName,sizeof(pName));
        TogglePlayerSpectating(targetid, 1);
        new msg[126];
        format(msg,sizeof(msg),"[Spectate]You are spectating player %s",pName);
        SendClientMessage(playerid,COLOR_RED,msg);
        return 1;
}

CMD:specoff(playerid, params[])
{
        if(PlayerInfo[playerid][pAdmin] < 1&& !IsPlayerAdmin(playerid)) return 1;
        new pName[MAX_PLAYER_NAME];
        TogglePlayerSpectating(targetid, 0);
        new msg[126];
        format(msg,sizeof(msg),"[Spectate]You are no more spectating player");
        SendClientMessage(playerid,COLOR_RED,msg);
        return 1;
}


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>