Avir14 Posted December 3, 2021 Share Posted December 3, 2021 i don't know what to do --Client GUIEditor = { label = {}, window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(746, 409, 429, 418, "", false) guiWindowSetSizable(GUIEditor.window[1], false) label = guiCreateLabel(128, 186, 188, 111, "TEXT", false, GUIEditor.window[1]) end ) function aapp () local tee = guiSetText ( label , "On" ) triggerServerEvent("Me",localPlayer) end addEventHandler ( "onClientRender", root, aapp ) --Server addEvent("Me",true) addEventHandler("Me",root, function (tee) if (getServerConfigSetting( "bullet_sync" ) == "1" ) then tee end end ) -- Debugscript ERROR: Loading script failed: TestScript server.lua:6: '=' expected near 'end' ERROR: Client (unle) triggered serverside event Me, but event is not added serverside Link to comment
The_GTA Posted December 3, 2021 Share Posted December 3, 2021 Hello AmirHzz, glad to see you ask for support on our MTA scripting forums! I would like to know more about yourself in order to give you proper support. Do you know Lua scripting and how much experience would you say you have in programming in general? Did you create the script that you have posted just now? If not then who has helped you create it? Are you willing to improve your Lua skills? Link to comment
Avir14 Posted December 3, 2021 Author Share Posted December 3, 2021 Thank you, - Yes I know about lua scripting , I think I have 1 year experience in programming in general - Yes I created it Two days ago and it tryed to fix it but I Failed, no one helped me. - Yes of course Link to comment
The_GTA Posted December 3, 2021 Share Posted December 3, 2021 OK. Then let me try to help you by asking you about this faulty code excerpt. It has been pointed at by the error message so it should be no suprise to you. By having one year of experience you should be able to formulate some basic ideas. if (getServerConfigSetting( "bullet_sync" ) == "1" ) then tee end What did you mean by these code lines? Especially, what is the reason behind putting the "tee" specifier into your code which is a parameter of the event handler? 1 Link to comment
Avir14 Posted December 4, 2021 Author Share Posted December 4, 2021 1 hour ago, The_GTA said: OK. Then let me try to help you by asking you about this faulty code excerpt. It has been pointed at by the error message so it should be no suprise to you. By having one year of experience you should be able to formulate some basic ideas. if (getServerConfigSetting( "bullet_sync" ) == "1" ) then tee end What did you mean by these code lines? Especially, what is the reason behind putting the "tee" specifier into your code which is a parameter of the event handler? I know it's wrong I tried to do everything but nothing work I think that will call : » local tee = guiSetText ( label , "On" ) Link to comment
The_GTA Posted December 4, 2021 Share Posted December 4, 2021 (edited) 11 minutes ago, AmirHzz said: I think that will call : » local tee = guiSetText ( label , "On" ) It does not because one part of the resource is on the server-side and another on the client-side. In such a scenario where you want to call client-side code from the server-side you need to trigger another client-side event. It looks like you just want the player to know whether his bullet setting is enabled. -- CLIENTSIDE addEvent("onClientReportBulletSetting", true) addEventHandler("onClientReportBulletSetting", root, function(is_on) if (is_on) then guiSetText ( label , "On" ) end end ); -- SERVERSIDE ... if (getServerConfigSetting( "bullet_sync" ) == "1" ) then triggerClientEvent(client, "onClientReportBulletSetting", true) end Also triggering server-events each frame from each connected client is effectively self-DDoSing your server. Here: function aapp () local tee = guiSetText ( label , "On" ) triggerServerEvent("Me",localPlayer) -- DDOS end addEventHandler ( "onClientRender", root, aapp ) -- WTF? called each game frame Edited December 4, 2021 by The_GTA 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