• Addon config
    2 replies, posted
Made an addon everything is good. Only thing is the config which I've set up horribly. Is there any way I could make it better? [CODE]zvendor.weapon1name = "M4A1" -- Name of the weapon zvendor.weapon1desc = "Fast shooting assault rifle" -- Description of the weapon zvendor.weapon1bprice = "$2000" -- This is the price that shows on the button, not the actual price. zvendor.weapon1aprice = 2000 -- That's the actual price. zvendor.weapon1entity = "m9k_m4a1" -- The entity name of the weapon. zvendor.weapon2name = "MP5" -- Name of the weapon zvendor.weapon2desc = "Standard issue SMG" -- Description of the weapon zvendor.weapon2bprice = "$1500" -- This is the price that shows on the button, not the actual price. zvendor.weapon2aprice = 1500 -- That's the actual price. zvendor.weapon2entity = "m9k_mp5sd" -- The entity name of the weapon. zvendor.weapon3name = "FN P90" -- Name of the weapon zvendor.weapon3desc = "High recoil and ammo weapon" -- Description of the weapon zvendor.weapon3bprice = "$3500" -- This is the price that shows on the button, not the actual price. zvendor.weapon3aprice = 3500 -- That's the actual price. zvendor.weapon3entity = "m9k_smgp90" -- The entity name of the weapon. zvendor.weapon4name = "Winchester" -- Name of the weapon zvendor.weapon4desc = "Old school pump shotgun" -- Description of the weapon zvendor.weapon4bprice = "$1000" -- This is the price that shows on the button, not the actual price. zvendor.weapon4aprice = 1000 -- That's the actual price. zvendor.weapon4entity = "m9k_1897winchester" -- The entity name of the weapon. zvendor.weapon5name = "Dragunov" -- Name of the weapon zvendor.weapon5desc = "Highly accurate sniper rifle" -- Description of the weapon zvendor.weapon5bprice = "$5000" -- This is the price that shows on the button, not the actual price. zvendor.weapon5aprice = 5000 -- That's the actual price. zvendor.weapon5entity = "m9k_svu" -- The entity name of the weapon. zvendor.weapon6name = "Machete" -- Name of the weapon zvendor.weapon6desc = "Tribal way of chopping people" -- Description of the weapon zvendor.weapon6bprice = "$500" -- This is the price that shows on the button, not the actual price. zvendor.weapon6aprice = 500 -- That's the actual price. zvendor.weapon6entity = "m9k_machete" -- The entity name of the weapon. -- AMMO VENDING MACHINE -- zvendor.ammo1name = "Pistol" -- Name of the ammo zvendor.ammo1desc = "30 pistol ammunition" -- Description of the ammo zvendor.ammo1bprice = "$100" -- This is the price that shows on the button, not the actual price. zvendor.ammo1aprice = 100 -- That's the actual price. zvendor.ammo1entity = "pistol" -- The entity name of the ammo. zvendor.ammo1amount = 30 -- The amount of ammo to give zvendor.ammo2name = "Assault" -- Name of the ammo zvendor.ammo2desc = "30 assault ammunition" -- Description of the ammo zvendor.ammo2bprice = "$300" -- This is the price that shows on the button, not the actual price. zvendor.ammo2aprice = 300 -- That's the actual price. zvendor.ammo2entity = "ar2" -- The entity name of the ammo. zvendor.ammo2amount = 30 -- The amount of ammo to give zvendor.ammo3name = "Sniper" -- Name of the ammo zvendor.ammo3desc = "30 sniper ammunition" -- Description of the ammo zvendor.ammo3bprice = "$250" -- This is the price that shows on the button, not the actual price. zvendor.ammo3aprice = 250 -- That's the actual price. zvendor.ammo3entity = "SniperPenetratedRound" -- The entity name of the ammo. zvendor.ammo3amount = 30 -- The amount of ammo to give zvendor.ammo4name = "Shotgun" -- Name of the ammo zvendor.ammo4desc = "22 shotgun ammunition" -- Description of the ammo zvendor.ammo4bprice = "$150" -- This is the price that shows on the button, not the actual price. zvendor.ammo4aprice = 150 -- That's the actual price. zvendor.ammo4entity = "buckshot" -- The entity name of the ammo. zvendor.ammo4amount = 22 -- The amount of ammo to give zvendor.ammo5name = "SMG" -- Name of the ammo zvendor.ammo5desc = "60 smg ammunition" -- Description of the ammo zvendor.ammo5bprice = "$350" -- This is the price that shows on the button, not the actual price. zvendor.ammo5aprice = 350 -- That's the actual price. zvendor.ammo5entity = "smg1" -- The entity name of the ammo. zvendor.ammo5amount = 60 -- The amount of ammo to give zvendor.ammo6name = "357" -- Name of the ammo zvendor.ammo6desc = "60 357 ammunition" -- Description of the ammo zvendor.ammo6bprice = "$125" -- This is the price that shows on the button, not the actual price. zvendor.ammo6aprice = 125 -- That's the actual price. zvendor.ammo6entity = "357" -- The entity name of the weapon. zvendor.ammo6amount = 60 -- The amount of ammo to give[/CODE]
[CODE]zvendor.weapons = {} zvendor.ammo = {} function zvendor:AddWeapon( class, data ) local consData = {} consData.name = data.name or "invalid name" consData.desc = data.desc or "invalid description" consData.price = data.price or "invalid price" zvendor.weapons[class] = consData end function zvendor:AddAmmoType( ammoType, data ) local consData = {} consData.name = data.name or "invalid ammo name" consData.desc = data.desc or "invalid ammo description" consData.price = data.price or "invalid ammo price" consData.amount = data.amount or "invalid ammo amount" zvendor.ammo[ammoType] = consData end --[[------------------------------------------------------------------------- Examples ---------------------------------------------------------------------------]] zvendor:AddWeapon( "m9k_machete", { name = "Machete", desc = "Tribal way of chopping people", price = 500, }) zvendor:AddAmmoType( "pistol", { name = "Pistol Ammo", desc = "30 pistol ammunition", price = 100, amount = 30, })[/CODE] Also - for future reference, you can simply just concat the price ( of the weapon ) with a dollar sign, and save yourself the extra typing. eg. [CODE]local formattedPrice = "$" .. price[/CODE]
Thank you so much.
Sorry, you need to Log In to post a reply to this thread.