Jump to content

login panel dissapear :(


Recommended Posts

Posted (edited)

Hey guys,i made a login/register panel and the problem is when 2 players connect, either one of them cant see the panel or sometimes, both cant see the panel, but when they dont connect at the same time, they can see it :( Everythin works fine with the registration and login. The only problem is that it dissapears when 2 players try to connect to server :/

heres the client side code :

  
  

The server side contains only the check for username and password .

Help me plz. Thank you for your time.

Edited by Guest
Posted
Show the code that triggers the event: "hideWindow".

The only reason why this happens is basically the fact that the triggering is wrong, it is triggered on player join/etc, and it makes it close for the rest of players.

Just remember to make the player source of the event hideWindow.

  
function hidetheWindow() 
if source ~= getLocalPlayer() then return end 
    guiSetInputEnabled(false) 
    showCursor(false) 
    guiSetVisible(darkpic, false) 
    
end 
  
addEvent("hideWindow", true) 
addEventHandler("hideWindow", root, hidetheWindow) 

Posted

No point in triggering it to all and then check if the source isn't the local player, he can simply specify in triggerClientEvent to who to trigger.

Posted
No point in triggering it to all and then check if the source isn't the local player, he can simply specify in triggerClientEvent to who to trigger.

Its just an extra check, sometimes usefull. (if you call it by mistake for example).

Posted (edited)

ok, heres the code, the serverside :


BTW, thnks for the help guys, but understandin everythin wat wiki says is kinda hard for me :( but i always try my best.

After makin postman,bus and taxi job, i decided to make the login panel, but i got this problem :/

Edited by Guest
Posted
triggerClientEvent("hideWindow", thePlayer) 

There's your problem, you are triggering the event for everyone.

Change it to this:

triggerClientEvent ( thePlayer, "hideWindow", thePlayer ) 

Posted

:o but omg

if i had done it this way like : triggerClientEvent("hideWindow",thePlayer,thePlayer) -- im using the second thePlayer as argument to send to the hideWindow event

then i use thePlayer as argument for the hideWindow event in the clientside, will it work?? bekoz thats wat i normally do for all my jobs :o

Thnks for ur help man :)

Posted

I don't really get what you mean.

You send the player element and compare it to the local player? that can also work, but I'm not sure if it's efficient.

Posted

yea thats wat i mean :D

i send the player element as argument to the clientside and compare it, but if u sayin that u not sure if its efficient, i will start using triggerClientEvent the way u showed me.Thnk u very much bro :) U helped me a lot

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...