Dialog More menus 1+ rep - 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)
+--- Thread: Dialog More menus 1+ rep (
/showthread.php?tid=430634)
Dialog More menus 1+ rep -
canip - 14.04.2013
Thanks for the help to the cars...
i need help to the more menus in a dialog like " Heavy weapons " " Small weapons " and then i select Heavy weapons wil m4, ak and rocket come up and then i select Small weapons will colt and deagle come up...
Can someone send me a code to it
PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#define DIALOG_WEAPONS 3
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/weapon", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle\nAK-47\nCombat Shotgun", "Select", "Close");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPONS)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
if(listitem == 0) // They selected the first item - Desert Eagle
{
GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Give them a desert eagle
}
if(listitem == 1) // They selected the second item - AK-47
{
GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
}
if(listitem == 2) // They selected the third item - Desert Eagle
{
GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Give them a Combat Shotgun
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
Re: Dialog More menus 1+ rep -
canip - 14.04.2013
Are there someone there will help me?
Re: Dialog More menus 1+ rep -
mrskull42 - 14.04.2013
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#define DIALOG_WEAPONS 3
#define HEAVY_WEAPONS 1
#define LIGHT_WEAPONS 2
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/weapon", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Heavy Weapons\n Small Weapons", "Select", "Close");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPONS)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
if(listitem == 0) // They selected the first item - Desert Eagle
{
ShowPlayerDialog(playerid, LIGHT_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle\n Colt", "Select", "Close");
}
if(listitem == 1) // They selected the second item - AK-47
{
ShowPlayerDialog(playerid, HEAVY_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "AK-47\n M4\n Rocket Launcher", "Select", "Close");
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
if(dialogid == LIGHT_WEAPONS)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
if(listitem == 0) // They selected the first item - Desert Eagle
{
GivePlayerWeapon(playerid, 24, 14);
}
if(listitem == 1) // They selected the first item - Desert Eagle
{
GivePlayerWeapon(playerid, 22, 14);
}
}
}
if(dialogid == HEAVY_WEAPONS)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
if(listitem == 0) // They selected the first item - Desert Eagle
{
GivePlayerWeapon(playerid, 30, 14);
}
if(listitem == 1) // They selected the first item - Desert Eagle
{
GivePlayerWeapon(playerid, 31, 14);
}
if(listitem == 2) // They selected the first item - Desert Eagle
{
GivePlayerWeapon(playerid, 35, 14);
}
}
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
Untested, see if it works.
Re: Dialog More menus 1+ rep -
canip - 14.04.2013
It works thanks i give you a rep