SA-MP Forums Archive
[FilterScript] BuyWeapon with Dialog - My First FilterScript - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] BuyWeapon with Dialog - My First FilterScript (/showthread.php?tid=437048)



BuyWeapon with Dialog - My First FilterScript - chuck100 - 13.05.2013

Hey I just worked on that few minutes , Look this is too easy and theres kind alot of that but still its my first FilterScript , Now , Enjoy , I recommand that for RP Servers [ Sry for my English ] :O

Than in the FS U can just change the guns as you want and names ETC , Thanks anyway . I'm Chuck100...

Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>
#include <streamer>
#include <a_zones>
#include <foreach>
#include <yom_buttons>
#include <djson>
#include <progress>
#include <YSI\y_timers>
#include <ZCMD>
#include <sscanf2>

#define COLOR_LIGHTBLUE 0x33CCFFAA

#define BUYWEAPONMENU 2812

#if defined FILTERSCRIPT


public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Buy Weapon System buy Chuck100");
	print("--------------------------------------\n");
	return 1;
}
CMD:buyweapon(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 4.0, 314.26, -134.15, 999.60) || IsPlayerInRangeOfPoint(playerid, 6.0, 1415.727905, -1299.371093, 15.054657)) return SendClientMessage(playerid, -1, "You are not in range of the ammunation!");
    ShowPlayerDialog(playerid, 2812, DIALOG_STYLE_LIST, "Buy Gun", "SDPistol-2,000$\nShotgun-5,000$\nMP5-4,000$\nDeagle-30,000$\nM4[Limited 500 bullets]-60,000$\nAK47[Limited 500 bullets]-50,000$", "Select", "Cancel");
    return 1;
}
#else
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == BUYWEAPONMENU) // BUYWEAPONMENU
	{
		if(response)
		{
			if(listitem == 0)
		        {
				GivePlayerWeapon(playerid, 23, 99999);
				GivePlayerMoney(playerid, -2000);
				SendClientMessage(playerid, COLOR_LIGHTBLUE,"   You have purchased a silenced pistol!");
				return 1;
		     	}
			if(listitem == 1)
			    {
				GivePlayerWeapon(playerid, 25, 99999);
				GivePlayerMoney(playerid, -5000);
				SendClientMessage(playerid, COLOR_LIGHTBLUE,"   You have purchased a shotgun!");
				}
			if(listitem == 2)
			    {
				GivePlayerWeapon(playerid, 29, 99999);
				GivePlayerMoney(playerid, -4000);
				SendClientMessage(playerid, COLOR_LIGHTBLUE,"   You have purchased a MP5!");
				}
			if(listitem == 3)
				{
				GivePlayerWeapon(playerid, 24, 99999);
				GivePlayerMoney(playerid, -30000);
				SendClientMessage(playerid, COLOR_LIGHTBLUE,"   You have purchased a Deagle!");
				}
			if(listitem == 4)
			    {
				GivePlayerWeapon(playerid, 31, 500);
				GivePlayerMoney(playerid, -60000);
				SendClientMessage(playerid, COLOR_LIGHTBLUE,"   You have purchased a M4 - 500 Bullets!");
				}
			if(listitem == 5)
				{
				GivePlayerWeapon(playerid, 30, 99999);
				GivePlayerMoney(playerid, -50000);
				SendClientMessage(playerid, COLOR_LIGHTBLUE,"   You have purchased a AK/47 - 500 Bullets!");
				}
			}
	return 1;
	}
#endif



Re : BuyWeapon with Dialog - My First FilterScript - XDamienX007 - 13.05.2013

Easy ...
But thank's, it can be used by a newbie on pawno


Respuesta: BuyWeapon with Dialog - My First FilterScript - JustBored - 13.05.2013

Why all those includes?
(#include <streamer>
#include <a_zones>
#include <foreach>
#include <yom_buttons>
#include <djson>
#include <progress>
#include <YSI\y_timers>
#include <ZCMD>
#include <sscanf2>)


Re: BuyWeapon with Dialog - My First FilterScript - chuck100 - 13.05.2013

Cause I did it on a script and I took all the includes for no errors :P...


Re: BuyWeapon with Dialog - My First FilterScript - chuck100 - 14.05.2013

If you got more ideas for improve it and make it RPER tell me...


Re: BuyWeapon with Dialog - My First FilterScript - mineralo - 14.05.2013

replace "if" use "case" its more faster works also a lot useless includes, enough a_samp and zcmd


Re: BuyWeapon with Dialog - My First FilterScript - chuck100 - 14.05.2013

Ok Thank you anyway...


Re: BuyWeapon with Dialog - My First FilterScript - Abhishek. - 14.05.2013

if is slower than case what? Really i didnt knew that
and well what about goto?


Re: BuyWeapon with Dialog - My First FilterScript - chuck100 - 14.05.2013

You ask me ?


Re: BuyWeapon with Dialog - My First FilterScript - ImChroniX - 14.05.2013

Thanks for this. I'm a new scripter so this was really good to add to my server.