elian sweed Posted March 22, 2020 Share Posted March 22, 2020 hey guys i want help i need to do if player button then start shader resource this is my script --scripted by eliansweed local key = "F5" bindKey(key, "down",function() guiSetVisible(GUIEditor.window[1],not guiGetVisible(GUIEditor.window[1]) ) showCursor(guiGetVisible(GUIEditor.window[1]) ) end) GUIEditor = { button = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(558, 236, 553, 422, "Resource start by eliansweed", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFF0000") guiSetVisible(GUIEditor.window[1],false) GUIEditor.label[1] = guiCreateLabel(22, 39, 212, 51, "water shader", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.button[1] = guiCreateButton(252, 41, 65, 27, "start", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF32FA04") GUIEditor.button[2] = guiCreateButton(360, 41, 65, 27, "stop", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFD0000") end ) function start() if source == GUIEditor.button[1] then --what i type here to start the mod ? outputChatBox ( "water shader was been startred",255,0,0 ) end end addEventHandler("onClientGUIClick", root , start) Link to comment
The_GTA Posted March 22, 2020 Share Posted March 22, 2020 Hello elian sweed, in order to start the shader resource from your GUI resource you need to change the ACL security configuration of your MTA server as well as adjust your resource into a clientside and serverside component: 1) Did you know about the ACL.xml file inside of your MTA server? Since the startResource function is privileged you need to give your resource the right to use it. As an easy solution you could add the resource to the "Admin" ACL group. 2) The script you posted above is a clientside GUI script. You cannot call serverside resource functions inside of it. What you have to do is create a server.Lua file and start the resource from there. I recommend using the getResourceFromName function in combination with the startResource function. If you have any further questions like about the implementation or the security-critical aspects then feel free to ask. - Martin Link to comment
elian sweed Posted March 22, 2020 Author Share Posted March 22, 2020 (edited) Hi Busta I mean the player trun on this mod in gui and he can only trun it on for himself only not to all (to fix lag) Edited March 22, 2020 by elian sweed Link to comment
The_GTA Posted March 22, 2020 Share Posted March 22, 2020 (edited) 5 minutes ago, elian sweed said: Hi Busta I mean the player trun on this mod in gui and he can only trun it on for himself only not to all (to fix lag) Then you have to look into the source code of the shader resource to find an on-or-off switch. Considering that you have not even shared the name of the resource yet alone the content... Edited March 22, 2020 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