Jump to content

How to fix bug in this script?


Turbe$Z

Recommended Posts

--client

local GUIEditor = {
    tab = {},
    tabpanel = {},
    label = {},
    button = {},
    window = {}
}

        GUIEditor.window[1] = guiCreateWindow(0.32, 0.29, 0.37, 0.29, "[DDC]© Fegyverbolt /turbesz\"", true)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetAlpha(GUIEditor.window[1], 1.00)

        GUIEditor.button[1] = guiCreateButton(0.02, 0.91, 0.96, 0.05, "bezárás", true, GUIEditor.window[1])
        GUIEditor.tabpanel[1] = guiCreateTabPanel(0.02, 0.08, 0.96, 0.80, true, GUIEditor.window[1])

        GUIEditor.tab[1] = guiCreateTab("#1", GUIEditor.tabpanel[1])

        GUIEditor.label[1] = guiCreateLabel(0.01, 0.00, 0.99, 0.29, "M4 - 5000 tölténnyel", true, GUIEditor.tab[1])
        guiSetFont(GUIEditor.label[1], "sa-header")
        guiLabelSetHorizontalAlign(GUIEditor.label[1], "left", true)
        GUIEditor.button[2] = guiCreateButton(0.01, 0.27, 0.99, 0.12, "Kérem ezt! Ár: 3000$!", true, GUIEditor.tab[1])
        guiSetFont(GUIEditor.button[2], "default-bold-small")
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF24FE00")
        GUIEditor.label[2] = guiCreateLabel(0.01, 0.38, 0.99, 0.29, "AK47 - 5000 tölténnyel", true, GUIEditor.tab[1])
        guiSetFont(GUIEditor.label[2], "sa-header")
        guiLabelSetHorizontalAlign(GUIEditor.label[2], "left", true)
        GUIEditor.button[3] = guiCreateButton(0.00, 0.67, 0.99, 0.12, "Kérem ezt! Ár: 2500$!", true, GUIEditor.tab[1])
        guiSetFont(GUIEditor.button[3], "default-bold-small")
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF24FE00")
        GUIEditor.label[3] = guiCreateLabel(0.11, 0.85, 0.78, 0.10, "Folytatást a következő fülön találhatsz! ;)", true, GUIEditor.tab[1])
        guiSetFont(GUIEditor.label[3], "default-bold-small")
        guiLabelSetColor(GUIEditor.label[3], 251, 248, 2)

        GUIEditor.tab[2] = guiCreateTab("#2", GUIEditor.tabpanel[1])

        GUIEditor.label[4] = guiCreateLabel(0.01, 0.05, 0.97, 0.30, "9MM - 4000 Tölténnyel", true, GUIEditor.tab[2])
        guiSetFont(GUIEditor.label[4], "sa-header")
        GUIEditor.button[4] = guiCreateButton(0.01, 0.37, 0.97, 0.12, "Kérem ezt! Ár: 2000$!", true, GUIEditor.tab[2])
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFBF802")
        GUIEditor.label[5] = guiCreateLabel(0.01, 0.48, 0.98, 0.27, "Uzi - 4000 Tölténnyel", true, GUIEditor.tab[2])
        guiSetFont(GUIEditor.label[5], "sa-header")
        GUIEditor.button[5] = guiCreateButton(0.01, 0.78, 0.97, 0.12, "Kérem ezt! Ár: 2500$!", true, GUIEditor.tab[2])
        guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFFBF802")

        GUIEditor.tab[3] = guiCreateTab("#3", GUIEditor.tabpanel[1])

        GUIEditor.label[6] = guiCreateLabel(0.02, 0.04, 0.96, 0.29, "RPG - 100 Tölténnyel", true, GUIEditor.tab[3])
        guiSetFont(GUIEditor.label[6], "sa-header")
        GUIEditor.button[6] = guiCreateButton(0.01, 0.31, 0.97, 0.13, "Kérem ezt! Ára: 300000$!", true, GUIEditor.tab[3])
        guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FF01C4B8")
        GUIEditor.label[7] = guiCreateLabel(0.02, 0.45, 0.96, 0.29, "M.lövész - 100 Tölténnyel", true, GUIEditor.tab[3])
        guiSetFont(GUIEditor.label[7], "sa-header")
        GUIEditor.button[7] = guiCreateButton(0.01, 0.77, 0.97, 0.13, "Kérem ezt! Ára: 50000$!", true, GUIEditor.tab[3])
        guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FF01C4B8")

        GUIEditor.tab[4] = guiCreateTab("#4", GUIEditor.tabpanel[1])

        GUIEditor.label[8] = guiCreateLabel(0.02, 0.05, 0.96, 0.10, "MP5 - 3000 Tölténnyel", true, GUIEditor.tab[4])
        guiSetFont(GUIEditor.label[8], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[8], "center", false)
        GUIEditor.button[8] = guiCreateButton(0.09, 0.17, 0.81, 0.11, "Kérem ezt! Ár: 4000$!", true, GUIEditor.tab[4])
        GUIEditor.label[9] = guiCreateLabel(0.02, 0.30, 0.96, 0.10, "Tec9 - 3000 Tölténnyel", true, GUIEditor.tab[4])
        guiSetFont(GUIEditor.label[9], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[9], "center", false)
        GUIEditor.button[9] = guiCreateButton(0.09, 0.41, 0.81, 0.11, "Kérem ezt! Ár: 4500$!", true, GUIEditor.tab[4])
        GUIEditor.label[10] = guiCreateLabel(0.02, 0.54, 0.96, 0.10, "Shotgun - 2500 Tölténnyel", true, GUIEditor.tab[4])
        guiSetFont(GUIEditor.label[10], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[10], "center", false)
        GUIEditor.button[10] = guiCreateButton(0.09, 0.64, 0.81, 0.11, "Kérem ezt! Ár: 5000$!", true, GUIEditor.tab[4])
        GUIEditor.label[11] = guiCreateLabel(0.02, 0.77, 0.96, 0.10, "Lefűrészelt csövű puska - 2500 Tölténnyel", true, GUIEditor.tab[4])
        guiSetFont(GUIEditor.label[11], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[11], "center", false)
        GUIEditor.button[11] = guiCreateButton(0.09, 0.88, 0.81, 0.11, "Kérem ezt! Ár: 5500$!", true, GUIEditor.tab[4])

        GUIEditor.tab[5] = guiCreateTab("#5", GUIEditor.tabpanel[1])

        GUIEditor.label[12] = guiCreateLabel(0.01, 0.02, 0.97, 0.10, "Hangtompítós pisztoly - 3000 tölténnyel", true, GUIEditor.tab[5])
        guiSetFont(GUIEditor.label[12], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[12], "center", false)
        guiLabelSetVerticalAlign(GUIEditor.label[12], "center")
        GUIEditor.button[12] = guiCreateButton(0.12, 0.13, 0.75, 0.11, "Kérem ezt! Ára: 1500$!", true, GUIEditor.tab[5])
        GUIEditor.label[13] = guiCreateLabel(0.01, 0.24, 0.97, 0.10, "Lángszóró - 3000 tölténnyel", true, GUIEditor.tab[5])
        guiSetFont(GUIEditor.label[13], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[13], "center", false)
        guiLabelSetVerticalAlign(GUIEditor.label[13], "center")
        GUIEditor.button[13] = guiCreateButton(0.12, 0.36, 0.75, 0.11, "Kérem ezt! Ára: 10000$!", true, GUIEditor.tab[5])
        GUIEditor.label[14] = guiCreateLabel(0.01, 0.47, 0.97, 0.10, "Gránát - 50 darab", true, GUIEditor.tab[5])
        guiSetFont(GUIEditor.label[14], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[14], "center", false)
        guiLabelSetVerticalAlign(GUIEditor.label[14], "center")
        GUIEditor.button[14] = guiCreateButton(0.12, 0.59, 0.75, 0.11, "Kérem ezt! Ára: 15000$!", true, GUIEditor.tab[5])
        GUIEditor.label[15] = guiCreateLabel(0.01, 0.70, 0.97, 0.10, "Tapadós bomba - 50 darab", true, GUIEditor.tab[5])
        guiSetFont(GUIEditor.label[15], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[15], "center", false)
        guiLabelSetVerticalAlign(GUIEditor.label[15], "center")
        GUIEditor.button[15] = guiCreateButton(0.12, 0.84, 0.75, 0.11, "Kérem ezt! Ára: 20000$!", true, GUIEditor.tab[5])

        GUIEditor.tab[6] = guiCreateTab("#6", GUIEditor.tabpanel[1])

        GUIEditor.label[16] = guiCreateLabel(0.00, 0.03, 0.98, 0.28, "Molotov - 50 darab", true, GUIEditor.tab[6])
        guiSetFont(GUIEditor.label[16], "sa-header")
        GUIEditor.button[16] = guiCreateButton(0.00, 0.33, 0.99, 0.15, "Kérem ezt! Ár: 10000$!", true, GUIEditor.tab[6])
        guiSetFont(GUIEditor.button[16], "clear-normal")
        guiSetProperty(GUIEditor.button[16], "NormalTextColour", "FF4F09FE")
        GUIEditor.label[17] = guiCreateLabel(0.00, 0.51, 0.98, 0.28, "Könnygáz - 50 darab", true, GUIEditor.tab[6])
        guiSetFont(GUIEditor.label[17], "sa-header")
        GUIEditor.button[17] = guiCreateButton(0.00, 0.80, 0.99, 0.15, "Kérem ezt! Ár: 20000$!", true, GUIEditor.tab[6])
        guiSetFont(GUIEditor.button[17], "clear-normal")
        guiSetProperty(GUIEditor.button[17], "NormalTextColour", "FF4F09FE")    
		guiSetVisible ( GUIEditor.window[1], false )

