[FilterScript] /shop(Dialog!)
#1

Heres a small shop FS type thing i worked like 10 min on it, I got bord and felt like giveing back so here


put this right before your OnGameModeinit
Quote:

new Menu:shop;

then in OnGameModeinit
Quote:

shop = CreateMenu("shop", 2, 200.0, 100.0, 150.0, 150.0);

AddMenuItem(shop, 0, "Deagle");
AddMenuItem(shop, 0, "AK47");
AddMenuItem(shop, 0, "M4");
AddMenuItem(shop, 0, "Satchel");
AddMenuItem(shop, 0, "Spaz");
AddMenuItem(shop, 0, "Shotgun");

AddMenuItem(shop, 0, "Sniper");
AddMenuItem(shop, 0, "Rifle");
AddMenuItem(shop, 0, "SMG");
AddMenuItem(shop, 0, "MP5");
AddMenuItem(shop, 0, "Sawn-Offs");
AddMenuItem(shop, 0, "SD pistol");
AddMenuItem(shop, 0, "Molotives");

then this in OnPlayerSelectedMenuRow(playerid, row)
Quote:

{
new Menu:CurrentMenu = GetPlayerMenu(playerid);//This should be first
if(CurrentMenu == shop)
{

switch(row)
{
case 0: //Deagle
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0x40FF00FF, "You dont have enough money");
GivePlayerWeapon(playerid,24,10000);
GivePlayerMoney(playerid,-1000);
}
case 1: //AK 47
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, 0x40FF00FF, "You dont have enough money");
GivePlayerWeapon(playerid,30,10000);
GivePlayerMoney(playerid,-3000);

}
case 2: //M4
{
if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, 0x40FF00FF, "You dont have enough money");
GivePlayerWeapon(playerid,31,10000);
GivePlayerMoney(playerid,-2000);
}
case 3: //Satchel
{
if(GetPlayerMoney(playerid) < 100000) return SendClientMessage(playerid, 0x40FF00FF, "You dont have enough money");
GivePlayerWeapon(playerid,39,10000);
GivePlayerWeapon(playerid,40,1);
GivePlayerMoney(playerid,-100000);
}
case 4: //spaz
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0x40FF00FF, "You dont have enough money");
GivePlayerWeapon(playerid,27,10000);
GivePlayerMoney(playerid,-5000);
}
case 5: //shotgun
{
if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0x40FF00FF, "You dont have enough money");
GivePlayerWeapon(playerid,25,10000);
GivePlayerMoney(playerid,500);
}
case 6: //sniper
{
if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0x40FF00FF, "You dont have enough money");
GivePlayerWeapon(playerid,34,10000);
GivePlayerMoney(playerid,-10000);
}
case 7://rifle
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0x40FF00FF, "You dont have enough money");
GivePlayerWeapon(playerid,33,10000);
GivePlayerMoney(playerid,-1000);
}
case 8://SMGs
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0x40FF00FF, "You dont have enough money");
GivePlayerWeapon(playerid,32,10000);
GivePlayerMoney(playerid,-1000);
}
case 9://mp 5
{
if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, 0x40FF00FF, "You dont have enough money");
GivePlayerWeapon(playerid,29,10000);
GivePlayerMoney(playerid,-2000);
}
case 10: //sawnoffs
{
if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0x40FF00FF, "You dont have enough money");
GivePlayerWeapon(playerid,26,10000);
GivePlayerMoney(playerid,-10000);
}
case 11://SD pistol
{
if(GetPlayerMoney(playerid)<5000) return SendClientMessage(playerid,0x40FF00FF,"You Dont have enough money");
GivePlayerWeapon(playerid,23,10000);
GivePlayerMoney(playerid,-5000);
}
case 12://molotives
{
if(GetPlayerMoney(playerid)<5000) return SendClientMessage(playerid,0x40FF00FF,"You Dont have enough money");
GivePlayerWeapon(playerid,18,10000);
GivePlayerMoney(playerid,-5000);
}
}
}
return 1;
}

then put this on OnPlayerTextCommand
Quote:

{


if(strcmp(cmdtext, "/shop", true) == 0)
{
ShowMenuForPlayer(shop,playerid);
return 1;
}

thats it I dont care if you add my name in the credits or not :/
enjoy haveing a /shop command
Reply
#2

Wheres .pwn and .amx? By the way this is a way too outdated.
Reply
#3

I think this script very simple. This filterscript is your first?
Reply
#4

You could do a fs
Reply
#5

Quote:
Originally Posted by Spiral
Посмотреть сообщение
By the way this is a way too outdated.
if its outdated then explain me a new one -.-
Reply
#6

this is not Dialog but Menu... Fail.
Reply
#7

Good job. Maybe in your next version you can do it in Dialog. Menus are not used very often anymore.
Reply
#8

Thanks George took me a bit to make
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)