=KoG=Rouche Posted October 31, 2013 Share Posted October 31, 2013 (edited) Hi all i'm =KoG=Rouche owner of Team =KoG= (http://www.teamkog.eu). I'm learning LUA scripting and i need your help for a script. I'm trying to create a panel which can redirect player if they want. Here is the screenshot of the panel : Problem - redirectPlayer don't work and return a nil value in test "returnVar", must be True or False. Debugging Report : Clientside -- Event when the ressource start addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), function() function createWindow() -- Press key F1 to open Server Changer Panel bindKey("F1","down",function() if(windowServChanger ~= nil) then guiSetVisible(windowServChanger,true) guiWindowSetMovable(windowServChanger,false) guiWindowSetSizable(windowServChanger,false) guiSetAlpha(windowServChanger,1.0) else outputChatBox("There is a bug with the Panel !") end -- Mouse Cursor ON showCursor(true) end ) function clientChangeServ(button,state) if button == "left" and state == "up" then outputChatBox("Test Avant Trigger") triggerServerEvent("onRedirect",localPlayer) outputChatBox("Test Après Trigger") end end function clientCancel(button,state) if button == "left" and state == "up" then guiSetVisible(windowServChanger,false) showCursor(false) end end windowServChanger = guiCreateWindow(0.43,0.40,0.14,0.10,"| =KoG= Server Changer v1.0 |",true) btnOldServ = guiCreateButton(0.25,0.30,0.50,0.40,"Old Maps Server",true,windowServChanger) btnCancel = guiCreateButton(0.85,0.70,0.10,0.25,"X",true,windowServChanger) guiSetVisible(windowServChanger,false) outputChatBox("Window OK") -- Add Event on Button Click addEventHandler("onClientGUIClick",btnOldServ,clientChangeServ,false) addEventHandler("onClientGUIClick",btnCancel,clientCancel,false) outputChatBox("After addEventHandler") end -- GUI Creation createWindow() end ) Serverside function redirectHim() outputChatBox("Before Redirect OK"..tostring(source)) local returnVar = redirectPlayer(source,"5.39.92.100",22010) -- It's for test outputChatBox("After Redirect OK"..tostring(source)) outputChatBox(tostring(returnVar)) -- Must be false / true outputChatBox(getPlayerName(source)) -- Nickname end addEvent("onRedirect",true) addEventHandler("onRedirect",root,redirectHim) meta Edited November 1, 2013 by Guest Link to comment
Castillo Posted October 31, 2013 Share Posted October 31, 2013 You're sure that the IP and port are the correct ones? Link to comment
=KoG=Rouche Posted November 1, 2013 Author Share Posted November 1, 2013 Yes IP and Port are Correct ! You can check in MTA Link to comment
Castillo Posted November 1, 2013 Share Posted November 1, 2013 Hold on, did you give permission in the ACL to the resource? as far as I know, it needs it. Link to comment
=KoG=Rouche Posted November 1, 2013 Author Share Posted November 1, 2013 Not yet ! Admin group ? Link to comment
Castillo Posted November 1, 2013 Share Posted November 1, 2013 Yes, try adding it there. Link to comment
=KoG=Rouche Posted November 1, 2013 Author Share Posted November 1, 2013 By adding Script to Admin group it works. Thanks 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