29.05.2009, 10:27
The forum identation is ruined. D;
Код:
if(strcmp(cmd,"/spec",true) == 0) { if(PlayerInfo[playerid][pAdmin] < 1) { SendClientMessage(playerid, COLOR_YELLOW, "You're not authorised to spectate another player."); return 1; } tmp = strtok(cmdtext,idx); if(strlen(tmp) == 0) { SendClientMessage(playerid, COLOR_GRAD1, "/spec [playerid/partofname] (or /specoff)"); return 1; } new otherplayer = ReturnUser(tmp); if(otherplayer == INVALID_PLAYER_ID) { SendClientMessage(playerid, COLOR_GREY, "Invalid player ID!"); return 1; } TogglePlayerSpectating(playerid,1); if(IsPlayerInAnyVehicle(otherplayer)==1) { new Float:health; new name[MAX_PLAYER_NAME]; GetPlayerName(otherplayer, name, sizeof(name)); GetPlayerHealth(otherplayer, health); format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~y~%s(ID:%d)~n~~y~health:%.1f",name,otherplayer,health); GameTextForPlayer(i, string, 2500, 3); PlayerSpectateVehicle(playerid, GetPlayerVehicleID(otherplayer)); } else { new Float:health; new name[MAX_PLAYER_NAME]; GetPlayerName(otherplayer, name, sizeof(name)); GetPlayerHealth(otherplayer, health); format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~y~%s(ID:%d)~n~~y~health:%.1f",name,otherplayer,health); GameTextForPlayer(i, string, 2500, 3); PlayerSpectatePlayer(playerid,otherplayer); } SendClientMessage(playerid, COLOR_WHITE, "To finish your spectation session, use /specoff."); return 1; } if(strcmp(cmd,"/specoff",true)==0) { TogglePlayerSpectating(playerid,0); SetPlayerVirtualWorld(playerid,0); SetPlayerInterior(playerid,0); SendClientMessage(playerid, COLOR_YELLOW, "You have finished spectating."); return 1; }