Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------------------------------------
- -- Author: Sebastian 'Seb' Cronberg
- -- Project Start Date: 22/04/12
- -- Project End Date: None Set
- -- Purpose: An ammunation shop, easy to modify.
- -- Progress: 5%
- -- Rights: Allowed to be edited if you have permission from the author.
- ----------------------------------------------------------------------------------------
- -- random variables
- local money = getPlayerMoney
- local cant_afford = "You can't afford this weapon, please come back when you have enough cash."
- -- below will give every weapon id a variable (easier for me ( the scripter ) to edit/add )
- local deagle = 24
- local silenced =23
- local colt = 22
- local uzi = 25
- local tec9 = 32
- local ak = 30
- local m4 = 31
- local satchel = 39
- local grande = 16
- local rpg = 36
- local spaz = 27
- local shotgun = 25
- -- below will obviously set how much a weapon will cost.
- local deagleCost = 2500
- local silencedCost = 850
- local coltCost = 850
- local uziCost = 1450
- ---Stopped here
- local tec9Cost = 1450
- local akCost = 2000
- local m4Cost = 2000
- local satchelCost = 5500
- local granadeCost = 5500
- local rpgCost = 100000
- local spazCost = 1500
- local shotgunCost = 1500
- -- below will obviously set how much ammo the player should get when buying any weapon.
- local deagleAmmo = 150
- local silencedAmmo = 25
- local coltAmmo = 25
- local uziAmmo = 100
- local tecAMmo = 100
- local akAmmo = 150
- local m4Ammo = 150
- local satchelAmmo = 10
- local grandeAmmo = 10
- local rpgAmmo = 1
- local spazAmmo = 25
- local shotgunAmmo = 25
- local dglMsg = "You have purchased " ..deagleAmmo.. " shots of Deagle for $" ..deagleCost
- local silencedMsg = "You have purchased" ..silencedAmmo.. " shots of Silenced for $" ..silencedCost
- local coltMsg = "You have purchased " ..coltAmmo.. " shots of Colt for $" ..coltCost
- local uziMsg = "You have purchased " ..uziAmmo.. " shots of uzi for $" ..uziCost
- -- below will create a table which will determinate which posx, posy and which it should have, also which interior and dimension.
- local markers = {
- -- { posx , posy , posz , interior , dimension } ,
- { 207.48498535156 , -101.42776489258 , 1004.2578125 , 15 , 0 } ,
- { 207.10119628906 , -130.03713989258 , 1002.5078125 , 3 , 0 } ,
- { 204.33052062988 , -159.76615905762 , 999.5234375 , 14 , 0 } ,
- { 161.4536895752 , -84.164611816406 , 1000.8046875 , 18 , 0 } ,
- }
- -- below will create the markers and set the given posx, posy, posz, dimension and interior.
- addEventHandler ( "onResourceStart" , resourceRoot ,
- function ( )
- for index , marker in pairs ( markers ) do
- local wepMarker = createMarker ( marker [ 1 ] , marker [ 2 ] , marker [ 3 ] , "cylinder" , 1.5 , 255 , 255 , 0 , 255 )
- setElementInterior ( wepMarker , marker [ 4 ] )
- setElementDimension ( wepMarker , marker [ 5 ] )
- end
- end
- )
- addEvent ( "dglBuy", true )
- function dglBuy ()
- if ( money (source) >= deagleCost ) then
- giveWeapon ( client, deagle, deagleAmmo )
- takePlayerMoney ( client, deagleCost )
- outputChatBox ( dglMsg, client, 0, 255, 30, true )
- else
- outputChatBox ( cant_afford, client, 255, 0, 0, true )
- end
- end
- addEventHandler ( "dglBuy", root, dglBuy )
- addEvent ( "silencedBuy", true )
- function silencedBuy ()
- if ( money (source) >= silencedCost ) then
- giveWeapon ( client, silenced, silencedAmmo )
- outputChatBox ( silencedMsg, client, 255, 255, 0, true )
- else
- outputChatBox ( cant_afford, client, 255, 0, 0, true )
- end
- end
- addEventHandler ( "silencedBuy", root, silencedBuy )
- addEvent ( "coltBuy", true )
- function coltBuy ()
- if ( money (source) >= coltCost ) then
- giveWeapon ( client, colt, coltAmmo )
- outputChatBox ( coltMsg, client, 255, 255, 0, true )
- else
- outputChatBox ( cant_afford, client, 255, 0, 0, true )
- end
- end
- addEventHandler ( "coltBuy", root, coltBuy )
- addEvent ( "uziBuy", true)
- function uziBuy ()
- if ( money (source) >= uziCost ) then
- giveWeapon ( client, uzi, uziAmmo )
- outputChatBox ( uziMsg, client, 255, 255, 0, true )
- else
- outputChatBox ( cant_afford, client, 255, 0, 0, true )
- end
- end
- addEventHandler ( "uziBuy", root, uziBuy )
- addEvent ( "tec9Buy", true )
- function tec9Buy ()
- if ( money (source) >= tec9Cost ) then
- giveWeapon ( client, tec9, tec9Ammo )
- takePlayerMoney ( client, tec9Cost )
- outputChatBox ( tec9Msg, client, 255, 255, 0, true)
- else
- otuputChatBox ( cant_afford, client, 255, 0, 0, true)
- end
- end
- addEventHandler ( "tec9Buy", root, tec9Buy )
Advertisement
Add Comment
Please, Sign In to add comment