PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/tv", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nгo estб logado na RCON.");
new player = strtok(cmdtext, idx);
if(!strlen(player)) return SendClientMessage(playerid, -1, "USO: /tv [ID]");
new id = strval(player);
if(id = playerid) return SendClientMessage(playerid, -1, "Vocк nгo se espiar !");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "JOGADOR OFFLINE");
TogglePlayerSpectating(playerid, 1);
SetPVarInt(playerid, "TV", 1);
if(IsPlayerInAnyVehicle(id)) { PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id)); }
else { PlayerSpectatePlayer(playerid, id); }
return 1;
}
if(strcmp(cmdtext, "/tvsair", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nгo estб logado na RCON.");
if(GetPVarInt(playerid, "TV") == 1)
{
TogglePlayerSpectating(playerid, 0);
DeletePVar(playerid, "TV");
}
else { SendClientMessage(playerid, -1, "Vocк nгo estб espiando ninguйm.");
return 1;
}
return 0;
}