29.05.2009, 02:29
here use mine: (also thanks to seifs adminscript for providing an excellent example)
For this to work you will need strtok and to change otherplayer with whatever you use the player id the command affects.
And you'll need to have RED defined or replace it with the red hex code. (The same with GREEN).
Also here's spectate off:
pawn Код:
if(strcmp(cmd,"/Spec",true)==0)
{// \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ needs to be changed to whatever system of admin levels you have
if(AdminLevel<The required level)return SendClientMessage(playerid,RED,"You are not an admin with the requried level.");
tmp=strtok(cmdtext,idx);
if(strlen(tmp)==0)return SendClientMessage(playerid,RED,"You need to type: (/Spec (Playername/PlayerID)) or (/SpecOff)");
otherplayer=ReturnUser(tmp);
if(otherplayer==INVALID_PLAYER_ID)return SendClientMessage(playerid,RED,"That player does not exist!");
TogglePlayerSpectating(playerid,1);
if(IsPlayerInAnyVehicle(otherplayer)==1)PlayerSpectateVehicle(playerid,GetPlayerVehicleID(otherplayer));
else PlayerSpectatePlayer(playerid,otherplayer);
SendClientMessage(playerid,GREEN,"To stop spectating use: /Specoff");
return 1;
}
And you'll need to have RED defined or replace it with the red hex code. (The same with GREEN).
Also here's spectate off:
pawn Код:
if(strcmp(cmd,"/SpecOff",true)==0)
{
TogglePlayerSpectating(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetPlayerInterior(playerid,0);
return 1;
}