[Tutorial] Weapon shop throug dialog
#1

INTRODUCTION
In this tutorial we learn how to make a weapon shop through dialog style list
LETS GET STARTED
STEP 1
Include a_samp
PHP Code:
#include a_samp 
STEP 2
Make a command in which dialog display
PHP Code:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("//Your command here"cmdtexttrue10) == 0)
    {
            
ShowPlayerDialog(playerid465DIALOG_STYLE_LIST"Weapon shop""Weapon name here    here price    ammo here""BUY""CANCEL");//Cancel is important to cancel the dialog you can add colors in title and in dialog buy to buy the weapon 465 is the ID of dialog
        
return 1;
    }
    return 
0;

STEP 3
Give player weapon through dialog
PHP Code:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 465)//465 is the ID of dialog
    
{
        if(
reponse)
        {
            switch(
listitem)
            {
                case 
0://1st item
                
{
                    
GivePlayerWeapon(playerid//The weapon name you typed comment end\\, //The ammo you typed comment end\\);
                    
GivePlayerMoney(playerid, -//The price of weapon you typed comment end\\);
                
}
                case 
1://2nd item
                
{
                    
//Do what you do on 1st item comment end\\
                
}
            }
        }
    }
    return 
1;

Reply


Messages In This Thread
Weapon shop throug dialog - by BlackHorse - 11.05.2013, 10:27
Re: Weapon shop throug dialog - by Infinity - 11.05.2013, 10:41
Re: Weapon shop throug dialog - by freddy smyth - 19.05.2013, 10:27

Forum Jump:


Users browsing this thread: 1 Guest(s)