Jump to content

Problem with loginssystem


Recommended Posts

Posted

I have a problem when I start the gamemode (selfmade) and connect to the server to Register panel come, and I get this error:

triggerpro.png

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:

gametyp.png

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (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 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/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

First argument of triggerServerEvent is the event name.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...