Jump to content

Vip Points - Mta dayz


JanKy

Recommended Posts

Hello, its me again, with the same server but different problem. Now the server is hosted and i implemented a 'vip-points system' with a vip points shop, to stimulate players to donate on my server ( so i can host it longer ) . And on every donation the player gets an amount of VP.

There  is a problem. If the player disconnect or reconnects the points dissapear and the same thing with a server restart.

Here are the codes : 

server side : 

local tabPanel = {}
local buttons = {}
local labels = {}
local key = "F5"   -
local Tab = "::"    
local Tab1 = ".::" 
local Tab2 = "::."

local player = localPlayer

GUIEditor_Tab = {}
function shopInterface()
	shop_window = guiCreateWindow(260,80, 850, 640, "VP SHOP [ "..key.." ]", false)
	
    bg = guiCreateStaticImage(1,20,850,610,"Logo/logo.png", false,shop_window) 
    guiSetAlpha(bg,1)
    guiSetProperty(bg,"Disabled","true")
	
	guiSetVisible(shop_window, false)
    guiSetAlpha(shop_window, 0.73)
	guiWindowSetSizable(shop_window, false)

    exports.guicols:guiSetColor (shop_window, "green")
	tabPanel.myTabPanel = guiCreateTabPanel(35, 150, 780, 440, false, shop_window)


	tabPanel.Offers = guiCreateTab(""..Tab1.." First page  "..Tab.."", tabPanel.myTabPanel)
	guiCreateStaticImage(1,1,778,410,"Logo/Offers.png", false,tabPanel.Offers )
	
-------------------------------------------------------------[ Weapon ]-----------------------------------------------------------

    tabPanel.Weap = guiCreateTab(""..Tab.."    Weapons     "..Tab.."", tabPanel.myTabPanel)

	buttons.weapon_sniper = guiCreateButton(1, 106, 190, 30, "KVSK \n 75 VP", false, tabPanel.Weap)
	guiSetFont(buttons.weapon_sniper , "default-bold-small")
    guiCreateStaticImage(1,1,189,105,"Weap/sniper.png", false,tabPanel.Weap )
	
	buttons.weapon_m4  = guiCreateButton(198, 106, 190, 30, "M4A1 Holo \n 50 VP", false, tabPanel.Weap)
	guiSetFont(buttons.weapon_m4 , "default-bold-small")
	guiCreateStaticImage(198,1,189,105,"Weap/m4.png", false,tabPanel.Weap )

	buttons.weapon_ak = guiCreateButton(395, 106, 190, 30, "AKM GP-25 \n 50 VP", false,tabPanel.Weap) 
	guiSetFont(buttons.weapon_ak , "default-bold-small")
	 guiCreateStaticImage(395,1,189,105,"Weap/ak.png", false,tabPanel.Weap )

	buttons.weapon_lee = guiCreateButton(590, 106, 190, 30, "JNG-90 \n 35 VP", false, tabPanel.Weap)
	guiSetFont(buttons.weapon_lee , "default-bold-small")
    guiCreateStaticImage(590,1,189,105,"Weap/lee.png", false,tabPanel.Weap )

	buttons.weapon_spaz = guiCreateButton(1, 246, 190, 30, "SPAZ-12 Combat Shotgun \n 20 VP", false, tabPanel.Weap) 
	guiSetFont(buttons.weapon_spaz , "default-bold-small")
	guiCreateStaticImage(1,140,189,105,"Weap/spaz.png", false,tabPanel.Weap )
	
	buttons.weapon_sawn = guiCreateButton(200, 246, 190, 30, "Sawn-Off Shotgun \n 15 VP", false, tabPanel.Weap)
	guiSetFont(buttons.weapon_sawn , "default-bold-small")
	guiCreateStaticImage(200,140,189,105,"Weap/sawn.png", false,tabPanel.Weap )
	
	buttons.weapon_winchester = guiCreateButton(395, 246, 190, 30, "Benelli M3 \n 20 VP", false, tabPanel.Weap)
	guiSetFont(buttons.weapon_winchester , "default-bold-small")
	guiCreateStaticImage(395,140,189,105,"Weap/winchester.png", false,tabPanel.Weap )
	
	buttons.weapon_uzi = guiCreateButton(590, 246, 190, 30, "PDW \n 20 VP", false, tabPanel.Weap)
	guiSetFont(buttons.weapon_uzi , "default-bold-small")
	guiCreateStaticImage(590,140,189,105,"Weap/uzi.png", false,tabPanel.Weap )
	
	buttons.weapon_mp5 = guiCreateButton(1, 386, 190, 30, "MP5A5 \n 25 VP", false, tabPanel.Weap)
	guiSetFont(buttons.weapon_mp5 , "default-bold-small")
	guiCreateStaticImage(1,280,189,105,"Weap/mp5.png", false,tabPanel.Weap )
	
	buttons.weapon_desert = guiCreateButton(200, 386, 190, 30, "Desert Deagle \n 30 VP", false, tabPanel.Weap)
	guiSetFont(buttons.weapon_desert , "default-bold-small")
	guiCreateStaticImage(200,280,189,105,"Weap/desert.png", false,tabPanel.Weap )
	
	buttons.weapon_m1911 = guiCreateButton(395, 386, 190, 30, "G17 \n 10 VP", false, tabPanel.Weap)
	guiSetFont(buttons.weapon_m1911 , "default-bold-small")
	guiCreateStaticImage(395,280,189,105,"Weap/1911.png", false,tabPanel.Weap )
	
	buttons.weapon_m9 = guiCreateButton(590, 386, 190, 30, "M9 SD \n 10 VP", false, tabPanel.Weap)
	guiSetFont(buttons.weapon_m9 , "default-bold-small")
	guiCreateStaticImage(590,280,189,105,"Weap/m9.png", false,tabPanel.Weap )

