11.05.2013, 10:27
INTRODUCTION
In this tutorial we learn how to make a weapon shop through dialog style list
LETS GET STARTED
STEP 1
Include a_samp
STEP 2
Make a command in which dialog display
STEP 3
Give player weapon through dialog
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
Make a command in which dialog display
PHP Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("//Your command here", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 465, DIALOG_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;
}
Give player weapon through dialog
PHP Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
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;
}