SA-MP Forums Archive
Weapon dialog prob! - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Weapon dialog prob! (/showthread.php?tid=222242)



Weapon dialog prob! - a!DaN)_)-) - 06.02.2011

hey this is my first dialog script and it seems ok...
the problem is that all of the wepon are on the same line so i can only spawn the minigun
heres the script
Код:
/*

*******************************************************
Dialog/Command based Weapon Spawner by FusiouS
Version: 1.1, Release 2 (Admins only version)
SA-MP Version: 0.3 Compatible (including newest 0.3c)
Credits: FusiouS
*******************************************************

				Features:
- Dialog/Command based weapon spawning.
- Guns in Weapon ID number order (Starting from 4-)
- Currently working for all users, can be easily changed for RCON admins only.
- Contains most used weapons in SA-MP.


			How to install & use:
				
1) Download package and place .pwn file to your filterscripts folder
2) Compile .pwn file to .amx and write to your server.cfg behind filterscripts: weapons
3) Start your server and login as RCON admin
4) Type /weapons and weapon list appears. Choose your weapon and press "spawn"


TERMS OF USE: You are free to modify this script for your OWN use only. DO NOT remove credits or re-release this as your own work.              */

#include <a_samp>
#define weapons 4670
#pragma tabsize 0

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Weapon Spawner by FusiouS loaded ");
print(" Version: 1.1, Release 2");
print("--------------------------------------");
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/weapons", true))

{
   ShowPlayerDialog(playerid, weapons, DIALOG_STYLE_LIST, "Weapon Spawner", "MiniGun/nFlameThrowe/nM4", "Spawn", "Cancel");
   return 1;
}

return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == weapons)
{
   switch(listitem)
   {
          case 0:
	    {
		    GivePlayerWeapon(playerid,38,9999)
	    }
	    case 1:
	    {
			 GivePlayerWeapon(playerid,37,9999)
	    }
	    case 2:
	    {
			GivePlayerWeapon(playerid,31,9999)
	    }
	   
   }
}
return 1;
}
hope u can help quick thanks!


Re: Weapon dialog prob! - Tee - 06.02.2011

Here it is:
pawn Код:
/*

*******************************************************
Dialog/Command based Weapon Spawner by FusiouS
Version: 1.1, Release 2 (Admins only version)
SA-MP Version: 0.3 Compatible (including newest 0.3c)
Credits: FusiouS
*******************************************************

                Features:
- Dialog/Command based weapon spawning.
- Guns in Weapon ID number order (Starting from 4-)
- Currently working for all users, can be easily changed for RCON admins only.
- Contains most used weapons in SA-MP.


            How to install & use:
               
1) Download package and place .pwn file to your filterscripts folder
2) Compile .pwn file to .amx and write to your server.cfg behind filterscripts: weapons
3) Start your server and login as RCON admin
4) Type /weapons and weapon list appears. Choose your weapon and press "spawn"


TERMS OF USE: You are free to modify this script for your OWN use only. DO NOT remove credits or re-release this as your own work.              */


#include <a_samp>
#define weapons 4670
#pragma tabsize 0

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Weapon Spawner by FusiouS loaded ");
print(" Version: 1.1, Release 2");
print("--------------------------------------");
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/weapons", true))

{
   ShowPlayerDialog(playerid, weapons, DIALOG_STYLE_LIST, "Weapon Spawner", "MiniGun\nFlameThrowe\nM4", "Spawn", "Cancel");
   return 1;
}

return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == weapons)
{
   switch(listitem)
   {
          case 0:
        {
            GivePlayerWeapon(playerid,38,9999)
        }
        case 1:
        {
             GivePlayerWeapon(playerid,37,9999)
        }
        case 2:
        {
            GivePlayerWeapon(playerid,31,9999)
        }
       
   }
}
return 1;
}
The problem was that you used "/n" for a new line. It should be "\n"

pawn Код:
ShowPlayerDialog(playerid, weapons, DIALOG_STYLE_LIST, "Weapon Spawner", "MiniGun\nFlameThrowe\nM4", "Spawn", "Cancel");//I changed the "/n" to "\n"



Re: Weapon dialog prob! - a!DaN)_)-) - 06.02.2011

thanks man but what as wrong?


Re: Weapon dialog prob! - Tee - 07.02.2011

Sorry i edited the post, look below your script and at the last script (scroll to the right on the last script).


Re: Weapon dialog prob! - a!DaN)_)-) - 07.02.2011

oh wrong slash thanks man but one more thing why does the flamethrower replace the mini gun vice versa


Re: Weapon dialog prob! - Tee - 07.02.2011

What you mean? When you click Flamethrower you get minigun?


Re: Weapon dialog prob! - TheYoungCapone - 07.02.2011

Quote:
Originally Posted by a!DaN)_)-)
Посмотреть сообщение
oh wrong slash thanks man but one more thing why does the flamethrower replace the mini gun vice versa
because there both heavy weapons so they will replace one another just like a rocket launcher would replace flamethrower


Re: Weapon dialog prob! - a!DaN)_)-) - 07.02.2011

ok nice 1 guys next its a register system lol