------------------------------------------------------------------[ Ammo ]----------------------------------------------------------------

	tabPanel.Ammo = guiCreateTab(""..Tab.."    Ammo     "..Tab.."", tabPanel.myTabPanel)

	buttons.snipermag = guiCreateButton(1, 106, 190, 30,"KVSK / 30 Mag \n 20 VP", false, tabPanel.Ammo)
	guiSetFont(buttons.snipermag , "default-bold-small")
    guiCreateStaticImage(1,1,189,105,"Ammo/sniper.png", false,tabPanel.Ammo )

	buttons.m4mag  = guiCreateButton(198, 106, 190, 30, "M4A1 Holo / 120 Mag \n 15 VP", false, tabPanel.Ammo) 
	guiSetFont(buttons.m4mag , "default-bold-small")
	guiCreateStaticImage(198,1,189,105,"Ammo/m4.png", false,tabPanel.Ammo )

	buttons.akmag = guiCreateButton(395, 106, 190, 30, "AKM GP-25 / 120 Mag \n 15 VP", false,tabPanel.Ammo) 
	guiSetFont(buttons.akmag , "default-bold-small")
	 guiCreateStaticImage(395,1,189,105,"Ammo/ak.png", false,tabPanel.Ammo )

	buttons.leemag = guiCreateButton(590, 106, 190, 30, "JNG-90 / 30 Mag \n 10 VP", false, tabPanel.Ammo)
	guiSetFont(buttons.leemag , "default-bold-small")
    guiCreateStaticImage(590,1,189,105,"Ammo/lee.png", false,tabPanel.Ammo )

	buttons.spazmag = guiCreateButton(1, 246, 190, 30, "SPAZ-12 / 28 Mag \n 8 VP", false, tabPanel.Ammo)
	guiSetFont(buttons.spazmag , "default-bold-small")
	guiCreateStaticImage(1,140,189,105,"Ammo/12gauge.png", false,tabPanel.Ammo )
	
	buttons.sawnmag = guiCreateButton(200, 246, 190, 30, "Sawn-Off Shotgun / 30 Mag \n 6 VP", false, tabPanel.Ammo)
	guiSetFont(buttons.sawnmag , "default-bold-small")
	guiCreateStaticImage(200,140,189,105,"Ammo/sawn.png", false,tabPanel.Ammo )
	
	buttons.winchestermag = guiCreateButton(395, 246, 190, 30, "Benelli M3 / 30 Mag \n 8 VP", false, tabPanel.Ammo)
	guiSetFont(buttons.winchestermag , "default-bold-small")
	guiCreateStaticImage(395,140,189,105,"Ammo/12gauge.png", false,tabPanel.Ammo )
	
	buttons.uzimag = guiCreateButton(590, 246, 190, 30, "PDW / 200 Mag \n 5 VP", false, tabPanel.Ammo)
	guiSetFont(buttons.uzimag , "default-bold-small")
	guiCreateStaticImage(590,140,189,105,"Ammo/uzi.png", false,tabPanel.Ammo )
	
	buttons.mp5mag = guiCreateButton(1, 386, 190, 30, "MP5A5 / 120 Mag \n 5 VP", false, tabPanel.Ammo)
	guiSetFont(buttons.weapon_mp5mag , "default-bold-small")
	guiCreateStaticImage(1,280,189,105,"Ammo/mp5.png", false,tabPanel.Ammo )
	
	buttons.desertmag = guiCreateButton(200, 386, 190, 30, "Desert Deagle / 30 Mag \n 5 VP", false, tabPanel.Ammo)
	guiSetFont(buttons.weapon_desertmag , "default-bold-small")
	guiCreateStaticImage(200,280,189,105,"Ammo/desert.png", false,tabPanel.Ammo )
	
	buttons.m1911mag = guiCreateButton(395, 386, 190, 30, "G17 / 68 Mag \n 5 VP", false, tabPanel.Ammo)
	guiSetFont(buttons.weapon_m1911mag , "default-bold-small")
	guiCreateStaticImage(395,280,189,105,"Ammo/m1911.png", false,tabPanel.Ammo )
	
	buttons.m9mag = guiCreateButton(590, 386, 190, 30, "M9 SD / 68 Mag \n 5 VP", false, tabPanel.Ammo)
	guiSetFont(buttons.m9mag , "default-bold-small")
	guiCreateStaticImage(590,280,189,105,"Ammo/m9.png", false,tabPanel.Ammo )
	
