//Includes #include <a_samp> #include <zcmd>
//Color Defines #define COLOR_GREY 0xAFAFAFAA #define COLOR_GREEN 0x33AA33AA #define COLOR_RED 0xAA3333AA #define COLOR_YELLOW 0xFFFF00AA #define COLOR_WHITE 0xFFFFFFAA #define COLOR_BLUE 0x0000BBAA //Defines #define DIALOG_STORE 0 #define DIALOG_PISTOLS 1 #define DIALOG_SUBS 2 #define DIALOG_SHOTGUNS 3 #define DIALOG_ASSAULT 4 #define DIALOG_RIFLES 5 #define DIALOG_MELEE 6 #define DIALOG_HEAVY 7
//Stock Functions stock Money(playerid,amount) { if(GetPlayerMoney(playerid)>=amount)return 1; return 0; } stock SCM(playerid, color, string[]) { SendClientMessage(playerid, color, string); }
CMD:store(playerid, params[]) { ShowPlayerDialog(playerid, DIALOG_STORE, DIALOG_STYLE_LIST, "Weapons Shop", "Melee Weapons\nPistols\nSub-Machine Guns\nShotguns\nAssault Rifles\nRifles\nHeavy Weapons\n$500 - Body Armour", "Select", "Cancel"); return 1; }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_STORE) { if(response){ switch(listitem){ case 0:{ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "Melee Weapons Shop", "$10 - Brass Knuckles\n$50 - Golf Club\n$50 - NightStick\n$100 - Knife\n$50 - Baseball Bat\n$50 - Shovel\n$50 - Pool Cue\n$100 - Katana\n$10 - Flowers\n$50 - Cane", "Select", "Back");} case 1:{ShowPlayerDialog(playerid, DIALOG_PISTOLS, DIALOG_STYLE_LIST, "Pistols Shop", "$500 - Colt .45\n$750 - Silenced Colt .45\n$1000 - Desert Eagle", "Select", "Back");} case 2:{ShowPlayerDialog(playerid, DIALOG_SUBS, DIALOG_STYLE_LIST, "Sub-Machine Gun Shop", "$1000 - UZI\n$1000 - Tec-9\n$1000 - MP5", "Select", "Back");} case 3:{ShowPlayerDialog(playerid, DIALOG_SHOTGUNS, DIALOG_STYLE_LIST, "Shotgun Shop", "$500 - Shotgun\n$2000 - Sawn-Off Shotgun\n$2000 - Combat Shotgun", "Select", "Back");} case 4:{ShowPlayerDialog(playerid, DIALOG_ASSAULT, DIALOG_STYLE_LIST, "Assault Rifle Shop", "$1000 - AK47\n$1000 - M4", "Select", "Back");} case 5:{ShowPlayerDialog(playerid, DIALOG_RIFLES, DIALOG_STYLE_LIST, "Rifle Shop", "$750 - Country Rifle\n$1000 - Sniper Rifle", "Select", "Back");} case 6:{ShowPlayerDialog(playerid, DIALOG_HEAVY, DIALOG_STYLE_LIST, "Heavy Weapons Shop", "$20,000 - RPG\n$20,000 - Flamethrower\n$60,000 - Minigun", "Select", "Back");} case 7:{if(!Money(playerid, 500))return SCM(playerid, COLOR_GREY, "You can't afford that!");SetPlayerArmour(playerid, 100);GivePlayerMoney(playerid,-500);SCM(playerid, COLOR_YELLOW, "You have purchased a full set of Body Armour for $500");} } } }
if(dialogid == DIALOG_PISTOLS) { if(response){ switch(listitem){ case 0:{if(!Money(playerid, 500))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 22, 250);GivePlayerMoney(playerid,-500);SCM(playerid, COLOR_YELLOW, "You have purchased a Colt .45 with 250 rounds for $500");} case 1:{if(!Money(playerid, 750))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 23, 250);GivePlayerMoney(playerid,-750);SCM(playerid, COLOR_YELLOW, "You have purchased a Silenced Colt .45 with 250 rounds for $750");} case 2:{if(!Money(playerid, 1000))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 24, 250);GivePlayerMoney(playerid,-1000);SCM(playerid, COLOR_YELLOW, "You have purchased a Desert Eagle with 250 rounds for $1000");} } }else return ShowPlayerDialog(playerid, DIALOG_STORE, DIALOG_STYLE_LIST, "Weapons Shop", "Melee Weapons\nPistols\nSub-Machine Guns\nShotguns\nAssault Rifles\nRifles\nHeavy Weapons\n$500 - Body Armour", "Select", "Cancel"); }
if(dialogid == DIALOG_SUBS) { if(response){ switch(listitem){ case 0:{if(!Money(playerid, 1000))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 28, 250);GivePlayerMoney(playerid,-1000);SCM(playerid, COLOR_YELLOW, "You have purchased a UZI with 250 rounds for $1000");} case 1:{if(!Money(playerid, 1000))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 32, 250);GivePlayerMoney(playerid,-1000);SCM(playerid, COLOR_YELLOW, "You have purchased a Tec-9 with 250 rounds for $1000");} case 2:{if(!Money(playerid, 1000))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 29, 250);GivePlayerMoney(playerid,-1000);SCM(playerid, COLOR_YELLOW, "You have purchased a MP5 with 250 rounds for $1000");} } }else return ShowPlayerDialog(playerid, DIALOG_STORE, DIALOG_STYLE_LIST, "Weapons Shop", "Melee Weapons\nPistols\nSub-Machine Guns\nShotguns\nAssault Rifles\nRifles\nHeavy Weapons\n$500 - Body Armour", "Select", "Cancel"); }
if(dialogid == DIALOG_SHOTGUNS) { if(response){ switch(listitem){ case 0:{if(!Money(playerid, 500))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 25, 250);GivePlayerMoney(playerid,-500);SCM(playerid, COLOR_YELLOW, "You have purchased a Shotgun with 250 rounds for $500");} case 1:{if(!Money(playerid, 2000))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 26, 250);GivePlayerMoney(playerid,-2000);SCM(playerid, COLOR_YELLOW, "You have purchased a Sawn-Off Shotgun with 200 rounds for $2000");} case 2:{if(!Money(playerid, 2000))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 27, 250);GivePlayerMoney(playerid,-2000);SCM(playerid, COLOR_YELLOW, "You have purchased a Combat Shotgun with 250 rounds for $2000");} } }else return ShowPlayerDialog(playerid, DIALOG_STORE, DIALOG_STYLE_LIST, "Weapons Shop", "Melee Weapons\nPistols\nSub-Machine Guns\nShotguns\nAssault Rifles\nRifles\nHeavy Weapons\n$500 - Body Armour", "Select", "Cancel"); }
if(dialogid == DIALOG_ASSAULT) { if(response){ switch(listitem){ case 0:{if(!Money(playerid, 1000))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 30, 250);GivePlayerMoney(playerid,-1000);SCM(playerid, COLOR_YELLOW, "You have purchased a AK47 with 250 rounds for $1000");} case 1:{if(!Money(playerid, 1000))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 31, 250);GivePlayerMoney(playerid,-1000);SCM(playerid, COLOR_YELLOW, "You have purchased a M4 with 250 rounds for $1000");} } }else return ShowPlayerDialog(playerid, DIALOG_STORE, DIALOG_STYLE_LIST, "Weapons Shop", "Melee Weapons\nPistols\nSub-Machine Guns\nShotguns\nAssault Rifles\nRifles\nHeavy Weapons\n$500 - Body Armour", "Select", "Cancel"); }
if(dialogid == DIALOG_RIFLES) { if(response){ switch(listitem){ case 0:{if(!Money(playerid, 750))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 33, 250);GivePlayerMoney(playerid,-750);SCM(playerid, COLOR_YELLOW, "You have purchased a Country Rifle with 250 rounds for $750");} case 1:{if(!Money(playerid, 1000))return SCM(playerid, COLOR_GREY, "You can't afford that!");GivePlayerWeapon(playerid, 34, 250);GivePlayerMoney(playerid,-1000);SCM(playerid, COLOR_YELLOW, "You have purchased a Sniper Rifle with 250 rounds for $1000");} } }else return ShowPlayerDialog(playerid, DIALOG_STORE, DIALOG_STYLE_LIST, "Weapons Shop", "Melee Weapons\nPistols\nSub-Machine Guns\nShotguns\nAssault Rifles\nRifles\nHeavy Weapons\n$500 - Body Armour", "Select", "Cancel"); }
#define SCM SendClientMessage
Why use a SCM stock when you can just do this?:
pawn Code:
|