ertlflorian1 Posted March 4, 2013 Share Posted March 4, 2013 I have a problem when I start the gamemode (selfmade) and connect to the server to Register panel come, and I get this error: When I reconnect then it works perfect and i get no error??? Client : function registerfunc (name) Fenster = guiCreateWindow(screenx/2-registerw/2,screeny/2-registerh/2, registerw, registerh, "Herzlich Willkommen", false) guiWindowSetSizable(Fenster, false) usw.. end addEvent ("onGuiRegister", true) addEventHandler ("onGuiRegister", getRootElement(), registerfunc) Server: function selfOnCon () local name = getPlayerName (source) local player = getPlayerFromName (name) local ip = getPlayerIP (source) local serial = getPlayerSerial (source) if (ifnameexists(name) == true) then triggerClientEvent (source, "onGuiLogin", source,name) elseif (ifnameexists(name) == false) then if (ifserialexists(serial) == false) then triggerClientEvent (source, "onGuiRegister", source,name) else kickPlayer (player, "Console", "Du hast bereits einen Account!") end end end addEventHandler ("onPlayerJoin", getRootElement(), selfOnCon) I also get this error on every Gamemode start: Link to comment
Castillo Posted March 4, 2013 Share Posted March 4, 2013 That error appears because the client side is not yet loaded for when the player joins. Do this: on the client side, create a function which will be executed with the event: "onClientResourceStart", then trigger a server side event, which will do your check. Link to comment
Jaysds1 Posted March 4, 2013 Share Posted March 4, 2013 (edited) That error appears because the client side is not yet loaded for when the player joins.Do this: on the client side, create a function which will be executed with the event: "onClientResourceStart", then trigger a server side event, which will do your check. example: Client: addEventHandler("onClientResourceStart",resourceRoot,function() triggerServerEvent("onResourceLoaded",localPlayer) end) Server: addEvent("onResourceLoaded",true) addEventHandler("onResourceLoaded",root,etc) Edited March 4, 2013 by Guest Link to comment
Castillo Posted March 4, 2013 Share Posted March 4, 2013 First argument of triggerServerEvent is the event name. Link to comment
ertlflorian1 Posted March 5, 2013 Author Share Posted March 5, 2013 Thank you i will try it later 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