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");
}
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");
}
new Float:LastPosX[MAX_PLAYERS], Float:LastPosY[MAX_PLAYERS], Float:LastPosZ[MAX_PLAYERS];
GetPlayerPos(playerid, LastPosX[playerid], LastPosY[playerid], LastPosZ[playerid]);
SetPlayerPos(playerid, LastPosX[playerid], LastPosY[playerid], LastPosZ[playerid]);
new
Float:LastPosX[MAX_PLAYERS],
Float:LastPosY[MAX_PLAYERS],
Float:LastPosZ[MAX_PLAYERS];
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) {
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, LastPosX[playerid], LastPosY[playerid], LastPosZ[playerid]);
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");
}
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, LastPosX[playerid], LastPosY[playerid], LastPosZ[playerid]);
SetPlayerInterior(playerid, 0);
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");
}
Use this instead of vars :
Code:
new Float:LastPosX[MAX_PLAYERS], Float:LastPosY[MAX_PLAYERS], Float:LastPosZ[MAX_PLAYERS]; Get position with : Code:
GetPlayerPos(playerid, LastPosX[playerid], LastPosY[playerid], LastPosZ[playerid]); Code:
SetPlayerPos(playerid, LastPosX[playerid], LastPosY[playerid], LastPosZ[playerid]); PHP Code:
|