09.04.2010, 22:40
Thank you to help put the way you speak no more ta working, compiles more stays the same. Thanks and sorry to disturb too much.
It was therefore:
//On top FS
OnPlayerSpawn FS
Command spec:
It was therefore:
//On top FS
Код:
enum sdata
{
Float:posx,
Float:posy,
Float:posz,
sinterior,
smoney
}
new LastData[MAX_PLAYERS][sdata],WeapData[MAX_PLAYERS][2][13];
Код:
public OnPlayerSpawn(playerid)
{
if(Spec[playerid][Spectating])
{
for(new i; i < 13; i++) GivePlayerWeapon(playerid, WeapData[playerid][0][i], WeapData[playerid][1][i]);
SetPlayerPos(playerid, LastData[playerid][posx], LastData[playerid][posy], LastData[playerid][posz]);
SetPlayerInterior(playerid, LastData[playerid][sinterior]);
SetPlayerMoney(playerid, LastData[playerid][smoney]); //the money received during spectate wont be given here.
Spec[playerid][Spectating] = false;
}
if(Variables[playerid][Jailed]) { SetPlayerInterior(playerid,3); SetPlayerPos(playerid,197.6661,173.8179,1003.0234); SetPlayerFacingAngle(playerid,0); }
return 1;
}
Код:
dcmd_spec(playerid,params[]) {
if(IsPlayerCommandLevel(playerid,"spec")) {
if(!strlen(params)) return SendClientMessage(playerid,red,""[ERROR]: \"/SPEC <NICK OR ID | OFF>\".");
new id;
if(!IsNumeric(params)) {
if(!strcmp(params,"off",true)) {
if(!Spec[playerid][Spectating]) return SendClientMessage(playerid,red,"[ERROR]: You should be watchful.");
SendCommandMessageToAdmins(playerid,"SPEC OFF");
TogglePlayerSpectating(playerid, false);
return SendClientMessage(playerid,yellow,"You left the observer mode.");
}
id = ReturnPlayerID(params);
}
else id = strval(params);
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) {
SendCommandMessageToAdmins(playerid,"SPEC");
new string[256],name[24]; GetPlayerName(id,name,24);
if(Spec[id][Spectating]) return SendClientMessage(playerid,red,"Error: You may not notice a player ever observed.");
if(Spec[playerid][Spectating] && Spec[playerid][SpectateID] == id) return SendClientMessage(playerid,red,"[ERROR]:You're already watching this player.");
Spec[playerid][Spectating] = true, Spec[playerid][SpectateID] = id;
for(new i; i < 13; i++) GetPlayerWeaponData(playerid, i, WeapData[playerid][0][i], WeapData[playerid][1][i]);
GetPlayerPos(playerid, LastData[playerid][posx], LastData[playerid][posy], LastData[playerid][posz]);
LastData[playerid][sinterior] = GetPlayerInterior(playerid);
LastData[playerid][smoney] = GetPlayerMoney(playerid);
TogglePlayerSpectating(playerid,true);
SetPlayerInterior(playerid, GetPlayerInterior(id));
if(!IsPlayerInAnyVehicle(id)) PlayerSpectatePlayer(playerid,id);
else PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
format(string,256,"You are now watching the player \"%s\".",name); return SendClientMessage(playerid,yellow,string);
} else return SendClientMessage(playerid,red,"[ERROR]: You may not notice yourself or a disconnected player.");
} else return SendLevelErrorMessage(playerid,"spec");
}

