SA-MP Forums Archive
When player choose a weapon. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: When player choose a weapon. (/showthread.php?tid=432428)



When player choose a weapon. - eldar7393 - 22.04.2013

I created a dialog of weapons' lists and I don't know how do I script that when a player chooses a listed item from the list, The weapons will stay on him even if he dies untill he decided to reset them (The last option in the dialog).

PHP код:
#define DIALOG_WEAPONS 7
if (strcmp("/weapons", cmdtext, true, 10) == 0){
    
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "{00F7FF}рщчйн{FFFFFF}", "рщчйн чмйн{FFFFFF}\n рщчйн лбгйн{FFFFFF}\n{0066ff}Deagle - CBUG{FFFFFF}\n айфес рщчйн{FFFFFF}", "бзйшд", "йцйад");
    return 
1;}
   if(
dialogid == DIALOG_WEAPONS)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
            
ResetPlayerWeapons(playerid);
            
GivePlayerWeapon(playerid, 22, 10000);
            
GivePlayerWeapon(playerid, 26, 10000);
            
GivePlayerWeapon(playerid, 28, 10000);
            
SendClientMessage(playerid, COLOR_YELLOW, "!чйбмъ рщчйн чмйн");
            }
            
            if(
listitem == 1)
            {
            
ResetPlayerWeapons(playerid);
            
GivePlayerWeapon(playerid, 24, 10000);
            
GivePlayerWeapon(playerid, 27, 10000);
            
GivePlayerWeapon(playerid, 29, 10000);
            
GivePlayerWeapon(playerid, 31, 10000);
            
GivePlayerWeapon(playerid, 34, 10000);
            
SendClientMessage(playerid, COLOR_YELLOW, "!чйбмъ рщчйн лбгйн");
            }
            
            if(
listitem == 2)
            {
            
ResetPlayerWeapons(playerid);
            
GivePlayerWeapon(playerid, 24, 10000);
            
SendClientMessage(playerid, 0x0066ffff, "!C-BUGчйбмъ гйвм мчшбеъ д");
            }
        
            if(
listitem == 3)
            {
            
ResetPlayerWeapons(playerid);
            
SendClientMessage(playerid, COLOR_YELLOW, "!айфсъ аъ дрщчйн щмк");
            }
            }
            return 
1;
    } 
This is my old mod so if there will be any question why didn't I use 'case's the answer can be found here
Thanks for the help.