--------------------------------------------------------------------[ Food ]---------------------------------------------------------------------
	
	tabPanel.Food = guiCreateTab(""..Tab.."     Food     "..Tab.."", tabPanel.myTabPanel)
	
	buttons.Pizza = guiCreateButton(1, 106, 190, 30, "Pizza / 5 pieces \n 25 VP ", false, tabPanel.Food)
	guiSetFont(buttons.Pizza , "default-bold-small")
    guiCreateStaticImage(1,1,189,105, "Food/pizza.png", false,tabPanel.Food )

	buttons.Milk  = guiCreateButton(198, 106, 190, 30, "Milk / 5 pieces \n 25 VP", false, tabPanel.Food)
	guiSetFont(buttons.Milk , "default-bold-small")
	guiCreateStaticImage(198,1,189,105, "Food/milk.png", false,tabPanel.Food )

	buttons.Cooked = guiCreateButton(395, 106, 190, 30, "Cooked Meat / 5 pieces \n 25 VP", false,tabPanel.Food)
	guiSetFont(buttons.Cooked , "default-bold-small")
	 guiCreateStaticImage(395,1,189,105,"Food/ham.png", false,tabPanel.Food )

	buttons.Soda = guiCreateButton(590, 106, 190, 30, "Soda Bottle / 5 pieces \n 25 VP", false, tabPanel.Food) 
	guiSetFont(buttons.Soda , "default-bold-small")
    guiCreateStaticImage(590,1,189,105,"Food/cola.png", false,tabPanel.Food )

	buttons.PastaCan = guiCreateButton(1, 246, 190, 30, "Pasta Can / 5 pieces \n 25 VP", false, tabPanel.Food)
	guiSetFont(buttons.PastaCan , "default-bold-small")
	guiCreateStaticImage(1,140,189,105,"Food/pasta.png", false,tabPanel.Food )

	buttons.WaterBottle  = guiCreateButton(200, 246, 190, 30, "Canteen / 5 pieces \n 25 VP", false, tabPanel.Food) 
	guiSetFont(buttons.WaterBottle , "default-bold-small")
	guiCreateStaticImage(200,140,189,105,"Food/water.png", false,tabPanel.Food )
	
	buttons.BeansCan  = guiCreateButton(395, 246, 190, 30, "Beans Can / 5 pieces \n 25 VP", false, tabPanel.Food) 
	guiSetFont(buttons.BeansCan , "default-bold-small")
	guiCreateStaticImage(395,140,189,105,"Food/beans.png", false,tabPanel.Food )
	
	buttons.food = guiCreateButton(1, 386, 190, 30, "Food / Full \n 10 VP", false, tabPanel.Food)
	guiSetFont(buttons.food , "default-bold-small")
	guiCreateStaticImage(1,280,189,105,"Food/food.png", false,tabPanel.Food )
	
	buttons.thirst = guiCreateButton(200, 386, 190, 30, "Thirst / Full \n 10 VP", false, tabPanel.Food)
	guiSetFont(buttons.thirst , "default-bold-small")
	guiCreateStaticImage(200,280,189,105,"Food/thirst.png", false,tabPanel.Food )

-----------------------------------------------------------[ Equipment ]------------------------------------------------------------------------

	tabPanel.Equipment = guiCreateTab(""..Tab.."     Equipment     "..Tab.."", tabPanel.myTabPanel)

	buttons.small  = guiCreateButton(1, 106, 190, 30, "Drybag Backpack / 40 slots \n 15 VP", false, tabPanel.Equipment)  --1
	guiCreateStaticImage(1,1,189,105,  "Equipment/small-Backpack.png", false,tabPanel.Equipment )
	guiSetFont(buttons.small , "default-bold-small")

	buttons.alice = guiCreateButton(198, 106, 190, 30, "Mountain Backpack / 70 slots \n 25 VP", false, tabPanel.Equipment)  --2
    guiCreateStaticImage(198,1,189,105, "Equipment/Alice-pack.png", false,tabPanel.Equipment )
	guiSetFont(buttons.alice , "default-bold-small")

	buttons.czech = guiCreateButton(395, 106, 190, 30, "Large Backpack / 90 sloys \n 40 VP", false, tabPanel.Equipment)  --3
	guiCreateStaticImage(395,1,189,105, "Equipment/Czech-Backpack.png", false,tabPanel.Equipment )
	guiSetFont(buttons.czech , "default-bold-small")

	buttons.coyote = guiCreateButton(590, 106, 190, 30, "Dark Backpack / 100 slots \n 45 VP", false, tabPanel.Equipment) --4
	guiCreateStaticImage(590,1,189,105, "Equipment/Coyote-Backpack.png", false,tabPanel.Equipment)
	guiSetFont(buttons.coyote , "default-bold-small")

	buttons.night = guiCreateButton(1, 246, 190, 30, "Night Vision Goggles \n 5 VP", false, tabPanel.Equipment) --5
	guiCreateStaticImage(1,140,189,105,"Equipment/nvg.png", false,tabPanel.Equipment )
	guiSetFont(buttons.night , "default-bold-small")
	
    buttons.infa = guiCreateButton(200, 246, 190, 30, "Infrared Goggles \n 10 VP", false, tabPanel.Equipment) --6
	guiCreateStaticImage(200,140,189,105, "Equipment/infa.png", false,tabPanel.Equipment )
	guiSetFont(buttons.infa , "default-bold-small")
	
	buttons.Binoculars  = guiCreateButton(395, 246, 190, 30, "Binoculars  \n 5 VP", false, tabPanel.Equipment)  --7
	guiSetFont(buttons.Binoculars , "default-bold-small")
	guiCreateStaticImage(395,140,189,105,"Equipment/binoculars.png", false,tabPanel.Equipment )
	
	buttons.tent = guiCreateButton(590, 246, 190, 30, "Tent  \n 15 VP", false, tabPanel.Equipment) --8
	guiSetFont(buttons.tent , "default-bold-small")
	guiCreateStaticImage(590,140,189,105,"Equipment/tent.png", false,tabPanel.Equipment )
	
	buttons.MAXSlots = guiCreateButton(1, 386, 190, 30, "MAX_Slots 175 \n 65 VP", false, tabPanel.Equipment) --9
	guiSetFont(buttons.MAXSlots , "default-bold-small")
	guiCreateStaticImage(1,280,189,105,"Equipment/MAXSlots.png", false,tabPanel.Equipment )
	
	buttons.Watch = guiCreateButton(200, 386, 190, 30, "Watch \n 1 VP", false, tabPanel.Equipment) --10 
	guiSetFont(buttons.Watch , "default-bold-small")
	guiCreateStaticImage(200,280,189,105,"Equipment/Watch.png", false,tabPanel.Equipment )
	
	buttons.gps = guiCreateButton(395, 386, 190, 30, "GPS \n 1 VP", false, tabPanel.Equipment) --11
	guiSetFont(buttons.gps , "default-bold-small")
	guiCreateStaticImage(395,280,189,105,"Equipment/gps.png", false,tabPanel.Equipment )
	
	buttons.map = guiCreateButton(590, 386, 190, 30, "Map \n 1 VP", false, tabPanel.Equipment) --12
	guiSetFont(buttons.map , "default-bold-small")
	guiCreateStaticImage(590,280,189,105,"Equipment/map.png", false,tabPanel.Equipment )
	
