14.06.2009, 09:21
Quote:
Originally Posted by Marclang
a) A decent spectating system, IE: Admins can use either "/spec" or "/recon", when they do "/spec off" or "/recon off" it stops spectating that paticular player and returns you to the previous position
|
pawn Код:
//top of scripit
enum LastInfo
{
Float:X,
Float:X,
Float:X,
Float:X,
Interior,
World,
}
new LastAdmin[MAX_PLAYERS][LastInfo];
//onplayercommandtext
if(strcmp(cmd, "/spec", true) == 0 || strcmp(cmd, "/recon", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], new id;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, color, "Usage: /spec [id]");
id = strval(tmp);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, color, "Incorrect playerid!");
GetPlayerPos(playerid, LastAdmin[playerid][X], LastAdmin[playerid][Y], LastAdmin[playerid][Z]);
GetPlayerFacingAngle(playerid, LastAdmin[playerid][A]);
GetPlayerVirtualWorld(playerid, LastAdmin[playerid][World]);
GetPlayerInterior(playerid, LastAdmin[playerid][Interior]);
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
SetPlayerInterior(playerid, GetPlayerInterior(id));
TogglePlayerSpectating(playerid);
if(IsPlayerInAnyVehicle(id)) { PlayerSpecateVehicle(playerid, GetPlayerVehicleID(id)); }
else { PlayerSpecatePlayer(playerid, id); }
SendClientMessage(playerid, color, "Note: type /spec off to stop spectating!");
else if(strcmp(tmp, "/off", true) == 0)
{
SetPlayerInterior(playerid, LastAdmin[playerid][Interior]);
SetPlayerVirtualWorld(playerid, LastAdmin[playerid][World]);
SetPlayerPos(playerid, LastAdmin[playerid][X], LastAdmin[playerid][Y], LastAdmin[playerid][Z]);
SetPlayerFacingAngle(playerid, LastAdmin[playerid][A]);
TogglePlayerSpectating(playerid, 0);
}
return 1;
}