Make Class Selection Like This
#1

Hi.
How To Make A Class Selection Like This :
Reply
#2

PHP код:
#define DIALOG_WEAPONS 3
 
// In some command
ShowPlayerDialog(playeridDIALOG_WEAPONSDIALOG_STYLE_LIST"Weapons",
"Weapon\tAmmo\tPrice\n\
M4\t120\t500\n\
MP5\t90\t350\n\
AK-47\t120\t400"
,
"Select""Close");
 
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_WEAPONS)
    {
        if(
response// If they clicked 'Select' or double-clicked a weapon
        
{
            
// Give them the weapon
            
switch(listitem)
            {
                case 
0GivePlayerWeapon(playeridWEAPON_M4120); // Give them an M4
                
case 1GivePlayerWeapon(playeridWEAPON_MP590); // Give them an MP5
                
case 2GivePlayerWeapon(playeridWEAPON_AK47120); // 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
Reply
#3

Quote:
Originally Posted by YouHack
Посмотреть сообщение
PHP код:
#define DIALOG_WEAPONS 3
 
// In some command
ShowPlayerDialog(playeridDIALOG_WEAPONSDIALOG_STYLE_LIST"Weapons",
"Weapon\tAmmo\tPrice\n\
M4\t120\t500\n\
MP5\t90\t350\n\
AK-47\t120\t400"
,
"Select""Close");
 
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_WEAPONS)
    {
        if(
response// If they clicked 'Select' or double-clicked a weapon
        
{
            
// Give them the weapon
            
switch(listitem)
            {
                case 
0GivePlayerWeapon(playeridWEAPON_M4120); // Give them an M4
                
case 1GivePlayerWeapon(playeridWEAPON_MP590); // Give them an MP5
                
case 2GivePlayerWeapon(playeridWEAPON_AK47120); // 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.
Reply
#4

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)