Search the Community
Showing results for tags 'triggered'.
-
I'm having trouble creating a gun shop But when I press b4 (buy m4) on GUI I face a problem And he says to me Client triggered server side event, but event is not added servers Client triggered server side event givem4, but event is not added serverside GUIEditor = { button = {}, staticimage = {}, label = {} } yoyoWnd = guiCreateWindow(114, 139, 575, 311, "gun panel ~~~ by Yoyo", false) guiWindowSetSizable(yoyoWnd, false) guiSetProperty(yoyoWnd, "CaptionColour", "FFFE0505") guiSetVisible(yoyoWnd,false) GUIEditor.staticimage[1] = guiCreateStaticImage(10, 21, 67, 62, ":metaa/img/32.png", false, yoyoWnd) GUIEditor.staticimage[2] = guiCreateStaticImage(254, 21, 69, 62, ":metaa/img/29.png", false, yoyoWnd) GUIEditor.staticimage[3] = guiCreateStaticImage(-241, 0, 70, 59, ":metaa/img/30.png", false, GUIEditor.staticimage[2]) GUIEditor.staticimage[4] = guiCreateStaticImage(496, 21, 69, 62, ":metaa/img/27.png", false, yoyoWnd) GUIEditor.staticimage[5] = guiCreateStaticImage(10, 125, 67, 61, ":metaa/img/30.png", false, yoyoWnd) GUIEditor.staticimage[6] = guiCreateStaticImage(256, 125, 67, 61, ":metaa/img/31.png", false, yoyoWnd) GUIEditor.staticimage[7] = guiCreateStaticImage(10, 240, 67, 61, ":metaa/img/22.png", false, yoyoWnd) GUIEditor.staticimage[8] = guiCreateStaticImage(496, 240, 69, 60, ":metaa/img/23.png", false, yoyoWnd) GUIEditor.staticimage[9] = guiCreateStaticImage(496, 125, 65, 61, ":metaa/img/33.png", false, yoyoWnd) b1 = guiCreateButton(10, 83, 67, 21, "uzi", false, yoyoWnd) guiSetProperty(b1, "NormalTextColour", "FF6CFE00") b2 = guiCreateButton(257, 83, 67, 21, "mp5", false, yoyoWnd) guiSetProperty(b2, "NormalTextColour", "FF6CFE00") b3 = guiCreateButton(498, 83, 67, 21, "spas", false, yoyoWnd) guiSetProperty(b3, "NormalTextColour", "FF6CFE00") b4 = guiCreateButton(256, 186, 67, 21, "m4", false, yoyoWnd) guiSetProperty(b4, "NormalTextColour", "FF6CFE00") b5 = guiCreateButton(10, 186, 67, 21, "ak-47", false, yoyoWnd) guiSetProperty(b5, "NormalTextColour", "FF6CFE00") b6 = guiCreateButton(496, 186, 67, 21, "lancher", false, yoyoWnd) guiSetProperty(b6, "NormalTextColour", "FF6CFE00") GUIEditor.button[1] = guiCreateButton(77, 261, 71, 23, "", false, yoyoWnd) b8 = guiCreateButton(77, 261, 71, 23, "pistole", false, yoyoWnd) guiSetProperty(b8, "NormalTextColour", "FF6CFE00") b10 = guiCreateButton(425, 260, 71, 23, "Silenced", false, yoyoWnd) guiSetProperty(b10, "NormalTextColour", "FF6CFE00") GUIEditor.label[1] = guiCreateLabel(151, -51, 46, 35, "", false, yoyoWnd) cl = guiCreateButton(240, 258, 98, 35, "close", false, yoyoWnd) guiSetProperty(cl, "NormalTextColour", "FFFF0000") function yoyo () guiSetVisible (yoyoWnd,true) showCursor (true) end bindKey ( "F6","down",yoyo) addEventHandler ("onClientGUIClick",root, function() if ( source == cl ) then guiSetVisible ( yoyoWnd , false) showCursor ( false ) end end ) function buym4() if ( source == b4) then showCursor(false) guiSetVisible(window1,false) triggerServerEvent("givem4", localPlayer) end end addEventHandler("onClientGUIClick", root, buym4) function buym4() local playerMoney = getPlayerMoney(source) if (playerMoney >= 40000) then takePlayerMoney(source,40000) giveWeapon(source,31,200) end end addEvent("givem4",true) addEventHandler("givem4", root, buym4) function buym4() if ( source == b4) then showCursor(false) guiSetVisible(window1,false) triggerServerEvent("givem4", localPlayer) end end addEventHandler("onClientGUIClick", root, buym4) HELP PLSSS
-
I'm trying to make simple job. When player hit the marker this error pops up in debuscript 3. I'm just learning Lua and I don't know how to fix this error. Error: Server triggered clientside event, createGui, but event is not added clientside meta.xml <meta> <script src="server.Lua" type="server" /> <script src="client.Lua" type="client" /> </meta> client.Lua local gui = {} okno = guiCreateWindow(0.35, 0.26, 0.16, 0.45, "Praca GAZECIARZ", true) guiWindowSetSizable(okno, false) guiSetVisible(okno, false) button = guiCreateButton(0.16, 0.56, 0.73, 0.39, "", true, okno) addEvent("createGui", true) function openGui() outputChatBox("Test2") guiSetVisible(okno, false) end addEventHandler("createGui", resourceRoot, openGui) server.Lua function createSomeMarker() createMarker(-2442, 754, 34, "cylinder", 2) end addEventHandler("onResourceStart", root, createSomeMarker) function markerCollision (markerHit, matchingDimension) if matchingDimension then outputChatBox("Test1") triggerClientEvent("createGui", resourceRoot) end end addEventHandler("onPlayerMarkerHit", root, markerCollision) Thanks for the help!
-
Estava Tentando Resolver Outro Bug ai Quando fui testar deu esse erro alguem sabe resolver-lo ? local screenW, screenH = guiGetScreenSize() local x, y = (screenW/1366), (screenH/768) function onClientRender() dxDrawRectangle((screenW - 323) / 2, (screenH - 465) / 2, 323, 465, tocolor(0, 0, 0, 185), false) dxDrawText("Ak 47", 657, 302, 710, 331, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawRectangle(519, 299, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawImage(471, 321, 320, 110, "Img/30.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(519, 403, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawRectangle(519, 181, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawRectangle(519, 507, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawText("Deagle", 644, 406, 697, 435, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawText("Uzi", 667, 184, 720, 213, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawImage(513, 221, 240, 110, "Img/28.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(509, 425, 256, 128, "Img/24.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Trafico", 548, 151, 824, 181, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Fechar", 650, 564, 86, 31, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("✖", x*903, y*219, x*918, y*234, tocolor(255, 255, 255, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) end function onClientClick(button, state) if isEventHandlerAdded("onClientRender", root, onClientRender) and isEventHandlerAdded("onClientClick", root, onClientClick) then if button == "left" and state == "up" then elseif isMouseInPosition(650, 564, 86, 31) then showCursor(false) removeEventHandler("onClientRender", root, onClientRender) removeEventHandler("onClientClick", root, onClientClick) end end function lojaAbrir () if not isEventHandlerAdded("onClientRender", root, onClientRender) and not isEventHandlerAdded("onClientClick", root, onClientClick) then showCursor(true) addEventHandler("onClientRender", root, onClientRender) addEventHandler("onClientClick", root, onClientClick) end end addEvent("lojaArma", true) addEventHandler("lojaArma", resourceRoot, lojaAbrir) function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end end