-----------------------------------------------------------------------[ Other ]--------------------------------------------------------------------------------------
	
    tabPanel.Other = guiCreateTab(""..Tab.."      Medical       "..Tab.."", tabPanel.myTabPanel)

    buttons.Bandage = guiCreateButton(1, 106, 190, 30, "Bandage +2 \n 5 VP", false, tabPanel.Other) --1
	guiCreateStaticImage(1,1,189,105,  "Other/bandage.png", false,tabPanel.Other )
    guiSetFont( buttons.Bandage, "default-bold-small")

	buttons.Painkiller= guiCreateButton(198, 106, 190, 30, "Painkiller +2 \n 5 VP", false, tabPanel.Other) --2
    guiCreateStaticImage(198,1,189,105, "Other/painkiller.png", false,tabPanel.Other )
    guiSetFont(buttons.Painkiller, "default-bold-small")

	buttons.MedicKit = guiCreateButton(395, 106, 190, 30, "Medic Supplies +2 \n 10 VP", false,tabPanel.Other) --3
	guiCreateStaticImage(395,1,189,105, "Other/medic-kit.png", false,tabPanel.Other )
    guiSetFont(buttons.MedicKit , "default-bold-small")
	
	buttons.Morphine = guiCreateButton(590, 106, 190, 30, "Morphine +2 \n 5 VP", false, tabPanel.Other) --4
	guiCreateStaticImage(590,1,189,105, "Other/morphine.png", false,tabPanel.Other )
    guiSetFont( buttons.Morphine, "default-bold-small")

	buttons.BloodBag = guiCreateButton(1, 246, 190, 30, "Blood Bag +2 \n 5 VP", false, tabPanel.Other) --5
	guiCreateStaticImage(1,140,189,105,"Other/BloodBag.png", false,tabPanel.Other )
    guiSetFont(buttons.BloodBag, "default-bold-small")
	
	buttons.blood = guiCreateButton(200, 246, 190, 30, "Blood + 1000 \n 10 VP", false, tabPanel.Other) --6
	guiSetFont(buttons.blood , "default-bold-small")
	guiCreateStaticImage(200,140,189,105, "Other/blood.png", false,tabPanel.Other )
	
	buttons.blood2 = guiCreateButton(395, 246, 190, 30, "Blood + 2500  \n 20 VP", false, tabPanel.Other)  --7
	guiSetFont(buttons.blood2 , "default-bold-small")
	guiCreateStaticImage(395,140,189,105,"Other/blood2.png", false,tabPanel.Other )
	
	buttons.blood3 = guiCreateButton(590, 246, 190, 30, "Blood + 4000  \n 30 VP", false, tabPanel.Other) --8
	guiSetFont(buttons.blood3 , "default-bold-small")
	guiCreateStaticImage(590,140,189,105,"Other/blood3.png", false,tabPanel.Other )
	
---------------------------------------------------------------[ Skins ]------------------------------------------------------------------------------------------------
   
    tabPanel.Skins = guiCreateTab(""..Tab.."     Skins     "..Tab2.."", tabPanel.myTabPanel)

    buttons.Ghillie = guiCreateButton(1, 106, 190, 30, "Ghillie Suit Ghost \n 10 VP", false, tabPanel.Skins)
	guiCreateStaticImage(1,1,189,105, "Skins/ghillie.png", false,tabPanel.Skins )
    guiSetFont(buttons.Ghillie, "default-bold-small")

    buttons.Camouflage = guiCreateButton(198, 106, 190, 30, "Ghillie Suit 1 \n 5 VP", false, tabPanel.Skins)
	guiCreateStaticImage(198,1,189,105, "Skins/ghillie.png", false,tabPanel.Skins )
    guiSetFont(buttons.Camouflage, "default-bold-small")
	
    buttons.Civilian = guiCreateButton(395, 106, 190, 30, "Ghillie Suit 2 \n 5 VP", false, tabPanel.Skins)
	guiCreateStaticImage(395,1,189,105, "Skins/ghillie.png", false,tabPanel.Skins )
    guiSetFont(buttons.Civilian, "default-bold-small")

    buttons.Civilian2 = guiCreateButton(590, 106, 190, 30, "Ghillie Suit 3 \n 5 VP", false, tabPanel.Skins)
	guiCreateStaticImage(590,1,189,105, "Skins/ghillie.png", false,tabPanel.Skins )
    guiSetFont(buttons.Civilian, "default-bold-small")

-------------------------------------------------------[ Close ]------------------------------------------------------------------------
	
	buttons.Sair = guiCreateButton(35, 600, 780, 30, "Close", false, shop_window)
	guiSetFont(buttons.Sair , "default-bold-small")
	
