AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   forcename bug (https://forums.alliedmods.net/showthread.php?t=155856)

EXEQEDat 04-27-2011 10:49

forcename bug
 
*code removed*

SonicSonedit 04-27-2011 11:10

Re: forcename bug
 
Store player-related info like name, password, authid and on player connect and never change it.
PHP Code:

new original_name[33]; // select name
new AuthID[35]; // select steam id

public client_putinserver(id)
{
    
get_user_name(idoriginal_name32);
    
get_user_authid(id,AuthID,34);
}

public 
client_PreThink(id)
{
    if (
pev(idpev_button)&IN_SCORE)
    {
        
set_hudmessage(2552552550.050.906.00.2);
        
// show_hudmessage(id, "Points: %d  Alltime: %d", points[id], loadpoints[id] + points[id]);    
        
new sp loadpoints[id] + points[id];
        
client_cmd(id"name ^"%s<%d>^""original_namesp);
    }



Hunter-Digital 04-27-2011 15:16

Re: forcename bug
 
Name can be changed, so you'll have to place it in client_infochanged().

Btw, what's "client_medvedputinserver" ? O.o

Also, sending a hud message every damn client frame can be costly, server and client... you should add a static array variable of 33 cells and then you can either make it a float array and assign it to get_gametime() and check it by time or use increment values (inaccurate but faster).

SonicSonedit 04-27-2011 15:21

Re: forcename bug
 
Quote:

Name can be changed, so you'll have to place it in client_infochanged().
Well, there is so much trouble with it: when userinfo is changed you have to reset registration and then re-assign it, which can lead to exploits in future. So I stick with ignoring userinfo change.

Quote:

Btw, what's "client_medvedputinserver" ? O.o
That was something like "public client_medvedevputinserver(id)". I don't know why i typed it, brain switched off, lol.

Hunter-Digital 04-27-2011 15:27

Re: forcename bug
 
Oh actually, you're only trying to rename people... so you shouldn't use prethink in the first place, use client_infochanged() and there you get user's "name" setinfo with get_user_info() and then compare it with get_user_name() OR your last stored variable (preferable).

After that you just check your stuff...

Still, holding information in names is tricky and exploitable, unrecommended.

SonicSonedit 04-27-2011 15:35

Re: forcename bug
 
Hunter-Digital
He also wants to show some hud when some button is pressed. But you are right about renaming.

EXEQEDat
Don't rename players on prethink. Rename them on connect or on spawn.

EXEQEDat 04-27-2011 16:40

Re: forcename bug
 
Quote:

Originally Posted by SonicSonedit (Post 1458950)
Store player-related info like name, password, authid and on player connect and never change it.
PHP Code:

new original_name[33]; // select name
new AuthID[35]; // select steam id

public client_putinserver(id)
{
    
get_user_name(idoriginal_name32);
    
get_user_authid(id,AuthID,34);
}

public 
client_PreThink(id)
{
    if (
pev(idpev_button)&IN_SCORE)
    {
        
set_hudmessage(2552552550.050.906.00.2);
        
// show_hudmessage(id, "Points: %d  Alltime: %d", points[id], loadpoints[id] + points[id]);    
        
new sp loadpoints[id] + points[id];
        
client_cmd(id"name ^"%s<%d>^""original_namesp);
    }



i try and not put nick but put points.
on connect:

Code:

* yERERERE:]] changed name to <14707>
and i try change to my nick

Code:

] name yeRERERE:]]
* Privileges set
* <14707> changed name to yeRERERE
* Privileges set
* yeRERERE changed name to <14707>


fysiks 04-27-2011 18:35

Re: forcename bug
 
I wrote a plugin once as a request to put points in the name. I'm thinking it might have been for flamin' but I can't remember atm.

EXEQEDat 04-27-2011 18:40

Re: forcename bug
 
remember please :p

fysiks 04-27-2011 20:49

Re: forcename bug
 
Quote:

Originally Posted by EXEQEDat (Post 1459186)
remember please :p

I was wrong about the person I wrote it for. Here it is:
http://forums.alliedmods.net/showthread.php?t=128498


All times are GMT -4. The time now is 04:23.

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