Saving Weapons
#1

Hey, Can anyone tell me a way to save a players original weapons before /onduty and give them back at /offduty ?
I was successful with everything including health, armour, skin , color, and team but not weapons. Any help would be appreciated.
Reply
#2

GetPlayerWeaponData, a loop of 12, and a 2-dimensional variable with-in a global array:

EDIT: This should help you out: http://forum.sa-mp.com/showpost.php?...99&postcount=2
Reply
#3

Can you give me an example, I didn't quite understand.. This is my command

PHP код:
CMD:aduty(playerid,params[])
{
    new 
string[128];
    if (
PInfo[playerid][Admin] < 1) return SendClientMessage(playeridRED,"[ERROR]: {FFFFFF}You do not have the privilleges to perform this command.");
    if(
AdminDuty[playerid] == 0)
    {
        
oldteam[playerid] = GetPlayerTeam(playerid);
        
oldcolor[playerid] = GetPlayerColor(playerid);
        
oldskin[playerid] = GetPlayerSkin(playerid);
        
oldhealth[playerid] = GetPlayerHealth(playerid);
        
oldarmour[playerid] = GetPlayerArmour(playerid);
        
ResetPlayerWeapons(playerid);
        
        
format(string,sizeof(string),"[ADMIN DUTY]: {FFFFFF}Administrator %s is now in on-duty admin mode.",GetName(playerid));
        
SendClientMessageToAll(COLOR_ADMIN,string);
        
SetPlayerHealth(playerid500000);
        
SetPlayerColor(playerid,PINK);
        
SetPlayerSkin(playerid217);
        
GivePlayerWeapon(playerid38999999);
        
AdminDuty[playerid] = 1;
        
SetPlayerTeam(playeridTEAM_NONE);
        
adminlabel[playerid] = Create3DTextLabel("Admin on duty\n Do Not Attack!"RED30.040.050.040.00);
        
Attach3DTextLabelToPlayer(adminlabel[playerid], playerid0.00.00.7);
    }
    else
    if(
AdminDuty[playerid] == 1)
    {
        
format(string,sizeof(string),"[ADMIN DUTY]: {FFFFFF}Administrator %s is no longer in on-duty admin mode.",GetName(playerid));
        
SendClientMessageToAll(COLOR_ADMIN,string);
        
AdminDuty[playerid] = 0;
        
ResetPlayerWeapons(playerid);
        
adminlabel[playerid] = Create3DTextLabel("Admin on duty\n Do Not Attack!"RED30.040.050.040.00);
        
Delete3DTextLabel(adminlabel[playerid]);
        
SetPlayerHealth(playeridoldhealth[playerid]);
        
SetPlayerArmour(playeridoldarmour[playerid]);
        
SetPlayerSkin(playeridoldskin[playerid]);
        
SetPlayerTeam(playeridoldteam[playerid]);
        
SetPlayerColor(playeridoldcolor[playerid]);
    }
    return 
1;

Reply
#4

In an indirect way you're telling me to give you the code for it, which I won't, the thread which I linked you to, already explains and does that, you just need to change the variable to global from local. And if you still don't get what local and global variables are, then I'm sorry but you need to read the SA-MP wiki.
Reply
#5

@Uvais, this section was made to help peoples for their bad/miss.u of code. Not to code for them.
Reply
#6

Thanks for the help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)