-----------------------------------------------[ Button Color ]----------------------------------------------------------------

	for _, button in pairs(buttons) do guiSetProperty(button, "HoverTextColour", "FFFF0000") end

end
addEventHandler("onClientResourceStart", resourceRoot, shopInterface)


-----------------------------------------------[ Weapon ]-----------------------------------------------------


addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_sniper) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_sniper")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_m4) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_m4")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_ak) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_ak")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_lee) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_lee")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_spaz) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_spaz")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_sawn) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_sawn")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_winchester) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_winchester")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_uzi) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_uzi")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_mp5) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_mp5")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_desert) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_desert")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_m1911) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_m1911")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.weapon_m9) then
                    triggerServerEvent("onClientBuyWeapon", localPlayer, "weapon_m9")
                end

           end
)

----------------------------------------------------------[ Ammo ]-----------------------------------------------------------

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),  
        function ( )
           if (source == buttons.snipermag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "snipermag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.m4mag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "m4mag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),  
        function ( )
           if (source == buttons.akmag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "akmag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),  
        function ( )
           if (source == buttons.leemag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "leemag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),  
        function ( )
           if (source == buttons.spazmag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "spazmag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),  
        function ( )
           if (source == buttons.sawnmag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "sawnmag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),  
        function ( )
           if (source == buttons.winchestermag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "winchestermag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),  
        function ( )
           if (source == buttons.uzimag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "uzimag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),  
        function ( )
           if (source == buttons.mp5mag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "mp5mag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),  
        function ( )
           if (source == buttons.desertmag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "desertmag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),  
        function ( )
           if (source == buttons.m1911mag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "m1911mag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),  
        function ( )
           if (source == buttons.m9mag) then
                    triggerServerEvent("onClientBuyAmmo", localPlayer, "m9mag")
                end

           end
)

----------------------------------------------------------------[ Food ] ---------------------------------------------------------------


addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Pizza) then
                    triggerServerEvent("onClientBuyComida", localPlayer, "Comida_Pizza")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Milk) then
                    triggerServerEvent("onClientBuyComida", localPlayer, "Comida_Milk")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Cooked) then
                    triggerServerEvent("onClientBuyComida", localPlayer, "Comida_Cooked")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Soda) then
                    triggerServerEvent("onClientBuyComida", localPlayer, "Comida_Soda")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.PastaCan) then
                    triggerServerEvent("onClientBuyComida", localPlayer, "Comida_PastaCan")
                end

           end
)
addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.WaterBottle) then
                    triggerServerEvent("onClientBuyComida", localPlayer, "Comida_WaterBottle")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.BeansCan) then
                    triggerServerEvent("onClientBuyComida", localPlayer, "Comida_BeansCan")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.food) then
                    triggerServerEvent("onClientBuyComida", localPlayer, "Comida_food")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.thirst) then
                    triggerServerEvent("onClientBuyComida", localPlayer, "Comida_thirst")
                end

           end
)

---------------------------------------------------------------[ Equipment ]-----------------------------------------------------------------


addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.small) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arms_small")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.alice) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arms_alice")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.czech) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arms_czech")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.coyote) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arm_coyote")
                end

           end
)
addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.night) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arms_night")
                end

           end
)
addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.infa) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arms_infa")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Binoculars) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arms_Binoculars")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.tent) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arms_tent")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.MAXSlots) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arms_MAXSlots")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Watch) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arms_Watch")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.gps) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arms_gps")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.map) then
                    triggerServerEvent("onClientBuyArm", localPlayer, "Arms_map")
                end

           end
)

-------------------------------------------------------[ Skins ] -----------------------------------------------------------


addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Ghillie) then
                    triggerServerEvent("onClientBuySkin", localPlayer, "Skin_Ghillie")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Camouflage) then
                    triggerServerEvent("onClientBuySkin", localPlayer, "Skin_Camouflage")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Civilian) then
                    triggerServerEvent("onClientBuySkin", localPlayer, "Skin_Civilian")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Civilian2) then
                    triggerServerEvent("onClientBuySkin", localPlayer, "Skin_Civilian2")
                end

           end
)

----------------------------------------------------[[ Other ]]------------------------------------------------------------------


addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Bandage) then
                    triggerServerEvent("onClientBuyMedico", localPlayer, "Medico_Bandage")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Painkiller) then
                    triggerServerEvent("onClientBuyMedico", localPlayer, "Medico_PainKiller")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.MedicKit) then
                    triggerServerEvent("onClientBuyMedico", localPlayer, "Medico_MedicKit")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Morphine) then
                    triggerServerEvent("onClientBuyMedico", localPlayer, "Medico_Morphine")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.BloodBag) then
                    triggerServerEvent("onClientBuyMedico", localPlayer, "Medico_BloodBag")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.blood) then
                    triggerServerEvent("onClientBuyMedico", localPlayer, "Medico_blood")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.blood2) then
                    triggerServerEvent("onClientBuyMedico", localPlayer, "Medico_blood2")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.blood3) then
                    triggerServerEvent("onClientBuyMedico", localPlayer, "Medico_blood3")
                end

           end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == buttons.Sair) then
                 guiSetVisible(shop_window,false)
	             showCursor(false)
                end

           end
)

function ShowGUI ( )
    guiSetVisible ( shop_window, not guiGetVisible ( shop_window ) )
    showCursor ( not isCursorShowing( ) )
end
bindKey ( key,"down", ShowGUI )

client side : 

