SA-MP Forums Archive
Make Class Selection Like This - 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: Make Class Selection Like This (/showthread.php?tid=633796)



Make Class Selection Like This - Lamy - 07.05.2017

Hi.
How To Make A Class Selection Like This :



Re: Make Class Selection Like This - YouHack - 07.05.2017

PHP код:
#define DIALOG_WEAPONS 3
 
// In some command
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons",
"Weapon\tAmmo\tPrice\n\
M4\t120\t500\n\
MP5\t90\t350\n\
AK-47\t120\t400"
,
"Select", "Close");
 
public 
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(
dialogid == DIALOG_WEAPONS)
    {
        if(
response) // If they clicked 'Select' or double-clicked a weapon
        
{
            
// Give them the weapon
            
switch(listitem)
            {
                case 
0: GivePlayerWeapon(playerid, WEAPON_M4, 120); // Give them an M4
                
case 1: GivePlayerWeapon(playerid, WEAPON_MP5, 90); // Give them an MP5
                
case 2: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
            
}
        }
        return 
1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    
}
 
    return 
0; // You MUST return 0 here! Just like OnPlayerCommandText.
} 
Source: https://sampwiki.blast.hk/wiki/OnDialogR...ABLIST_HEADERS


Re: Make Class Selection Like This - Lamy - 07.05.2017

Quote:
Originally Posted by YouHack
Посмотреть сообщение
PHP код:
#define DIALOG_WEAPONS 3
 
// In some command
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons",
"Weapon\tAmmo\tPrice\n\
M4\t120\t500\n\
MP5\t90\t350\n\
AK-47\t120\t400"
,
"Select", "Close");
 
public 
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(
dialogid == DIALOG_WEAPONS)
    {
        if(
response) // If they clicked 'Select' or double-clicked a weapon
        
{
            
// Give them the weapon
            
switch(listitem)
            {
                case 
0: GivePlayerWeapon(playerid, WEAPON_M4, 120); // Give them an M4
                
case 1: GivePlayerWeapon(playerid, WEAPON_MP5, 90); // Give them an MP5
                
case 2: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
            
}
        }
        return 
1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    
}
 
    return 
0; // You MUST return 0 here! Just like OnPlayerCommandText.
} 
Source: https://sampwiki.blast.hk/wiki/OnDialogR...ABLIST_HEADERS
I Need Class Selection Not Weapon xD. I Know how to make a dialog but idk how to make this class selection.


Re: Make Class Selection Like This - Kane - 07.05.2017

Show the dialog on connect. Check if they're the correct score and switch to the class they chose.


Re: Make Class Selection Like This - YouHack - 07.05.2017

It's an example, not a ready script.
Easily change it... no one will make a code for you except he copy it from a gamemode.