[Tutorial] Weapon shop throug dialog - 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)
+---- Forum: Tutorials (
https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Weapon shop throug dialog (
/showthread.php?tid=436404)
Weapon shop throug dialog -
BlackHorse - 11.05.2013
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(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;
}
STEP 3
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;
}
Re: Weapon shop throug dialog -
Infinity - 11.05.2013
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
Re: Weapon shop throug dialog -
freddy smyth - 19.05.2013
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. :/