20.09.2011, 21:43
i have made a duty command. but when i go off duty i need the weps i had before i went to duty. please help. thnks
dcmd_onduty(playerid,params[]) { #pragma unused params if (AccInfo[playerid][Level] >= 1) { if(AccInfo[playerid][OnDuty] == 0) { AccInfo[playerid][OnDuty] = 1; SetPlayerHealth(playerid,100000); SetPlayerSkin(playerid,294); GivePlayerWeapon(playerid,16,50000); GivePlayerWeapon(playerid,38,50000); return SendClientMessage(playerid,green,"You are now in Duty Mode"); } else { AccInfo[playerid][OnDuty] = 0; SetPlayerHealth(playerid,100); return SendClientMessage(playerid,orange,"You are now Off Duty"); } } return ErrorMessages(playerid, 5); }
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);
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
AccInfo[playerid][OnDuty] = 0;
SetPlayerHealth(playerid,100);
return SendClientMessage(playerid,orange,"You are now Off Duty");
}
}
return ErrorMessages(playerid, 5);
}
// 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]);
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);
}
C:\Users\script\new script\filterscripts\newscript.pwn(6067) : error 017: undefined symbol "WepBeforeDuty" C:\Users\script\new script\filterscripts\newscript.pwn(6067) : warning 215: expression has no effect C:\Users\script\new script\filterscripts\newscript.pwn(6067) : error 001: expected token: ";", but found "]" C:\Users\script\new script\filterscripts\newscript.pwn(6067) : error 029: invalid expression, assumed zero C:\Users\script\new script\filterscripts\newscript.pwn(6067) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
C:\Users\script\new script\filterscripts\newscript.pwn(34) : error 010: invalid function or declaration C:\Users\script\new script\filterscripts\newscript.pwn(6068) : error 017: undefined symbol "WepBeforeDuty" C:\Users\script\new script\filterscripts\newscript.pwn(6068) : warning 215: expression has no effect C:\Users\script\new script\filterscripts\newscript.pwn(6068) : error 001: expected token: ";", but found "]" C:\Users\script\new script\filterscripts\newscript.pwn(6068) : error 029: invalid expression, assumed zero C:\Users\script\new script\filterscripts\newscript.pwn(6068) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors.
CMD:admindutyon(playerid, params[])
{
if(IsPlayerAdmin(playerid))
if(AdminOnDuty[playerid] == 1) return SendClientMessage(playerid,0xAA3333AA, "You're already on Adminstrator duty, Type /AdminDutyOff to OFF your duty!");
else
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
new string[128];
AdminOnDuty[playerid] = 1;
format(string,sizeof(string), "Adminstrator %s is now on Admin duty.", pName);
SendClientMessageToAll(0x33CCFFAA, string);
}
else
{
SendClientMessage(playerid, 0xAA3333AA, "You're not an adminstrator to use this cmd");
}
return 1;
}
CMD:admindutyoff(playerid, params[])
{
if(IsPlayerAdmin(playerid))
if(AdminOnDuty[playerid] == 0) return SendClientMessage(playerid,0xAA3333AA, "You're already off Adminstrator Duty, Type /AdminDutyOn to ON your duty!");
else
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
new string[128];
AdminOnDuty[playerid] = 0;
format(string,sizeof(string), "Adminstrator %s is no longer on Adminstrator duty.", pName);
SendClientMessageToAll(0x33CCFFAA, string);
}
else
{
SendClientMessage(playerid, 0xAA3333AA, "You're not an adminstrator to use this cmd");
}
return 1;
}