function BuyWeaponOnServer(weapon_name,data,value)
	player_money  = getPlayerMoney(source)
		if(weapon_name == "weapon_sniper") then
			if ( player_money >= 75) then
                setElementData(source,"KVSK",getElementData(source,"KVSK") + 1)                                                                                                      -- 1
				takePlayerMoney(source, 75)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a KVSK !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
	end
		if(weapon_name == "weapon_m4") then
			  if ( player_money >= 50) then
                setElementData(source,"M4A1 Holo",getElementData(source,"M4A1 Holo") + 1)                                                                                                                   -- 2
				takePlayerMoney(source, 50)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a M4A1 Holo !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end			
		if(weapon_name == "weapon_ak") then
			  if ( player_money >= 50) then
                setElementData(source,"AKM GP-25",getElementData(source,"AKM GP-25") + 1)                                                                                                             -- 3
				takePlayerMoney(source, 50)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought an AKM GP-25 !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end			
			if(weapon_name == "weapon_lee") then
			  if ( player_money >= 35) then
				setElementData(source, "JNG-90",getElementData(source,"JNG-90") + 1)                                                                                                 -- 4
				takePlayerMoney(source, 35)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a JNG-90 !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(weapon_name == "weapon_spaz") then
			  if ( player_money >= 20) then
				setElementData(source, "SPAZ-12",getElementData(source,"SPAZ-12") + 1)                                                       -- 5                                                 
				takePlayerMoney(source, 20)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a SPAZ-12 !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(weapon_name == "weapon_sawn") then
			  if ( player_money >= 15) then
				setElementData(source, "Sawn-Off Shotgun",getElementData(source,"Sawn-Off Shotgun") + 1)                                                                                -- 6                                                  
				takePlayerMoney(source, 15)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a Sawn-Off Shotgun !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(weapon_name == "weapon_winchester") then
			  if ( player_money >= 20) then
				setElementData(source, "Benelli M3",getElementData(source,"Benelli M3") + 1)                                                                                  -- 7                                                 
				takePlayerMoney(source, 20)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a Benelli M3 !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
				if(weapon_name == "weapon_uzi") then
			  if ( player_money >= 20) then
				setElementData(source, "PDW",getElementData(source,"PDW") + 1)                                                                                                            -- 8                                 
				takePlayerMoney(source, 20)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a PDW !", source, 255, 255, 255 , true) 
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(weapon_name == "weapon_mp5") then
			  if ( player_money >= 25) then
                setElementData(source,"MP5A5",getElementData(source,"MP5A5") + 1)                                                                                                          -- 9                                                    
				takePlayerMoney(source, 25)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a MP5A5 !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
				if(weapon_name == "weapon_desert") then
			  if ( player_money >= 30) then
                setElementData(source,"Desert Deagle",getElementData(source,"Desert Deagle") + 1)                                                                                           -- 10                                          
				takePlayerMoney(source, 30)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a Desert Deagle !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(weapon_name == "weapon_m1911") then
			  if ( player_money >= 10) then
                setElementData(source,"G17",getElementData(source,"G17") + 1)                                                                                                          -- 11                                                       
				takePlayerMoney(source, 10)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a G17 !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(weapon_name == "weapon_m9") then
			  if ( player_money >= 10) then
                setElementData(source,"M9 SD",getElementData(source,"M9 SD") + 1)                                                                                                      -- 12                                  
				takePlayerMoney(source, 10)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a M9 SD !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
end

addEvent("onClientBuyWeapon", true)
addEventHandler("onClientBuyWeapon", getRootElement(), BuyWeaponOnServer)

-------------------------------------------------------[ Ammo ] ------------------------------------------------------------

function BuyWeaponOnServer(Ammo_name,data,value)
	player_money  = getPlayerMoney(source)
			if(Ammo_name == "snipermag") then
			  if ( player_money >= 20) then
                setElementData(source,"KVSK Mag",getElementData(source,"KVSK Mag") + 30)
				takePlayerMoney(source, 20)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 30 KVSK Mag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Ammo_name == "m4mag") then
			  if ( player_money >= 15) then
                setElementData(source,"M4A1 Holo Mag",getElementData(source,"M4A1 Holo Mag") + 120)
				takePlayerMoney(source, 15)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 120 M4A1 Holo Mag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end	
			if(Ammo_name == "akmag") then
			  if ( player_money >= 15) then
                setElementData(source,"AKM GP-25 Mag",getElementData(source,"AKM GP-25 Mag") + 120)
				takePlayerMoney(source, 15)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 120 AKM GP-25 Mag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end	
				if(Ammo_name == "leemag") then
			  if ( player_money >= 10) then
				setElementData(source, "JNG-90 Mag",getElementData(source,"JNG-90 Mag") + 30)
				takePlayerMoney(source, 10)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 30 JNG-90 Mag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
     end
	 		if(Ammo_name == "spazmag") then
			  if ( player_money >= 8) then
				setElementData(source, "SPAZ-12 Mag",getElementData(source,"SPAZ-12 Mag") + 28)                                                                                           
				takePlayerMoney(source, 8)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 28 SPAZ-12 Mag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
				if(Ammo_name == "sawnmag") then
			  if ( player_money >= 6) then
				setElementData(source, "2Rnd. Slug",getElementData(source,"2Rnd. Slug") + 30)                                                                                                                          
				takePlayerMoney(source, 6)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 30 Sawn-Off Shotgun Mag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Ammo_name == "winchestermag") then
			  if ( player_money >= 500) then
				setElementData(source, "Benelli M3 Mag",getElementData(source,"Benelli M3 Mag") + 30)                                                                                  -- 7                                                 
				takePlayerMoney(source, 500)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 30 Benelli M3 Mag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Ammo_name == "uzimag") then
			  if ( player_money >= 5) then
				setElementData(source, "PDW Mag",getElementData(source,"PDW Mag") + 200)                                                                                                            -- 8                                 
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 200 PDW Mag !", source, 255, 255, 255 , true) 
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Ammo_name == "mp5mag") then
			  if ( player_money >= 5) then
                setElementData(source,"MP5A5 Mag",getElementData(source,"MP5A5 Mag") + 120)                                                                                                          -- 9                                                    
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 120 MP5A5 Mag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Ammo_name == "desertmag") then
			  if ( player_money >= 5) then
                setElementData(source,"Desert Deagle Mag",getElementData(source,"Desert Deagle Mag") + 30)                                                                                           -- 10                                          
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 30 Desert Deagle Mag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Ammo_name == "m1911mag") then
			  if ( player_money >= 5) then
                setElementData(source,"G17 Mag",getElementData(source,"G17 Mag") + 68)                                                                                                          -- 11                                                       
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 68 G17 Mag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Ammo_name == "m9mag") then
			  if ( player_money >= 5) then
                setElementData(source,"M9 SD Mag",getElementData(source,"M9 SD Mag") + 68)                                                                                                      -- 12                                  
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 68 M9 SD Mag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
end
addEvent("onClientBuyAmmo", true)
addEventHandler("onClientBuyAmmo", getRootElement(), BuyWeaponOnServer)

