Jump to content

[SOLVED]Trying to make a "marker" shop.


HeK

Recommended Posts

Hello guys, im trying to make a marker where you hit it, it will open a shop script, i also have a createPed there.

In the end of the "Client Side" i have the function to show the GUI and in the Server side i have the marker to open it, but it isn't working.

Client:

tabPanel = {} 
buttons = {}
labels = {}
images = {}
 
function main()
    shop_window = guiCreateWindow(340, 115, 405, 538, "Weapon Shop", false) -- Create window
    guiWindowSetSizable(shop_window, false)
 
    labels.Weapons = guiCreateLabel(7, 52, 53, 16, "Weapons", false, shop_window)
    guiLabelSetColor(labels.Weapons, 255, 0, 0)
    guiSetFont(labels.Weapons, "default-bold-small")
 
    tabPanel.myTabPanel = guiCreateTabPanel(60, 26, 353, 504, false, shop_window) -- Create TabPanel in the window
 
addEventHandler("onClientGUIClick", root, buy)
 
-- Tab 2 Buy weapons
    tabPanel.Tab_Loja = guiCreateTab("Buy Weapons", tabPanel.myTabPanel)
 
    images.Pistol = guiCreateStaticImage(0, 0, 101, 108, "weapons/22.png", false, tabPanel.Tab_Loja)
    buttons.buy_Pistol = guiCreateButton(6, 98, 103, 25, "Buy Pistol", false, tabPanel.Tab_Loja)
    labels.buy_Pistol = guiCreateLabel(23, 81, 81, 16, "$8.000", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_Pistol, "center", false)
    guiSetProperty( buttons.buy_Pistol, "HoverTextColour", "FFFFFF00" )
 
    images.SilencedPistol = guiCreateStaticImage(125, 0, 79, 112, "weapons/23.png", false, tabPanel.Tab_Loja)
    buttons.buy_SilencedPistol = guiCreateButton(113, 99, 108, 29, "Buy Silenced pistol", false, tabPanel.Tab_Loja)
    labels.buy_SilencedPistol = guiCreateLabel(127, 81, 81, 16, "$8.300", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_SilencedPistol, "center", false)
    guiSetProperty( buttons.buy_SilencedPistol, "HoverTextColour", "FFFFFF00" )
 
    buttons.buy_DesertEagle = guiCreateButton(224, 99, 103, 28, "Buy Desert eagle", false, tabPanel.Tab_Loja)
    images.DesertEagle = guiCreateStaticImage(229, 0, 87, 105, "weapons/24.png", false, tabPanel.Tab_Loja)
    labels.buy_DesertEagle = guiCreateLabel(226, 82, 91, 14, "$9.200", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_DesertEagle, "center", false)
    guiSetProperty( buttons.buy_DesertEagle, "HoverTextColour", "FFFFFF00" )
 
    images.Shotgun = guiCreateStaticImage(12, 115, 96, 115, "weapons/25.png", false, tabPanel.Tab_Loja)
    buttons.buy_Shotgun = guiCreateButton(6, 221, 103, 25, "Buy Shotgun", false, tabPanel.Tab_Loja)
    labels.buy_Shotgun = guiCreateLabel(8, 204, 99, 14, "$9.100", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_Shotgun, "center", false)
    guiSetProperty( buttons.buy_Shotgun, "HoverTextColour", "FFFFFF00" )
 
    images.SawnOff = guiCreateStaticImage(116, 129, 101, 98, "weapons/26.png", false, tabPanel.Tab_Loja)
    buttons.buy_SawnOff = guiCreateButton(114, 221, 103, 30, "Buy Sawn-off Shotgun", false, tabPanel.Tab_Loja)
    labels.buy_SawnOff = guiCreateLabel(115, 204, 99, 14, "$9.800", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_SawnOff, "center", false)
    guiSetProperty( buttons.buy_SawnOff, "HoverTextColour", "FFFFFF00" )
 
    labels.buy_SPAZ12 = guiCreateLabel(224, 204, 99, 14, "$9.550", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_SPAZ12, "center", false)
    images.SPAZ12 = guiCreateStaticImage(224, 124, 98, 107, "weapons/27.png", false, tabPanel.Tab_Loja)
    buttons.buy_SPAZ12 = guiCreateButton(222, 221, 103, 27, "Buy SPAZ-12", false, tabPanel.Tab_Loja)
    guiSetProperty( buttons.buy_SPAZ12, "HoverTextColour", "FFFFFF00" )
 
    buttons.buy_Uzi = guiCreateButton(6, 337, 103, 26, "Buy Micro Uzi", false, tabPanel.Tab_Loja)
    images.Uzi = guiCreateStaticImage(14, 256, 74, 75, "weapons/28.png", false, tabPanel.Tab_Loja)
    labels.buy_Uzi = guiCreateLabel(8, 320, 99, 14, "$9.400", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_Uzi, "center", false)
    guiSetProperty( buttons.buy_Uzi, "HoverTextColour", "FFFFFF00" )
 
    images.MP5 = guiCreateStaticImage(122, 256, 82, 69, "weapons/29.png", false, tabPanel.Tab_Loja)
    buttons.buy_MP5 = guiCreateButton(114, 337, 103, 26, "Buy MP5", false, tabPanel.Tab_Loja)
    labels.buy_MP5 = guiCreateLabel(115, 320, 99, 14, "$8.900", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_MP5, "center", false)
    guiSetProperty( buttons.buy_MP5, "HoverTextColour", "FFFFFF00" )
 
    images.TEC9 = guiCreateStaticImage(236, 266, 74, 63, "weapons/32.png", false, tabPanel.Tab_Loja)
    buttons.buy_TEC9 = guiCreateButton(222, 337, 103, 26, "Buy TEC-9", false, tabPanel.Tab_Loja)
    labels.buy_TEC9 = guiCreateLabel(224, 320, 99, 14, "$9.250", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_TEC9, "center", false)
    guiSetProperty( buttons.buy_TEC9, "HoverTextColour", "FFFFFF00" )
 
    images.AK47 = guiCreateStaticImage(8, 360, 91, 86, "weapons/30.png", false, tabPanel.Tab_Loja)
    buttons.buy_AK47 = guiCreateButton(6, 447, 103, 28, "Buy AK-47", false, tabPanel.Tab_Loja)
    labels.buy_AK47 = guiCreateLabel(8, 431, 99, 14, "$9.900", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_AK47, "center", false)
    guiSetProperty( buttons.buy_AK47, "HoverTextColour", "FFFFFF00" )
 
    labels.buy_M4 = guiCreateLabel(117, 430, 99, 14, "$10.000", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_M4, "center", false)
    buttons.buy_M4 = guiCreateButton(117, 447, 98, 27, "Buy M4", false, tabPanel.Tab_Loja)
    images.M4 = guiCreateStaticImage(117, 361, 95, 85, "weapons/31.png", false, tabPanel.Tab_Loja)
    guiSetProperty( buttons.buy_M4, "HoverTextColour", "FFFFFF00" )
 
    images.Sniper = guiCreateStaticImage(214, 381, 112, 68, "weapons/icon.png", false, tabPanel.Tab_Loja)
    buttons.buy_Sniper = guiCreateButton(222, 447, 103, 26, "Buy Sniper", false, tabPanel.Tab_Loja)
    labels.buy_Sniper = guiCreateLabel(224, 431, 99, 14, "$9.500", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_Sniper, "center", false)
    guiSetProperty( buttons.buy_Sniper, "HoverTextColour", "FFFFFF00" )
 
