31.10.2015, 17:36
Код:
CMD:spec(playerid, params[]) { new giveplayerid, Float:x, Float:y, Float:z; if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, -1, "USAGE: /spec [playerid/partofname/off]"); if(strcmp(params, "off", true) == 0) { SetPVarInt(playerid, "SpecOff", 1); TogglePlayerSpectating(playerid, false); SetCameraBehindPlayer(playerid); SetPlayerPos(playerid, x, y, z); spec[playerid] = -1; return 1; } if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified."); if(IsPlayerInAnyVehicle(giveplayerid)) { GetPlayerPos(playerid, x, y, z); TogglePlayerSpectating(playerid, true); new carid = GetPlayerVehicleID(giveplayerid); PlayerSpectateVehicle(playerid, carid); SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid)); SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid)); spec[playerid] = giveplayerid; } else { GetPlayerPos(playerid, x, y, z); TogglePlayerSpectating(playerid, true); PlayerSpectatePlayer(playerid, giveplayerid); SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid)); SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid)); spec[playerid] = giveplayerid; } return 1; }