--------------------------------------------------------------------------------[ Food ] ------------------------------------------------------------------------------


function BuyWeaponOnServer(food_name,data,value)
	player_money      = getPlayerMoney(source)

		if(food_name == "Comida_Pizza") then
			if ( player_money >= 25) then
				setElementData(source, "Pizza",getElementData(source,"Pizza") + 5)
				takePlayerMoney(source, 25)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 5 Pizza !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
		end
end
		if(food_name == "Comida_Milk") then
			  if ( player_money >= 25) then
				setElementData(source, "Milk",getElementData(source,"Milk") + 5)
				takePlayerMoney(source, 25)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 5 Milk !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(food_name == "Comida_Cooked") then
			  if ( player_money >= 25) then
				setElementData(source, "Cooked Meat",getElementData(source,"Cooked Meat") + 5)
				takePlayerMoney(source, 25)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 5 Cooked Meat !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(food_name == "Comida_Soda") then
			  if ( player_money >= 25) then
			    setElementData(source, "Soda Bottle",getElementData(source,"Soda Bottle") + 5)
				takePlayerMoney(source, 25)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 5 Soda Bottle !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(food_name == "Comida_PastaCan") then
			  if ( player_money >= 25) then
				setElementData(source, "Pasta Can",getElementData(source,"Pasta Can") + 5)
				takePlayerMoney(source, 25)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 5 Pasta Can !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(food_name == "Comida_WaterBottle") then
			  if ( player_money >= 25) then
				setElementData(source, "Canteen",getElementData(source,"Canteen") + 5)
				takePlayerMoney(source, 25)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 5 Canteen !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(food_name == "Comida_BeansCan") then
			  if ( player_money >= 25) then
				setElementData(source, "Beans Can",getElementData(source,"Beans Can") + 5)
				takePlayerMoney(source, 25)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 5 Beans Can !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(food_name == "Comida_food") then
			  if ( player_money >= 10) then
			    setElementData(source, "food",100 )
				takePlayerMoney(source, 10)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully refilled your hunger !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(food_name == "Comida_thirst") then
			  if ( player_money >= 10) then
			    setElementData(source, "thirst",100 )
				takePlayerMoney(source, 10)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully refilled your thirst !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
end

addEvent("onClientBuyComida", true)
addEventHandler("onClientBuyComida", getRootElement(), BuyWeaponOnServer)


---------------------------------------------------------------[ Pouch ]-----------------------------------------------------------------


function BuyWeaponOnServer(Arm_name,data,value)
	player_money      = getPlayerMoney(source)	
	
	        if(Arm_name == "Arms_small") then
			  if ( player_money >= 15) then
				setElementData(source, "Drybag Backpack (Black)",1 )
				takePlayerMoney(source, 15)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a Drybag Backpack (Black) !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
		    if(Arm_name == "Arms_alice") then
			  if ( player_money >= 25) then
			    setElementData(source, "Mountain Backpack (Blue)",1 )
				takePlayerMoney(source, 25)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a Mountain Backpack (Blue)! ", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points!", source, 255, 255, 255 , true)
			end
    end
			if(Arm_name == "Arms_czech") then
			  if ( player_money >= 40) then
			  	setElementData(source, "Large Backpack",1 )
				takePlayerMoney(source, 40)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a Large Backpack !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Arm_name == "Arm_coyote") then
			  if ( player_money >= 45) then
			    setElementData(source, "Black Backpack",1 )
				takePlayerMoney(source, 45)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a Black Backpack !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Arm_name == "Arms_night") then
			  if ( player_money >= 5) then
			    setElementData(source, "Night vision goggles",getElementData(source,"Night vision goggles") + 1)
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought Night Vision Googles !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Arm_name == "Arms_infa") then
			  if ( player_money >= 10) then
			    setElementData(source, "Infrared glasses",getElementData(source,"Infrared glasses") + 1)
				takePlayerMoney(source, 10)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought Infrared glasses !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Arm_name == "Arms_Binoculars") then
			  if ( player_money >= 5) then
			    setElementData(source, "Binoculars",getElementData(source,"Binoculars") + 1 )
				takePlayerMoney(source, 5 )
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought Binoculars !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Arm_name == "Arms_tent") then
			  if ( player_money >= 15) then
			    setElementData(source, "Tent",getElementData(source,"Tent") + 1 )
				takePlayerMoney(source, 15 )
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a Tent !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Arm_name == "Arms_MAXSlots") then
			  if ( player_money >= 65) then
			    setElementData(source, "MAX_Slots",getElementData(source,"MAX_Slots") + 175 )   -- setElementData(source, "MAX_Slots",100 )  -- = ไม่สามารถชื้อช้ำได้
				takePlayerMoney(source, 65 )
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully added 175 slots tp your inventory !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Arm_name == "Arms_Watch") then
			  if ( player_money >= 1) then
			    setElementData(source, "Watch",getElementData(source,"Watch") + 1 )
				takePlayerMoney(source, 1 )
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a Watch !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Arm_name == "Arms_gps") then
			  if ( player_money >= 1) then
			    setElementData(source, "GPS",getElementData(source,"GPS") + 1 )
				takePlayerMoney(source, 1 )
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a GPS !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(Arm_name == "Arms_map") then
			  if ( player_money >= 1) then
			    setElementData(source, "Map",getElementData(source,"Map") + 1 )
				takePlayerMoney(source, 1 )
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought a GPS !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
end

