[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
#2

How? How can you write a tutorial about something so simple it doesn't even need a tutorial, and still mess it up?
You explain nothing. Not too suprising, as there's hardly anything to explain. The comments are a total mess. And for those who want to actually try and understand this, you've given pretty lousy examples. (For example, how do I add a second option to my dialog?)

All in all, users are better off visiting this page:
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
Reply
#3

Your intentions were met well, but I agree with Infinity. It's hard to make anything out of this tutorial unfortunately.

It's more of a set of instructions, rather than a tutorial. :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)