if(strcmp(cmd, "/spec", true) == 0 || strcmp(cmd, "/recon", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spec [playerid/off]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerNPC(giveplayerid)) return 1;
if(strcmp("off", tmp, true, strlen(tmp)) == 0)
{
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
SendClientMessage(playerid, COLOR_GREY, " You are not spectating anyone!");
return 1;
}
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVirtualWorld]);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
SetPlayerPos(playerid, PlayerInfo[playerid][pSPos_x], PlayerInfo[playerid][pSPos_y], PlayerInfo[playerid][pSPos_z]);
SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
SendClientMessage(playerid, COLOR_WHITE, "You are no longer spectating.");
TogglePlayerSpectating(playerid, 0);
SpectatedID[playerid] = INVALID_PLAYER_ID;
SpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
HidePM[playerid] = 0;
PhoneOnline[playerid] = 0;
ResetPlayerAdminWeaponsEx(playerid);
UpdateWeapons(playerid);
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
GetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
GetPlayerPos(playerid, PlayerInfo[playerid][pSPos_x], PlayerInfo[playerid][pSPos_y], PlayerInfo[playerid][pSPos_z]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
}
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
TogglePlayerSpectating(playerid, 1);
SpectatedID[playerid] = giveplayerid;
HidePM[playerid] = 1;
PhoneOnline[playerid] = 1;
new Float:X, Float:Y, Float:Z;
new Float:health;
GetPlayerHealth(giveplayerid, health);
new Float:armor;
GetPlayerArmour(giveplayerid, armor);GetPlayerPos(playerid, X, Y, Z);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new cash = GetPlayerMoney(giveplayerid);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "Specing: [%d]%s [$%d] [H:%.0f] [A:%.0f]",giveplayerid,giveplayer,cash,health,armor);
}
SendClientMessage(playerid, COLOR_GREEN, string);
if(IsPlayerInAnyVehicle(giveplayerid))
{
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid));
SpectateType[playerid] = ADMIN_SPEC_TYPE_VEHICLE;
}
else
{
PlayerSpectatePlayer(playerid, giveplayerid);
SpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player isn't active!");
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/spec", true) == 0 || strcmp(cmd, "/recon", true) == 0)
{
new Float:P,FLoat:O,Float:S;
GetPlayerPos(playerid,P,O,S);
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spec [playerid/off]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerNPC(giveplayerid)) return 1;
if(strcmp("off", tmp, true, strlen(tmp)) == 0)
{
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
SendClientMessage(playerid, COLOR_GREY, " You are not spectating anyone!");
return 1;
}
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVirtualWorld]);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
SetPlayerPos(playerid, P,O,S);
SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
SendClientMessage(playerid, COLOR_WHITE, "You are no longer spectating.");
TogglePlayerSpectating(playerid, 0);
SpectatedID[playerid] = INVALID_PLAYER_ID;
SpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
HidePM[playerid] = 0;
PhoneOnline[playerid] = 0;
ResetPlayerAdminWeaponsEx(playerid);
UpdateWeapons(playerid);
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
GetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
GetPlayerPos(playerid, PlayerInfo[playerid][pSPos_x], PlayerInfo[playerid][pSPos_y], PlayerInfo[playerid][pSPos_z]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
}
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
TogglePlayerSpectating(playerid, 1);
SpectatedID[playerid] = giveplayerid;
HidePM[playerid] = 1;
PhoneOnline[playerid] = 1;
new Float:X, Float:Y, Float:Z;
new Float:health;
GetPlayerHealth(giveplayerid, health);
new Float:armor;
GetPlayerArmour(giveplayerid, armor);GetPlayerPos(playerid, X, Y, Z);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new cash = GetPlayerMoney(giveplayerid);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "Specing: [%d]%s [$%d] [H:%.0f] [A:%.0f]",giveplayerid,giveplayer,cash,health,armor);
}
SendClientMessage(playerid, COLOR_GREEN, string);
if(IsPlayerInAnyVehicle(giveplayerid))
{
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid));
SpectateType[playerid] = ADMIN_SPEC_TYPE_VEHICLE;
}
else
{
PlayerSpectatePlayer(playerid, giveplayerid);
SpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player isn't active!");
return 1;
}
}
return 1;
}
forward ReturnPosition(playerid);
new Float:Pos[MAX_PLAYERS][4];
if(strcmp(cmd, "/spec", true) == 0 || strcmp(cmd, "/recon", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spec [playerid/off]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerNPC(giveplayerid)) return 1;
if(strcmp("off", tmp, true, strlen(tmp)) == 0)
{
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
SendClientMessage(playerid, COLOR_GREY, " You are not spectating anyone!");
return 1;
}
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVirtualWorld]);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
SetTimerEx("ReturnPosition",1000,0,"d",playerid);
SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
SendClientMessage(playerid, COLOR_WHITE, "You are no longer spectating.");
TogglePlayerSpectating(playerid, 0);
SpectatedID[playerid] = INVALID_PLAYER_ID;
SpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
HidePM[playerid] = 0;
PhoneOnline[playerid] = 0;
ResetPlayerAdminWeaponsEx(playerid);
UpdateWeapons(playerid);
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
GetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
}
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
TogglePlayerSpectating(playerid, 1);
SpectatedID[playerid] = giveplayerid;
HidePM[playerid] = 1;
PhoneOnline[playerid] = 1;
new Float:X, Float:Y, Float:Z;
new Float:health;
GetPlayerHealth(giveplayerid, health);
new Float:armor;
GetPlayerArmour(giveplayerid, armor);GetPlayerPos(playerid, X, Y, Z);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new cash = GetPlayerMoney(giveplayerid);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "Specing: [%d]%s [$%d] [H:%.0f] [A:%.0f]",giveplayerid,giveplayer,cash,health,armor);
}
SendClientMessage(playerid, COLOR_GREEN, string);
if(IsPlayerInAnyVehicle(giveplayerid))
{
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid));
SpectateType[playerid] = ADMIN_SPEC_TYPE_VEHICLE;
}
else
{
PlayerSpectatePlayer(playerid, giveplayerid);
SpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player isn't active!");
return 1;
}
}
return 1;
}
public ReturnPosition(playerid)
{
SetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
}
Not tested but try
pawn Код:
pawn Код:
pawn Код:
pawn Код:
|