15.01.2011, 20:21
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
then in OnGameModeinit
then this in OnPlayerSelectedMenuRow(playerid, row)
then put this on OnPlayerTextCommand
thats it I dont care if you add my name in the credits or not :/
enjoy haveing a /shop command
put this right before your OnGameModeinit
Quote:
new Menu:shop; |
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"); |
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; } |
Quote:
{ if(strcmp(cmdtext, "/shop", true) == 0) { ShowMenuForPlayer(shop,playerid); return 1; } |
enjoy haveing a /shop command