Eth Posted February 25, 2016 Share Posted February 25, 2016 Hello there, so right now I am making a register/login window for my game using mysql , everything is working fine so far but for some reason triggerClientEvent doesn't want to be executed. here is the code: OnPlayerConnect: dbQuery( CheckPlayerAccount,{playerNick}, database_connection, "SELECT `Password`,`ID`,`Banned` FROM `players` WHERE `Username`='"..playerNick.."'") CheckPlayerAccount: function CheckPlayerAccount(qh,Player) local result = dbPoll( qh, 0 ) local thePlayer = getPlayerFromName ( Player ) outputChatBox(Player) outputDebugString("Player Name is "..Player) if(result == true) then triggerClientEvent ( thePlayer, "ShowLoginWindow", thePlayer,true) triggerClientEvent ( thePlayer, "ShowRegisterWindow", thePlayer,true) else triggerClientEvent ( thePlayer, "ShowLoginWindow", thePlayer,true) triggerClientEvent ( thePlayer, "ShowRegisterWindow", thePlayer,true) end end Client Side: function RegisterWindowShow(show) outputDebugString("Dsd") if(show == true) then guiSetVisible(RegisterPanel.Window[0], true) showCursor(true) else guiSetVisible(RegisterPanel.Window[0], false) showCursor(false) end end function LoginWindowShow(show) outputDebugString("Dsd") if(show == true) then guiSetVisible(LoginPanel.Window[0], true) showCursor(true) else guiSetVisible(LoginPanel.Window[0], false) showCursor(false) end end addEvent("ShowLoginWindow",true) addEvent("ShowRegisterWindow",true) addEventHandler("ShowLoginWindow",localPlayer,LoginWindowShow) addEventHandler("ShowRegisterWindow",localPlayer,RegisterWindowShow) now the debugstring shows my name just fine in the server sideso the code should be working, but somehow the debugstring in both ShowLoginWindow and ShowRegisterWindow aren't working, what could be the problem? Link to comment
Bonus Posted February 25, 2016 Share Posted February 25, 2016 try root instead of localPlayer in lines 25 and 26. Link to comment
Eth Posted February 25, 2016 Author Share Posted February 25, 2016 Sadly it did not work Link to comment
Bonus Posted February 25, 2016 Share Posted February 25, 2016 Show me what you did. It should have worked. Link to comment
Eth Posted February 25, 2016 Author Share Posted February 25, 2016 addEventHandler("ShowLoginWindow",root,LoginWindowShow) addEventHandler("ShowRegisterWindow",root,RegisterWindowShow) I changed it like you told me but still it doesn't show up Link to comment
Bonus Posted February 25, 2016 Share Posted February 25, 2016 debugscript doesnt show any errors? Even not in script restart? I don't see any problem here Try to trigger the event one time to all (delete the first thePlayer) to test it. Does it work? Link to comment
Eth Posted February 25, 2016 Author Share Posted February 25, 2016 Yes the debugscript doesn't show any type of erros and even when I try to restart the server. I tried to delete the first thePlayer and it still doesn't work Link to comment
Eth Posted February 25, 2016 Author Share Posted February 25, 2016 lol I finally fixed it, Instead of placing the onplayerconnect on the "onPlayerConnect" handler I put it "onPlayerJoin" lol Link to comment
Bonus Posted February 25, 2016 Share Posted February 25, 2016 Oh sure, I let you try with deleting the first thePlayer, but not the second thePlayer -.-' The player element doesnt exist on connect, so you can't use getPlayerFromName. 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