function OpenWin()
    if guiGetVisible ( GUIEditor.window[1] ) == false then
       guiSetVisible ( GUIEditor.window[1], true )
       showCursor(true)
	elseif guiGetVisible ( GUIEditor.window[1] ) == true then
       guiSetVisible ( GUIEditor.window[1], false )
       showCursor(false)
	end
end
bindKey ( "F2", "down", OpenWin)

function bezarom()
       guiSetVisible ( GUIEditor.window[1], false )
       showCursor(false)
end
addEventHandler("onClientGUIClick", GUIEditor.button[1], bezarom)

function m4()
           triggerServerEvent ("m4",getLocalPlayer(),m4)
end
addEventHandler("onClientGUIClick", GUIEditor.button[2], m4)

function ak47()
           triggerServerEvent ("ak47",getLocalPlayer(),ak47)
end
addEventHandler("onClientGUIClick", GUIEditor.button[3], ak47)

function kilencmm()
           triggerServerEvent ("kilencmm",getLocalPlayer(),kilencmm)
end
addEventHandler("onClientGUIClick", GUIEditor.button[4], kilencmm)
 
function uzi()
           triggerServerEvent ("uzi",getLocalPlayer(),uzi)
end
addEventHandler("onClientGUIClick", GUIEditor.button[5], uzi)
  
