ertlflorian1 Posted March 4, 2013 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:
Castillo Posted March 4, 2013 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Jaysds1 Posted March 4, 2013 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 My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Castillo Posted March 4, 2013 Posted March 4, 2013 First argument of triggerServerEvent is the event name. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted March 5, 2013 Posted March 5, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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