yoyo2021 Posted October 23, 2021 Share Posted October 23, 2021 (edited) 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 Quote client side 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) Quote server side 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 Edited October 23, 2021 by yoyo2021 Link to comment
Moderators IIYAMA Posted October 23, 2021 Moderators Share Posted October 23, 2021 2 hours ago, yoyo2021 said: Client triggered server side event, but event is not added servers Make sure that clientside and serverside are separate files Make sure that serverside is defined as a serverside file in the meta.xml Make sure that the serverside file does actually run. (Add outputChatbox/iprint/print/outputDebugString on the first line of the file and see if it is displaying something, the text output doesn't matter as long as you recognize it) 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