Turbesz Posted August 21, 2016 Share Posted August 21, 2016 why not working this? (sorry, but me very very noob "scripter") --client local szavon = false local ido = 30 local valasz = 0 GUIEditor_Window = {} GUIEditor_Label = {} function szAblak(ker,v1,v2) if not szavon then local v_1 = v1 local v_2 = v2 local szavon = true local sw,sh = guiGetScreenSize() GUIEditor_Window[1] = guiCreateWindow(sw/1.48,sh/1.4,sw/3.2,sh/3.6,"Szavazás",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(0.0474,0.1242,0.9161,0.2919,ker,true,GUIEditor_Window[1]) guiLabelSetHorizontalAlign(GUIEditor_Label[1],"center",true) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(0.0657,0.4783,0.8759,0.1553,"1.) "..v_1,true,GUIEditor_Window[1]) --guiLabelSetColor(GUIEditor_Label[2],255,200,200) --guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Label[3] = guiCreateLabel(0.0657,0.6335,0.8759,0.1491,"2.) "..v_2,true,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(0.0474,0.8075,0.8,0.1,ido,true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],150,150,255) guiSetFont(GUIEditor_Label[4],"clear-normal") bindKey ("1", "down", function() guiSetFont(GUIEditor_Label[3],"clear-normal") guiLabelSetColor(GUIEditor_Label[3],255,255,255) valasz = 1 guiLabelSetColor(GUIEditor_Label[2],255,200,200) guiSetFont(GUIEditor_Label[2],"default-bold-small") end) bindKey ("2", "down", function() guiSetFont(GUIEditor_Label[2],"default-normal") guiLabelSetColor(GUIEditor_Label[2],255,255,255) valasz = 2 guiLabelSetColor(GUIEditor_Label[3],255,200,200) guiSetFont(GUIEditor_Label[3],"default-bold-small") end) lejar = setTimer( function() ido = ido-1 guiSetText(GUIEditor_Label[4], ido ) if ido == 0 then szVeg() --killTimer(lejar) end end, 1000,30) end end function szVeg() if isTimer(lejar) then killTimer(lejar) end szavon = false guiSetText(GUIEditor_Label[4], "szavazatok számlálása..." ) guiSetFont(GUIEditor_Label[2],"default-normal") guiSetFont(GUIEditor_Label[3],"default-normal") guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetColor(GUIEditor_Label[2],255,255,255) --("valasz: "..valasz) triggerServerEvent("submit",getLocalPlayer(),valasz) unbindKey ("1", "down", function() guiSetFont(GUIEditor_Label[3],"clear-normal") guiLabelSetColor(GUIEditor_Label[3],255,255,255) valasz = 1 guiLabelSetColor(GUIEditor_Label[2],255,200,200) guiSetFont(GUIEditor_Label[2],"default-bold-small") end) unbindKey ("2", "down", function() guiSetFont(GUIEditor_Label[2],"default-normal") guiLabelSetColor(GUIEditor_Label[2],255,255,255) valasz = 2 guiLabelSetColor(GUIEditor_Label[3],255,200,200) guiSetFont(GUIEditor_Label[3],"default-bold-small") end) end addEvent("szvzas",true) addEventHandler("szvzas",getRootElement(), function(kerdes,val1,val2) szAblak(kerdes,val1,val2) end) addEvent("valaszok",true) addEventHandler("valaszok",getRootElement(), function(v1,v2) local v_1 = v1 local v_2 = v2 guiSetText(GUIEditor_Label[4], "_@/\"" ) guiSetText(GUIEditor_Label[2], guiGetText(GUIEditor_Label[2]) .. " - " .. v1 ) guiSetText(GUIEditor_Label[3], guiGetText(GUIEditor_Label[3]) .. " - " .. v2 ) if v1 > v2 then guiSetFont(GUIEditor_Label[2],"default-bold-small") elseif v1 < v2 then guiSetFont(GUIEditor_Label[3],"default-bold-small") end setTimer( function() destroyElement(GUIEditor_Window[1]) szavon = false ido = 30 valasz = 0 end, 5000, 1) end) --server function met(p,s) if hasObjectPermissionTo(p,"function.kickPlayer") then triggerClientEvent(getRootElement(),"szvzas",getRootElement()) end end addCommandHandler("k",met) function valaszok () --if hasObjectPermissionTo(p,"function.kickPlayer") then triggerClientEvent(getRootElement(),"valaszok",getRootElement()) end --end Link to comment
1LoL1 Posted August 21, 2016 Share Posted August 21, 2016 Error/warning? function met (source) if hasObjectPermissionTo(source, "function.kickPlayer") then triggerClientEvent(source, "szvzas", getRootElement()) end end addCommandHandler("k",met) function valaszok (source) --if hasObjectPermissionTo(source, "function.kickPlayer") then triggerClientEvent(source, "valaszok", getRootElement()) end --end Link to comment
Turbesz Posted August 21, 2016 Author Share Posted August 21, 2016 Error/warning? function met (source) if hasObjectPermissionTo(source, "function.kickPlayer") then triggerClientEvent(source, "szvzas", getRootElement()) end end addCommandHandler("k",met) function valaszok (source) --if hasObjectPermissionTo(source, "function.kickPlayer") then triggerClientEvent(source, "valaszok", getRootElement()) end --end WARNING: xy.lua:17: Bad argument @ 'guiCreateLabel' [Expected string at argument 5, got nil] WARNING: xy.lua:18: Bad argument @ 'guiLabelSetHorizontalAlign' [Expected gui-element at argument 1, got boolean] WARNING: xy.lua:19: Bad argument @ 'guiSetFont' [Expected gui-element at argument 1, got boolean] ERROR: xy.lua:20: attempt to concatenate local 'v_1' (a nil value) Link to comment
Wumbaloo Posted August 21, 2016 Share Posted August 21, 2016 WARNING: xy.lua:17: Bad argument @ 'guiCreateLabel' [Expected string at argument 5, got nil] Just add a string at argument 5, check out guiCreateLabel on Wiki guiCreateLabel WARNING: xy.lua:18: Bad argument @ 'guiLabelSetHorizontalAlign' [Expected gui-element at argument 1, got boolean] WARNING: xy.lua:19: Bad argument @ 'guiSetFont' [Expected gui-element at argument 1, got boolean] will be resolved by adding string for your GUIEditor_Label[1] triggerClientEvent(source, "szvzas", getRootElement()) need 2 arguments, v1 and v2 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now