function rpg()
           triggerServerEvent ("rpg",getLocalPlayer(),rpg)
end
addEventHandler("onClientGUIClick", GUIEditor.button[6], rpg)
   
function sniper()
           triggerServerEvent ("sniper",getLocalPlayer(),sniper)
end
addEventHandler("onClientGUIClick", GUIEditor.button[7], sniper)
    
function mp5()
           triggerServerEvent ("mp5",getLocalPlayer(),mp5)
end
addEventHandler("onClientGUIClick", GUIEditor.button[8], mp5)
     
function tec()
           triggerServerEvent ("tec",getLocalPlayer(),tec)
end
addEventHandler("onClientGUIClick", GUIEditor.button[9], tec)
      
function shotgun()
           triggerServerEvent ("shotgun",getLocalPlayer(),shotgun)
end
addEventHandler("onClientGUIClick", GUIEditor.button[10], shotgun)
       
function lfcsp()
           triggerServerEvent ("lfcsp",getLocalPlayer(),lfcsp)
end
addEventHandler("onClientGUIClick", GUIEditor.button[11], lfcsp)
        
function silenced()
           triggerServerEvent ("silenced",getLocalPlayer(),silenced)
end
addEventHandler("onClientGUIClick", GUIEditor.button[12], silenced)
         
function lsz()
           triggerServerEvent ("lsz",getLocalPlayer(),lsz)
end
addEventHandler("onClientGUIClick", GUIEditor.button[13], lsz)
          
function granat()
           triggerServerEvent ("granat",getLocalPlayer(),granat)
end
addEventHandler("onClientGUIClick", GUIEditor.button[14], granat)
           
function tapados()
           triggerServerEvent ("tapados",getLocalPlayer(),tapados)
end
addEventHandler("onClientGUIClick", GUIEditor.button[15], tapados)
            
