05.06.2013, 13:57
pawn Код:
CMD:aduty(playerid, params[])
{
new str[126];
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
if(AdminDuty[playerid] != 1)
{
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid); //This
SetPlayerHealth(playerid,99999);
SetPlayerArmour(playerid,99999);
if(isnull(PlayerInfo[playerid][pAName])) return SendClientMessage(playerid, -1, "You don't have an admin name.");
AdminDuty[playerid] = 1;
format(str, sizeof(str), "%s (ID %i - %s) is now on duty as a level %i admin.", PlayerInfo[playerid][pAName], playerid, GetName(playerid), PlayerInfo[playerid][pAdmin]);
SendClientMessageToAdmins(-1, str, 1);
SetPlayerName(playerid, PlayerInfo[playerid][pAName]);
SendClientMessage(playerid, -1, "You are now on duty as an admin, you do now have access to all of your commands.");
GetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
}
else
{
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(playerid);
AdminDuty[playerid] = 0;
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); // and This
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
SetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid,PlayerInfo[playerid][pArmour]);
SetPlayerName(playerid, PlayerInfo[playerid][pName]);
new string[126];
format(string, 126, "%s Old cash: %i - New cash: %i", GetName(playerid), PlayerInfo[playerid][pCash], aCash);
AdminLog(string);
PlayerInfo[playerid][pCash] = aCash[playerid];
SetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
format(str, sizeof(str), "%s (ID %i - %s) is now off admin duty.", PlayerInfo[playerid][pAName], playerid, GetName(playerid));
SendClientMessageToAdmins(-1, str, 1);
SendClientMessage(playerid, -1, "You are now off duty as an admin and have only a limited access to your commands.");
spec[playerid] = -1;
}
return 1;
}