pawn Код:
public OnPlayerSpawn(playerid)
{
if(GetPVarInt(playerid, "isSpectating") == 2)
{
SetPlayerInterior(playerid, GetPVarInt(playerid, "specInt"));
SetPlayerPos(playerid, GetPVarFloat(playerid, "specPosX"), GetPVarFloat(playerid, "specPosY"), GetPVarFloat(playerid, "specPosZ"));
DeletePVar(playerid, "isSpectating");
DeletePVar(playerid, "specPosX");
DeletePVar(playerid, "specPosY");
DeletePVar(playerid, "specPosZ");
DeletePVar(playerid, "specInt");
}
return 1;
}
CMD:spec(playerid, params[])
{
new targetid;
if(sscanf(params, "u", targetid))
{
if(GetPVarInt(playerid, "isSpectating"))
{
SetPVarInt(playerid, "isSpectating", 2);
TogglePlayerSpectating(playerid, 0);
return 1;
}
SendClientMessage(playerid, -1, "* /spec [id]");
return 1;
}
if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID)
return SendClientMessage(playerid, -1, "* Este jogador nгo estб conectado");
if(!GetPVarInt(playerid, "isSpectating"))
{
new Float:fPos[3];
GetPlayerPos(playerid, fPos[0], fPos[1], fPos[2]);
SetPVarFloat(playerid, "specPosX", fPos[0]);
SetPVarFloat(playerid, "specPosY", fPos[1]);
SetPVarFloat(playerid, "specPosZ", fPos[2]);
SetPVarInt(playerid, "specInt", GetPlayerInterior(playerid));
SetPVarInt(playerid, "isSpectating", 1);
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, targetid);
}
else
{
SendClientMessage(playerid, -1, "* Vocк jб estб observando alguйm. [/spec para sair]");
}
return 1;
}