13.09.2014, 06:02
I wonder if i can make, Save/Get previous weapons. Whats the code
Try it http://pastebin.com/TaD5miwQ.
|
CMD:aduty(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, -1, "This is an admin only command!");
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(PlayerInfo[playerid][pAdminDuty] == 0)
{
SendClientMessageEx(playerid, COLOR_BLUE, "You are now on Administrator duty! !");
//SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
PlayerInfo[playerid][pAdminDuty] = 1;
SetPlayerHealth(playerid, 100000);
SetPlayerArmour(playerid, 100000);
//SetPlayerColor(playerid, COLOR_TWORANGE);
SetPlayerColor(playerid, COLOR_REALRED);
GivePlayerWeapon(playerid, 24, 99999);
GivePlayerWeapon(playerid, 43, 60000);
GivePlayerWeapon(playerid, 24, 60000);
GivePlayerWeapon(playerid, 31, 99999);
GivePlayerWeapon(playerid, 32, 99999);
GivePlayerWeapon(playerid, 27, 99999);
GivePlayerWeapon(playerid, 34, 99999);
if(PlayerInfo[playerid][pAdmin] >= 1) {
GivePlayerWeapon(playerid, 38, 99999);
}
new szMessage[47 + (MAX_PLAYER_NAME * 2)];
format(szMessage, sizeof(szMessage), "Administrator %s is now ON Duty!", GetPlayerNameEx(playerid));
//ABroadCast(COLOR_YELLOW,szMessage, 2);
SendClientMessageToAllEx(COLOR_REALRED, szMessage);
}
else
{
SendClientMessageEx(playerid, COLOR_BLUE, "You are now off admin duty!");
//SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
RemovePlayerWeapon(playerid, 24);
RemovePlayerWeapon(playerid, 43);
RemovePlayerWeapon(playerid, 46);
RemovePlayerWeapon(playerid, 24);
RemovePlayerWeapon(playerid, 31);
RemovePlayerWeapon(playerid, 32);
RemovePlayerWeapon(playerid, 27);
RemovePlayerWeapon(playerid, 34);
SetPlayerToTeamColor(playerid);
Delete3DTextLabel(DutyLabel[playerid]);
//SetPlayerSkin(playerid, 299); - Commented by Voltage
PlayerInfo[playerid][pAdminDuty] = 0;
new szMessage[47 + (MAX_PLAYER_NAME * 2)];
format(szMessage, sizeof(szMessage), "Administrator %s is now OFF Duty!", GetPlayerNameEx(playerid));
//format(szMessage, sizeof(szMessage), "AdmCmd: Administrator %s is now Off Duty!", GetPlayerNameEx(playerid));
// ABroadCast(COLOR_YELLOW,szMessage, 2);
SendClientMessageToAllEx(COLOR_REALRED, szMessage);
}
}
return 1;
}
i mean, when player is admin off duty then he /aduty to get on duty, it will save his previous weapons then if he go admin off duty again the previous weapon will load. Is that possible?
|
new
weap[MAX_PLAYERS][12 char],
ammo[MAX_PLAYERS][12]
;
savePlayerGuns(p)
{
for(new i=sizeof ammo[]; i != 0; i--)
{
GetPlayerWeaponData(p, i, weap[p][i],ammo[p][i]);
}
return true;
}
loadPlayerGuns(p)
{
for(new i=sizeof ammo[]; i != 0; i--)
{
if !weap[playerid][i] *then continue;
GivePlayerWeapon(playerid, weap[p][i],ammo[p][i]);
}
}
savePlayerGuns(.p=playerid);
loadPlayerGuns(.p=playerid);
CMD:aduty(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, -1, "This is an admin only command!");
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(PlayerInfo[playerid][pAdminDuty] == 0)
{
SendClientMessageEx(playerid, COLOR_BLUE, "You are now on Administrator duty! !");
//SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
PlayerInfo[playerid][pAdminDuty] = 1;
SetPlayerHealth(playerid, 100000);
SetPlayerArmour(playerid, 100000);
//SetPlayerColor(playerid, COLOR_TWORANGE);
SetPlayerColor(playerid, COLOR_REALRED);
ResetPlayerWeapons(killerid);
GivePlayerWeapon(playerid, 24, 99999);
GivePlayerWeapon(playerid, 43, 60000);
GivePlayerWeapon(playerid, 24, 60000);
GivePlayerWeapon(playerid, 31, 99999);
GivePlayerWeapon(playerid, 32, 99999);
GivePlayerWeapon(playerid, 27, 99999);
GivePlayerWeapon(playerid, 34, 99999);
if(PlayerInfo[playerid][pAdmin] >= 1) {
GivePlayerWeapon(playerid, 38, 99999);
}
new szMessage[47 + (MAX_PLAYER_NAME * 2)];
format(szMessage, sizeof(szMessage), "Administrator %s is now ON Duty!", GetPlayerNameEx(playerid));
ABroadCast(COLOR_YELLOW,szMessage, 2);
SendClientMessageToAllEx(COLOR_REALRED, szMessage);
}
else
{
SendClientMessageEx(playerid, COLOR_BLUE, "You are now off admin duty!");
SpawnPlayer(playerid);
//SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
ResetPlayerWeapons(killerid);
SetPlayerToTeamColor(playerid);
Delete3DTextLabel(DutyLabel[playerid]);
SetPlayerSkin(playerid, 299); - Commented by Voltage
PlayerInfo[playerid][pAdminDuty] = 0;
new szMessage[47 + (MAX_PLAYER_NAME * 2)];
format(szMessage, sizeof(szMessage), "Administrator %s is now OFF Duty!", GetPlayerNameEx(playerid));
format(szMessage, sizeof(szMessage), "AdmCmd: Administrator %s is now Off Duty!", GetPlayerNameEx(playerid));
ABroadCast(COLOR_YELLOW,szMessage, 2);
SendClientMessageToAllEx(COLOR_REALRED, szMessage);
}
}
return 1;
}
At first:
pawn Код:
pawn Код:
pawn Код:
|
(93221) : warning 219: local variable "ammo" shadows a variable at a preceding level : warning 203: symbol is never used: "loadPlayerGuns" : warning 203: symbol is never used: "savePlayerGuns" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 3 Warnings.