function buyWeapon()
        if (source == buttons.buy_Pistol) then  -- Buy > Pistol
            player = localPlayer
            local priceWeapon_Pistol = 8000
            money = getPlayerMoney(source)
 
            if (money >= priceWeapon_Pistol) then
            outputChatBox ("You bought a #FF0000Pistol #FFFFFFfor #00ff00$#FF0000"..priceWeapon_Pistol.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_Pistol)
            triggerServerEvent("givePistol", player, givePistol)
            else
            outputChatBox("You dont have enough money to buy Pistol.", 255, 0, 0)
            end
        elseif (source == buttons.buy_SilencedPistol) then  -- Buy > Silenced pistol
            player = localPlayer
            local priceWeapon_SilencedPistol = 8300
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_SilencedPistol) then
            outputChatBox ("You bought a #FF0000Silenced pistol #FFFFFFfor #00ff00$#FF0000"..priceWeapon_SilencedPistol.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_SilencedPistol)
            triggerServerEvent("giveSilencedPistol", player, giveSilencedPistol)
            else
            outputChatBox("You dont have enough money to buy Silenced pistol.", 255, 0, 0)
            end
        elseif (source == buttons.buy_DesertEagle) then  -- Buy > Desert eagle
            player = localPlayer
            local priceWeapon_DesertEagle = 9200
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_DesertEagle) then
            outputChatBox ("You bought a #FF0000Desert eagle #FFFFFFfor #00ff00$#FF0000"..priceWeapon_DesertEagle.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_DesertEagle)
            triggerServerEvent("giveDesertEagle", player, giveDesertEagle)
            else
            outputChatBox("You dont have enough money to buy Desert eagle.", 255, 0, 0)
            end
        elseif (source == buttons.buy_Shotgun) then  -- Buy > Shotgun
            player = localPlayer
            local priceWeapon_Shotgun = 9100
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_Shotgun) then
            outputChatBox ("You bought a #FF0000Shotgun #FFFFFFfor #00ff00$#FF0000"..priceWeapon_Shotgun.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_Shotgun)
            triggerServerEvent("giveShotgun", player, giveShotgun)
            else
            outputChatBox("You dont have enough money to buy Shotgun.", 255, 0, 0)
            end
        elseif (source == buttons.buy_SawnOff) then  -- Buy > Sawn-off Shotgun
            player = localPlayer
            local priceWeapon_SawnOff = 9800
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_SawnOff) then
            outputChatBox ("You bought a #FF0000Sawn-off shotgun #FFFFFFfor #00ff00$#FF0000"..priceWeapon_SawnOff.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_SawnOff)
            triggerServerEvent("giveSawnOff", player, giveSawnOff)
            else
            outputChatBox("You dont have enough money to buy Sawn-off shotgun.", 255, 0, 0)
            end
        elseif (source ==  buttons.buy_SPAZ12) then  -- Buy > SPAZ-12
            player = localPlayer
            local priceWeapon_SPAZ12 = 9550
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_SPAZ12) then
            outputChatBox ("You bought a #FF0000SPAZ-12 #FFFFFFfor #00ff00$#FF0000"..priceWeapon_SPAZ12.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_SPAZ12)
            triggerServerEvent("giveSPAZ12", player, giveSPAZ12)
            else
            outputChatBox("You dont have enough money to buy SPAZ-12.", 255, 0, 0)
            end
        elseif (source == buttons.buy_Uzi) then  -- Buy > Micro Uzi
            player = localPlayer
            local priceWeapon_Uzi = 9400
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_Uzi) then
            outputChatBox ("You bought a #FF0000Micro Uzi #FFFFFFfor #00ff00$#FF0000"..priceWeapon_Uzi.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_Uzi)
            triggerServerEvent("giveUzi", player, giveUzi)
            else
            outputChatBox("You dont have enough money to buy Micro Uzi.", 255, 0, 0)
            end
        elseif (source == buttons.buy_MP5) then  -- Buy > MP5
            player = localPlayer
            local priceWeapon_MP5 = 8900
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_MP5) then
            outputChatBox ("You bought a #FF0000MP5 #FFFFFFfor #00ff00$#FF0000"..priceWeapon_MP5.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_MP5)
            triggerServerEvent("giveMP5", player, giveMP5)
            else
            outputChatBox("You dont have enough money to buy MP5.", 255, 0, 0)
            end
        elseif (source == buttons.buy_TEC9) then  -- Buy > TEC-9
            player = localPlayer
            local priceWeapon_TEC9 = 9250
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_TEC9) then
            outputChatBox ("You bought a #FF0000TEC-9 #FFFFFFfor #00ff00$#FF0000"..priceWeapon_TEC9.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_TEC9)
            triggerServerEvent("giveTEC9", player, giveTEC9)
            else
            outputChatBox("You dont have enough money to buy TEC-9.", 255, 0, 0)
            end
        elseif (source == buttons.buy_AK47) then  -- Buy > AK-47
            player = localPlayer
            local priceWeapon_AK47 = 9900
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_AK47) then
            outputChatBox ("You bought a #FF0000AK-47 #FFFFFFfor #00ff00$#FF0000"..priceWeapon_AK47.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_AK47)
            triggerServerEvent("giveAK47", player, giveAK47)
            else
            outputChatBox("You dont have enough money to buy AK-47.", 255, 0, 0)
            end
        elseif (source == buttons.buy_M4) then  -- Buy > M4
            player = localPlayer
            local priceWeapon_M4 = 10000
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_M4) then
            outputChatBox ("You bought a #FF0000M4 #FFFFFFfor #00ff00$#FF0000"..priceWeapon_M4.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_M4)
            triggerServerEvent("giveM4", player, giveM4)
            else
            outputChatBox("You dont have enough money to buy M4.", 255, 0, 0)
            end
        elseif (source == buttons.buy_Sniper) then  -- Buy > Sniper
            player = localPlayer
            local priceWeapon_Sniper = 9500
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_Sniper) then
            outputChatBox ("You bought a #FF0000Sniper #FFFFFFfor #00ff00$#FF0000"..priceWeapon_Sniper.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_Sniper)
            triggerServerEvent("giveSniper", player, giveSniper)
            else
            outputChatBox("You dont have enough money to buy Sniper.", 255, 0, 0)
            end