addEvent("onClientBuyArm", true)
addEventHandler("onClientBuyArm", getRootElement(), BuyWeaponOnServer)

----------------------------------------------------------------------------------------------[ Other ]---------------------------------------------------------------------------------------------

function BuyWeaponOnServer(medico_name,data,value)
	player_money = getPlayerMoney(source)
	if(medico_name == "Medico_Bandage") then
			  if ( player_money >= 5) then
				setElementData(source, "Bandage",getElementData(source,"Bandage") + 2)
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 2 Bandages !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
end
			if(medico_name == "Medico_PainKiller") then
			  if ( player_money >= 5) then
				setElementData(source, "Painkiller",getElementData(source,"Painkiller") + 2)
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 2 Painkillers !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
end
		if(medico_name == "Medico_MedicKit") then
			if ( player_money >= 10) then
				setElementData(source, "Medical Supplies",getElementData(source,"Medical Supplies") + 2)
				takePlayerMoney(source, 10)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 2 Medical Supplies !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
end
			if(medico_name == "Medico_Morphine") then
			  if (player_money >= 5) then
				setElementData(source, "Morphine",getElementData(source,"Morphine") + 2)
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 2 Morhine !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(medico_name == "Medico_BloodBag") then
			  if (player_money >= 5) then
				setElementData(source, "Blood Bag",getElementData(source,"Blood Bag") + 2)
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 2 Blood Bag !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(medico_name == "Medico_blood") then
			  if (player_money >= 10) then
				setElementData(source, "blood",getElementData(source,"blood") + 1000)
			--	setElementData(source, "blood",getElementData(source,"blood") + 120)
				takePlayerMoney(source, 10)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully added 1000 blood to your health !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(medico_name == "Medico_blood2") then
			  if (player_money >= 20) then
				setElementData(source, "blood",getElementData(source,"blood") + 2500)
			--	setElementData(source, "blood",getElementData(source,"blood") + 150)
				takePlayerMoney(source, 20)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully added 2500 blood to your health !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
			if(medico_name == "Medico_blood3") then
			  if (player_money >= 30) then
				setElementData(source, "blood",getElementData(source,"blood") + 4000)
			--	setElementData(source, "blood",getElementData(source,"blood") + 200)
				takePlayerMoney(source, 30)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully added 4000 blood to your health !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
    end
end
addEvent("onClientBuyMedico", true)
addEventHandler("onClientBuyMedico", getRootElement(), BuyWeaponOnServer)

-------------------------------------------------------[ Skins ] -----------------------------------------------------------

function BuyWeaponOnServer(skins_name,data,value)
	player_money = getPlayerMoney(source)

		if(skins_name == "Skin_Ghillie") then
			if ( player_money >= 10) then
			    setElementData(source, "Ghillie Suit Ghost",getElementData(source,"Ghillie Suit Ghost") + 1)
				takePlayerMoney(source, 10)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 1 Ghillie Suit Ghost !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
	end
			if(skins_name == "Skin_Camouflage") then
			  if ( player_money >= 5) then
				setElementData(source, "Ghillie Suit 1",getElementData(source,"Ghillie Suit 1") + 1)
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 1 Ghillie Suit 1 !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)
			end
	end
			if(skins_name == "Skin_Civilian") then
			  if ( player_money >= 5) then
				setElementData(source, "Ghillie Suit 2",getElementData(source,"Ghillie Suit 2") + 1)
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 1 Ghillie Suit 2 !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)  --
			end
	end
			if(skins_name == "Skin_Civilian2") then
			  if ( player_money >= 5) then
				setElementData(source, "Ghillie Suit 3",getElementData(source,"Ghillie Suit 3") + 1)
				takePlayerMoney(source, 5)
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You succesfully bought 1 Ghillie Suit 3 !", source, 255, 255, 255 , true)
			else
				outputChatBox("#6495ED[DayzLife Romania Shop] #C0C0C0You dont have enough VIP Points !", source, 255, 255, 255 , true)  --
			end
    end
end
addEvent("onClientBuySkin", true)
addEventHandler("onClientBuySkin", getRootElement(), BuyWeaponOnServer)

Thanks in advance. Have a nice day ^^

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...