function molotov()
           triggerServerEvent ("molotov",getLocalPlayer(),molotov)
end
addEventHandler("onClientGUIClick", GUIEditor.button[16], molotov)
             
function konnygaz()
           triggerServerEvent ("konnygaz",getLocalPlayer(),konnygaz)
end
addEventHandler("onClientGUIClick", GUIEditor.button[17], konnygaz)

--server

function elso ( )
  if getPlayerMoney(source) >= 3000 then
    giveWeapon ( source, 31, 5000 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 3000 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "m4", true )
addEventHandler( "m4", root, elso )

function masodik ( )
  if getPlayerMoney(source) >= 2500 then
    giveWeapon ( source, 30, 5000 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 2500 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "ak47", true )
addEventHandler( "ak47", root, masodik )
 
function harmadik ( )
  if getPlayerMoney(source) >= 2000 then
    giveWeapon ( source, 22, 4000 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 2000 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "kilencmm", true )
addEventHandler( "kilencmm", root, harmadik )
  
function negyedik ( )
  if getPlayerMoney(source) >= 2500 then
    giveWeapon ( source, 28, 4000 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 2500 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "uzi", true )
addEventHandler( "uzi", root, negyedik )
   
function otodik ( )
  if getPlayerMoney(source) >= 300000 then
    giveWeapon ( source, 36, 100 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 300000 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "rpg", true )
addEventHandler( "rpg", root, otodik )
    
function hatodik ( )
  if getPlayerMoney(source) >= 50000 then
    giveWeapon ( source, 34, 100 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 50000 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "sniper", true )
addEventHandler( "sniper", root, hatodik )
     
function hetedik ( )
  if getPlayerMoney(source) >= 4000 then
    giveWeapon ( source, 29, 3000 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 4000 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "mp5", true )
addEventHandler( "mp5", root, hetedik )
      
function nyolcadik ( )
  if getPlayerMoney(source) >= 4500 then
    giveWeapon ( source, 32, 3000 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 4500 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "tec", true )
addEventHandler( "tec", root, nyolcadik )
       
function kilencedik ( )
  if getPlayerMoney(source) >= 5000 then
    giveWeapon ( source, 25, 2500 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 5000 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "shotgun", true )
addEventHandler( "shotgun", root, kilencedik )
        
function tizedik ( )
  if getPlayerMoney(source) >= 5500 then
    giveWeapon ( source, 26, 2500 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 5500 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "lfcsp", true )
addEventHandler( "lfcsp", root, tizedik )
        
function tizenegyedik ( )
  if getPlayerMoney(source) >= 1500 then
    giveWeapon ( source, 23, 3000 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 1500 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "silenced", true )
addEventHandler( "silenced", root, tizenegyedik )
        
function tizenkettedik ( )
  if getPlayerMoney(source) >= 10000 then
    giveWeapon ( source, 37, 3000 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 10000 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "lsz", true )
addEventHandler( "lsz", root, tizenkettedik )
         
function tizenharmadik ( )
  if getPlayerMoney(source) >= 15000 then
    giveWeapon ( source, 16, 50 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 15000 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "granat", true )
addEventHandler( "granat", root, tizenharmadik )
         
function tizennegyedik ( )
  if getPlayerMoney(source) >= 20000 then
    giveWeapon ( source, 39, 50 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 20000 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "tapados", true )
addEventHandler( "tapados", root, tizennegyedik )
         
function tizenotodik ( )
  if getPlayerMoney(source) >= 10000 then
    giveWeapon ( source, 18, 50 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 10000 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "molotov", true )
addEventHandler( "molotov", root, tizenotodik )
          
function tizenhatodik ( )
  if getPlayerMoney(source) >= 20000 then
    giveWeapon ( source, 17, 50 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 20000 )
  else
    outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false)
  end
end
addEvent( "konnygaz", true )
addEventHandler( "konnygaz", root, tizenhatodik )
 

when i click on a tab, my money is decrease, and give me weapons, why? :S how to fix it?

Link to comment
13 minutes ago, Gravestone said:

That is because onClientGUIClick will trigger also when the gui-elements parent (if any) is clicked too. To fix this, you need to set the fourth argument of addEventHandler as 'false'. Example:


addEventHandler("onClientGUIClick", gui-element, function-name, false)

 

 

i added this: 

addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], konnygaz, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], molotov, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], tapados, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], granat, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], lsz, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], silenced, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], lfcsp, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], shotgun, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], tec, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], mp5, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], sniper, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], rpg, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], uzi, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], kilencmm, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], m4, false)
addEventHandler("onClientGUIClick", GUIEditor.tabpanel[1], ak47, false)
-----------------------------------------------------------------------------
addEventHandler("onClientGUIClick", GUIEditor.tab[1], konnygaz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], molotov, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], tapados, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], granat, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], lsz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], silenced, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], lfcsp, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], shotgun, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], tec, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], mp5, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], sniper, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], rpg, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], uzi, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], kilencmm, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], m4, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[1], ak47, false)
-----------------------------------------------------------------------------
addEventHandler("onClientGUIClick", GUIEditor.tab[2], konnygaz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], molotov, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], tapados, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], granat, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], lsz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], silenced, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], lfcsp, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], shotgun, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], tec, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], mp5, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], sniper, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], rpg, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], uzi, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], kilencmm, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], m4, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[2], ak47, false)
-----------------------------------------------------------------------------
addEventHandler("onClientGUIClick", GUIEditor.tab[3], konnygaz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], molotov, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], tapados, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], granat, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], lsz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], silenced, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], lfcsp, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], shotgun, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], tec, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], mp5, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], sniper, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], rpg, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], uzi, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], kilencmm, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], m4, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[3], ak47, false)
-----------------------------------------------------------------------------
addEventHandler("onClientGUIClick", GUIEditor.tab[4], konnygaz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], molotov, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], tapados, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], granat, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], lsz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], silenced, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], lfcsp, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], shotgun, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], tec, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], mp5, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], sniper, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], rpg, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], uzi, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], kilencmm, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], m4, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[4], ak47, false)
-----------------------------------------------------------------------------
addEventHandler("onClientGUIClick", GUIEditor.tab[5], konnygaz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], molotov, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], tapados, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], granat, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], lsz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], silenced, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], lfcsp, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], shotgun, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], tec, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], mp5, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], sniper, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], rpg, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], uzi, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], kilencmm, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], m4, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[5], ak47, false)
-----------------------------------------------------------------------------
addEventHandler("onClientGUIClick", GUIEditor.tab[6], konnygaz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], molotov, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], tapados, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], granat, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], lsz, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], silenced, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], lfcsp, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], shotgun, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], tec, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], mp5, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], sniper, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], rpg, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], uzi, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], kilencmm, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], m4, false)
addEventHandler("onClientGUIClick", GUIEditor.tab[6], ak47, false)

but doesn't working. :S why?

Link to comment
15 hours ago, Gravestone said:

It's the same as the one he wrote. It has to be like this:


addEventHandler("onClientGUIClick", GUIEditor.button[1], functionname, false)

 

like this? or what is the functionname?

function m4()
           triggerServerEvent ("m4",getLocalPlayer(),m4)
end
addEventHandler("onClientGUIClick", GUIEditor.button[2], m4)
addEventHandler("onClientGUIClick", GUIEditor.button[2], m4, false)

 

Link to comment
1 minute ago, Turbo777 said:

like this? or what is the functionname?


function m4()           triggerServerEvent ("m4",getLocalPlayer(),m4)endaddEventHandler("onClientGUIClick", GUIEditor.button[2], m4)addEventHandler("onClientGUIClick", GUIEditor.button[2], m4, false)

 

Dude, use this

function m4()
           triggerServerEvent ("m4",getLocalPlayer(),m4)
end
addEventHandler("onClientGUIClick", GUIEditor.button[2], m4, false)

 

Link to comment

You should do it like this.

function giveWeapong()
  if (  source == GUIEditor.button[2] ) then -- You can add more statements for giving more weapons making the script shorter and in just one function
    triggerServerEvent("giveWeapon", localPlayer, "M4")
  end
end
addEventHandler("onClientGUIClick", root, giveWeaponG)

 

 

Edited by Simple01
Link to comment
Just now, Simple01 said:

You should do it like this.


function giveWeapong()  if (  source == GUIEditor.button[2] ) then -- You can add more statements for giving more weapons making the script shorter and in just one function    giveWeapon(...)  endendaddEventHandler("onClientGUIClick", root, giveWeaponG)

 

 

The wiki says:

Note:If you attach a GUI element to this event, when you click it's parent it will trigger too!

 

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...