end
end
addEventHandler("onClientGUIClick", root, buyWeapon)
 
function windowLabelsOnClick()
    local selectedTab = guiGetSelectedTab(tabPanel.myTabPanel)
    if (selectedTab == tabPanel.Tab_Loja) then
    guiSetText(labels.body, "")
    guiSetText(labels.body_label, "")
    guiSetText(labels.Skills, "")
    guiSetText(labels.skills_label, "")
    guiSetText(labels.wnd_info_vehicle, "")
    guiSetText(labels.vehicleFunctions_label, "")
   
Edited by Guest
Link to comment

-- client side:

tabPanel = {} 
buttons = {}
labels = {}
images = {}
 
function main()
    shop_window = guiCreateWindow(340, 115, 405, 538, "Weapon Shop", false) -- Create window
    guiWindowSetSizable(shop_window, false)
    guiSetVisible(shop_window, false)
 
    labels.Weapons = guiCreateLabel(7, 52, 53, 16, "Weapons", false, shop_window)
    guiLabelSetColor(labels.Weapons, 255, 0, 0)
    guiSetFont(labels.Weapons, "default-bold-small")
 
    tabPanel.myTabPanel = guiCreateTabPanel(60, 26, 353, 504, false, shop_window) -- Create TabPanel in the window
 
    addEventHandler("onClientGUIClick", root, buy)
 
    -- Tab 2 Buy weapons
    tabPanel.Tab_Loja = guiCreateTab("Buy Weapons", tabPanel.myTabPanel)
 
    images.Pistol = guiCreateStaticImage(0, 0, 101, 108, "weapons/22.png", false, tabPanel.Tab_Loja)
    buttons.buy_Pistol = guiCreateButton(6, 98, 103, 25, "Buy Pistol", false, tabPanel.Tab_Loja)
    labels.buy_Pistol = guiCreateLabel(23, 81, 81, 16, "$8.000", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_Pistol, "center", false)
    guiSetProperty( buttons.buy_Pistol, "HoverTextColour", "FFFFFF00" )
 
    images.SilencedPistol = guiCreateStaticImage(125, 0, 79, 112, "weapons/23.png", false, tabPanel.Tab_Loja)
    buttons.buy_SilencedPistol = guiCreateButton(113, 99, 108, 29, "Buy Silenced pistol", false, tabPanel.Tab_Loja)
    labels.buy_SilencedPistol = guiCreateLabel(127, 81, 81, 16, "$8.300", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_SilencedPistol, "center", false)
    guiSetProperty( buttons.buy_SilencedPistol, "HoverTextColour", "FFFFFF00" )
 
    buttons.buy_DesertEagle = guiCreateButton(224, 99, 103, 28, "Buy Desert eagle", false, tabPanel.Tab_Loja)
    images.DesertEagle = guiCreateStaticImage(229, 0, 87, 105, "weapons/24.png", false, tabPanel.Tab_Loja)
    labels.buy_DesertEagle = guiCreateLabel(226, 82, 91, 14, "$9.200", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_DesertEagle, "center", false)
    guiSetProperty( buttons.buy_DesertEagle, "HoverTextColour", "FFFFFF00" )
 
    images.Shotgun = guiCreateStaticImage(12, 115, 96, 115, "weapons/25.png", false, tabPanel.Tab_Loja)
    buttons.buy_Shotgun = guiCreateButton(6, 221, 103, 25, "Buy Shotgun", false, tabPanel.Tab_Loja)
    labels.buy_Shotgun = guiCreateLabel(8, 204, 99, 14, "$9.100", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_Shotgun, "center", false)
    guiSetProperty( buttons.buy_Shotgun, "HoverTextColour", "FFFFFF00" )
 
    images.SawnOff = guiCreateStaticImage(116, 129, 101, 98, "weapons/26.png", false, tabPanel.Tab_Loja)
    buttons.buy_SawnOff = guiCreateButton(114, 221, 103, 30, "Buy Sawn-off Shotgun", false, tabPanel.Tab_Loja)
    labels.buy_SawnOff = guiCreateLabel(115, 204, 99, 14, "$9.800", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_SawnOff, "center", false)
    guiSetProperty( buttons.buy_SawnOff, "HoverTextColour", "FFFFFF00" )
 
    labels.buy_SPAZ12 = guiCreateLabel(224, 204, 99, 14, "$9.550", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_SPAZ12, "center", false)
    images.SPAZ12 = guiCreateStaticImage(224, 124, 98, 107, "weapons/27.png", false, tabPanel.Tab_Loja)
    buttons.buy_SPAZ12 = guiCreateButton(222, 221, 103, 27, "Buy SPAZ-12", false, tabPanel.Tab_Loja)
    guiSetProperty( buttons.buy_SPAZ12, "HoverTextColour", "FFFFFF00" )
 
    buttons.buy_Uzi = guiCreateButton(6, 337, 103, 26, "Buy Micro Uzi", false, tabPanel.Tab_Loja)
    images.Uzi = guiCreateStaticImage(14, 256, 74, 75, "weapons/28.png", false, tabPanel.Tab_Loja)
    labels.buy_Uzi = guiCreateLabel(8, 320, 99, 14, "$9.400", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_Uzi, "center", false)
    guiSetProperty( buttons.buy_Uzi, "HoverTextColour", "FFFFFF00" )
 
    images.MP5 = guiCreateStaticImage(122, 256, 82, 69, "weapons/29.png", false, tabPanel.Tab_Loja)
    buttons.buy_MP5 = guiCreateButton(114, 337, 103, 26, "Buy MP5", false, tabPanel.Tab_Loja)
    labels.buy_MP5 = guiCreateLabel(115, 320, 99, 14, "$8.900", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_MP5, "center", false)
    guiSetProperty( buttons.buy_MP5, "HoverTextColour", "FFFFFF00" )
 
    images.TEC9 = guiCreateStaticImage(236, 266, 74, 63, "weapons/32.png", false, tabPanel.Tab_Loja)
    buttons.buy_TEC9 = guiCreateButton(222, 337, 103, 26, "Buy TEC-9", false, tabPanel.Tab_Loja)
    labels.buy_TEC9 = guiCreateLabel(224, 320, 99, 14, "$9.250", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_TEC9, "center", false)
    guiSetProperty( buttons.buy_TEC9, "HoverTextColour", "FFFFFF00" )
 
    images.AK47 = guiCreateStaticImage(8, 360, 91, 86, "weapons/30.png", false, tabPanel.Tab_Loja)
    buttons.buy_AK47 = guiCreateButton(6, 447, 103, 28, "Buy AK-47", false, tabPanel.Tab_Loja)
    labels.buy_AK47 = guiCreateLabel(8, 431, 99, 14, "$9.900", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_AK47, "center", false)
    guiSetProperty( buttons.buy_AK47, "HoverTextColour", "FFFFFF00" )
 
    labels.buy_M4 = guiCreateLabel(117, 430, 99, 14, "$10.000", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_M4, "center", false)
    buttons.buy_M4 = guiCreateButton(117, 447, 98, 27, "Buy M4", false, tabPanel.Tab_Loja)
    images.M4 = guiCreateStaticImage(117, 361, 95, 85, "weapons/31.png", false, tabPanel.Tab_Loja)
    guiSetProperty( buttons.buy_M4, "HoverTextColour", "FFFFFF00" )
 
    images.Sniper = guiCreateStaticImage(214, 381, 112, 68, "weapons/icon.png", false, tabPanel.Tab_Loja)
    buttons.buy_Sniper = guiCreateButton(222, 447, 103, 26, "Buy Sniper", false, tabPanel.Tab_Loja)
    labels.buy_Sniper = guiCreateLabel(224, 431, 99, 14, "$9.500", false, tabPanel.Tab_Loja)
    guiLabelSetHorizontalAlign(labels.buy_Sniper, "center", false)
    guiSetProperty( buttons.buy_Sniper, "HoverTextColour", "FFFFFF00" )
