AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Name on reconnect problems... (https://forums.alliedmods.net/showthread.php?t=9994)

n04d 02-05-2005 17:17

Name on reconnect problems...
 
Alright, I'm working on a system that when somebody joins it adds them to a playerlist I'm drawing with set/show_hudmessage. When they join, etc. it works fine and when they leave it removes their name from the list. But if they are like, reconnecting or something to the server, they don't appear back on the list.

Any ideas?

n04d 02-06-2005 11:29

I am using the replace and format funtion to find their names on the list once they join a different team, and it removes them from the team they were on and adds them to the other team. Not sure if that's a problem though, and it's keeping it from drawing their name the next time they get on.

XxAvalanchexX 02-06-2005 12:50

client_connect is called when they first join the server. client_disconnect is called when they leave the server. client_putinserver is called when the game registers them as in the game and puts their name on the spectator part of the scoreboard. If a user types "retry" in console, I do not believe that connect or disconnect will be called, only putinserver.

n04d 02-06-2005 16:41

I'm calling everything from putinserver, but I still have the problem...

TotalNoobScripter 02-06-2005 17:52

can we see the code?

n04d 02-09-2005 17:46

Yeah, here is where I call the function to add the person to the "Not Ready!" list...

Code:

public client_putinserver(id)
{       
        playerlistNotReady(id)
}

Now, it add's them fine...with this code.

Code:

public playerlistNotReady(id)
{
        get_user_name(id,playername,31)
        if (equal(notready,"None!"))
                format(notready,31,"%s",playername)
        else {
                format(list1,31,"^n%s",playername)
                add(notready,255,list)
        }
        return 1
}

And if they leave the server, they get removed with this code...(Also removes them if they are ready, but either ready or not, it still doesn't work...)

Code:

public playerListRemove(id)
{
        get_user_name(id,playername,31)

        format(list,39,"%s",playername)
                replace(notready,255,list,"None!")

        format(list,39,"^n%s",playername)
                replace(notready,255,list,"")

        format(list,39,"%s^n",playername)
                replace(notready,255,list,"")
}

Which I also use the same removal code for the person if they leave while they are on the "Ready!" list...

I call that whenever they leave the server, so in...

Code:

public client_disconnect(id)
{
        playerListRemove(id)
}


n04d 02-10-2005 17:48

Any ideas?

XxAvalanchexX 02-10-2005 22:41

Code:
public playerlistNotReady(id) {    get_user_name(id,playername,31)    if (equal(notready,"None!"))       // HERE YOU FORMAT IT AS 31?       format(notready,31,"%s",playername)    else {       format(list1,31,"^n%s",playername)       // HERE YOU ADD IT AS 255?       add(notready,255,list)    }    return 1 }

n04d 02-14-2005 20:34

Alright, that all works, thanks :)

Now one more thing, when a player connects, and they change their names, it shows their new name but their old one is just stuck there under "Not Ready" but the playerlist is refreshing...I think I have an idea how to do it, but I would like some input to see if my "theory" is right :)

n04d 02-15-2005 22:09

Well, nevermind. I know how to do it.

But, I'm also working on something so names cannot be changed, but whenever I execute this on a person...

Code:

public client_infochanged(id){
        new old[32]
        new playername[32]
        get_user_info(id,"name",playername,31)
        get_user_name(id,oldname,31)
   
        client_cmd(id,"name %s",oldname)
}

To force the name back, it will keep switching between the old and the new, because they both become old whenever the other one becomes new, so it keeps forcing back and forth.


All times are GMT -4. The time now is 19:18.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.