21.09.2011, 01:22
Like mmrk did, you can use PVar's. You can also use variables to store the player's last weapons/skin too. Here, try storing the weapons in a variable this time instead of PVars:
The above should give you the weapons they had before (maybe the exact same ammo too but I don't know for sure).
All together, the /onduty command should look like this:
pawn Code:
// top of script
new WepBeforeDuty[MAX_PLAYERS];
// place this in your /onduty script BEFORE the player gets the minigun and other weapons
WepBeforeDuty[playerid] = GetPlayerWeapons(playerid);
// when the player types /onduty again (to go off duty)
GivePlayerWeapon(playerid,WepBeforeDuty[playerid]);
All together, the /onduty command should look like this:
pawn Code:
dcmd_onduty(playerid,params[])
{
#pragma unused params
if (AccInfo[playerid][Level] >= 1)
{
if(AccInfo[playerid][OnDuty] == 0)
{
SetPVarInt(playerid, "Skin", GetPlayerSkin(playerid)); // added
AccInfo[playerid][OnDuty] = 1;
SetPlayerHealth(playerid,100000);
SetPlayerSkin(playerid,294);
WepBeforeDuty[playerid] = GetPlayerWeapons(playerid); // getting their weps BEFORE it sets to minigun
GivePlayerWeapon(playerid,16,50000);
GivePlayerWeapon(playerid,38,50000);
return SendClientMessage(playerid,green,"You are now in Duty Mode");
}
else
{
SetPlayerSkin(playerid, GetPVarInt(playerid, "Skin")); // Added
GivePlayerWeapon(playerid,WepBeforeDuty[playerid]); // giving the weapons back that we used above ^
AccInfo[playerid][OnDuty] = 0;
SetPlayerHealth(playerid,100);
return SendClientMessage(playerid,orange,"You are now Off Duty");
}
}
return ErrorMessages(playerid, 5);
}