end -- You had missing the 'end'.
 
function buyWeapon()
        if (source == buttons.buy_Pistol) then  -- Buy > Pistol
            player = localPlayer
            local priceWeapon_Pistol = 8000
            money = getPlayerMoney(source)
 
            if (money >= priceWeapon_Pistol) then
            outputChatBox ("You bought a #FF0000Pistol #FFFFFFfor #00ff00$#FF0000"..priceWeapon_Pistol.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_Pistol)
            triggerServerEvent("givePistol", player, givePistol)
            else
            outputChatBox("You dont have enough money to buy Pistol.", 255, 0, 0)
            end
        elseif (source == buttons.buy_SilencedPistol) then  -- Buy > Silenced pistol
            player = localPlayer
            local priceWeapon_SilencedPistol = 8300
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_SilencedPistol) then
            outputChatBox ("You bought a #FF0000Silenced pistol #FFFFFFfor #00ff00$#FF0000"..priceWeapon_SilencedPistol.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_SilencedPistol)
            triggerServerEvent("giveSilencedPistol", player, giveSilencedPistol)
            else
            outputChatBox("You dont have enough money to buy Silenced pistol.", 255, 0, 0)
            end
        elseif (source == buttons.buy_DesertEagle) then  -- Buy > Desert eagle
            player = localPlayer
            local priceWeapon_DesertEagle = 9200
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_DesertEagle) then
            outputChatBox ("You bought a #FF0000Desert eagle #FFFFFFfor #00ff00$#FF0000"..priceWeapon_DesertEagle.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_DesertEagle)
            triggerServerEvent("giveDesertEagle", player, giveDesertEagle)
            else
            outputChatBox("You dont have enough money to buy Desert eagle.", 255, 0, 0)
            end
        elseif (source == buttons.buy_Shotgun) then  -- Buy > Shotgun
            player = localPlayer
            local priceWeapon_Shotgun = 9100
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_Shotgun) then
            outputChatBox ("You bought a #FF0000Shotgun #FFFFFFfor #00ff00$#FF0000"..priceWeapon_Shotgun.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_Shotgun)
            triggerServerEvent("giveShotgun", player, giveShotgun)
            else
            outputChatBox("You dont have enough money to buy Shotgun.", 255, 0, 0)
            end
        elseif (source == buttons.buy_SawnOff) then  -- Buy > Sawn-off Shotgun
            player = localPlayer
            local priceWeapon_SawnOff = 9800
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_SawnOff) then
            outputChatBox ("You bought a #FF0000Sawn-off shotgun #FFFFFFfor #00ff00$#FF0000"..priceWeapon_SawnOff.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_SawnOff)
            triggerServerEvent("giveSawnOff", player, giveSawnOff)
            else
            outputChatBox("You dont have enough money to buy Sawn-off shotgun.", 255, 0, 0)
            end
        elseif (source ==  buttons.buy_SPAZ12) then  -- Buy > SPAZ-12
            player = localPlayer
            local priceWeapon_SPAZ12 = 9550
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_SPAZ12) then
            outputChatBox ("You bought a #FF0000SPAZ-12 #FFFFFFfor #00ff00$#FF0000"..priceWeapon_SPAZ12.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_SPAZ12)
            triggerServerEvent("giveSPAZ12", player, giveSPAZ12)
            else
            outputChatBox("You dont have enough money to buy SPAZ-12.", 255, 0, 0)
            end
        elseif (source == buttons.buy_Uzi) then  -- Buy > Micro Uzi
            player = localPlayer
            local priceWeapon_Uzi = 9400
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_Uzi) then
            outputChatBox ("You bought a #FF0000Micro Uzi #FFFFFFfor #00ff00$#FF0000"..priceWeapon_Uzi.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_Uzi)
            triggerServerEvent("giveUzi", player, giveUzi)
            else
            outputChatBox("You dont have enough money to buy Micro Uzi.", 255, 0, 0)
            end
        elseif (source == buttons.buy_MP5) then  -- Buy > MP5
            player = localPlayer
            local priceWeapon_MP5 = 8900
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_MP5) then
            outputChatBox ("You bought a #FF0000MP5 #FFFFFFfor #00ff00$#FF0000"..priceWeapon_MP5.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_MP5)
            triggerServerEvent("giveMP5", player, giveMP5)
            else
            outputChatBox("You dont have enough money to buy MP5.", 255, 0, 0)
            end
        elseif (source == buttons.buy_TEC9) then  -- Buy > TEC-9
            player = localPlayer
            local priceWeapon_TEC9 = 9250
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_TEC9) then
            outputChatBox ("You bought a #FF0000TEC-9 #FFFFFFfor #00ff00$#FF0000"..priceWeapon_TEC9.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_TEC9)
            triggerServerEvent("giveTEC9", player, giveTEC9)
            else
            outputChatBox("You dont have enough money to buy TEC-9.", 255, 0, 0)
            end
        elseif (source == buttons.buy_AK47) then  -- Buy > AK-47
            player = localPlayer
            local priceWeapon_AK47 = 9900
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_AK47) then
            outputChatBox ("You bought a #FF0000AK-47 #FFFFFFfor #00ff00$#FF0000"..priceWeapon_AK47.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_AK47)
            triggerServerEvent("giveAK47", player, giveAK47)
            else
            outputChatBox("You dont have enough money to buy AK-47.", 255, 0, 0)
            end
        elseif (source == buttons.buy_M4) then  -- Buy > M4
            player = localPlayer
            local priceWeapon_M4 = 10000
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_M4) then
            outputChatBox ("You bought a #FF0000M4 #FFFFFFfor #00ff00$#FF0000"..priceWeapon_M4.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_M4)
            triggerServerEvent("giveM4", player, giveM4)
            else
            outputChatBox("You dont have enough money to buy M4.", 255, 0, 0)
            end
        elseif (source == buttons.buy_Sniper) then  -- Buy > Sniper
            player = localPlayer
            local priceWeapon_Sniper = 9500
            money = getPlayerMoney (source)
 
            if (money >= priceWeapon_Sniper) then
            outputChatBox ("You bought a #FF0000Sniper #FFFFFFfor #00ff00$#FF0000"..priceWeapon_Sniper.."", 255, 255, 255, true)
            takePlayerMoney(priceWeapon_Sniper)
            triggerServerEvent("giveSniper", player, giveSniper)
            else
            outputChatBox("You dont have enough money to buy Sniper.", 255, 0, 0)
        end
    end
end
addEventHandler("onClientGUIClick", root, buyWeapon)
 
function windowLabelsOnClick()
    main ( )
    local selectedTab = guiGetSelectedTab(tabPanel.myTabPanel)
    if (selectedTab == tabPanel.Tab_Loja) then
    guiSetText(labels.body, "")
    guiSetText(labels.body_label, "")
    guiSetText(labels.Skills, "")
   
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...