16.02.2015, 15:38
Hello Friends can anyone tell me why this function is not safing last pos working
Thanks for advance!
PHP Code:
CMD:spec(playerid,params[]) {
if(PlayerInfo[playerid][Helper] == 1 || PlayerInfo[playerid][Level] >= 1 || IsPlayerAdmin(playerid)) {
if(isnull(params) || !IsNumeric(params)) return SendClientMessage(playerid, red, "USAGE: /spec [playerid]");
new specplayerid = strval(params);
if(IsPlayerConnected(specplayerid) && specplayerid != INVALID_PLAYER_ID) {
new Float:x,Float:y,Float:z;
if(specplayerid == playerid) return SendClientMessage(playerid, red, "ERROR: You cannot spectate yourself");
if(GetPlayerState(specplayerid) == PLAYER_STATE_SPECTATING && PlayerInfo[specplayerid][SpecID] != INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "Spectate: Player spectating someone else");
if(GetPlayerState(specplayerid) != 1 && GetPlayerState(specplayerid) != 2 && GetPlayerState(specplayerid) != 3) return SendClientMessage(playerid, red, "Spectate: Player not spawned");
if( (PlayerInfo[specplayerid][Level] != ServerInfo[MaxAdminLevel]) || (PlayerInfo[specplayerid][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] == ServerInfo[MaxAdminLevel]) ) {
if(PlayerInfo[specplayerid][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
GetPlayerPos(playerid,x,y,z);
SetPVarFloat(playerid,"xpos",x);
SetPVarFloat(playerid,"ypos",y);
SetPVarFloat(playerid,"zpos",z);
StartSpectate(playerid, specplayerid);
Spectating[playerid] = 1;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(Reporter[i] == 1)
{
SCM(i,green,"[SERVER] {FFB400}Thanks for Report.An admin is checking your report.");
Reporter[i] = 0;
}
}
new str[100];
format(str, sizeof(str),"Admin %s has use SPEC on ID %d .", PlayerName2(playerid),specplayerid);
MessageToAdmins(blue,str);
return SendClientMessage(playerid,blue,"Now Spectating");
} else return SendClientMessage(playerid,red,"ERROR: You cannot spectate the highest level admin");
} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You need to be at least Help Operator to use this command");
}
PHP Code:
CMD:specoff(playerid,params[]) {
#pragma unused params
if(PlayerInfo[playerid][Helper] == 1 || PlayerInfo[playerid][Level] >= 1 || IsPlayerAdmin(playerid)) {
if(PlayerInfo[playerid][SpecType] != ADMIN_SPEC_TYPE_NONE) {
StopSpectate(playerid);
SetPlayerPos(playerid, GetPVarFloat(playerid,"xpos"), GetPVarFloat(playerid,"ypos"), GetPVarFloat(playerid,"zpos"));
return SendClientMessage(playerid,blue,"No Longer Spectating");
} else return SendClientMessage(playerid,red,"ERROR: You are not spectating");
} else return SendClientMessage(playerid,red,"ERROR: You need to be at least Help Operator to use this command");
}