Raised This Month: $ Target: $400
 0% 

forcename bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EXEQEDat
Junior Member
Join Date: Apr 2011
Old 04-27-2011 , 10:49   forcename bug
Reply With Quote #1

*code removed*

Last edited by EXEQEDat; 04-29-2011 at 12:42.
EXEQEDat is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-27-2011 , 11:10   Re: forcename bug
Reply With Quote #2

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);
    }

__________________


Last edited by SonicSonedit; 04-27-2011 at 15:21.
SonicSonedit is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 04-27-2011 , 15:16   Re: forcename bug
Reply With Quote #3

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

Last edited by Hunter-Digital; 04-27-2011 at 15:20.
Hunter-Digital is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-27-2011 , 15:21   Re: forcename bug
Reply With Quote #4

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


Last edited by SonicSonedit; 04-27-2011 at 15:24.
SonicSonedit is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 04-27-2011 , 15:27   Re: forcename bug
Reply With Quote #5

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.
__________________
Hunter-Digital is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-27-2011 , 15:35   Re: forcename bug
Reply With Quote #6

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

SonicSonedit is offline
EXEQEDat
Junior Member
Join Date: Apr 2011
Old 04-27-2011 , 16:40   Re: forcename bug
Reply With Quote #7

Quote:
Originally Posted by SonicSonedit View Post
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>
EXEQEDat is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-27-2011 , 18:35   Re: forcename bug
Reply With Quote #8

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.
__________________
fysiks is offline
EXEQEDat
Junior Member
Join Date: Apr 2011
Old 04-27-2011 , 18:40   Re: forcename bug
Reply With Quote #9

remember please :p
EXEQEDat is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-27-2011 , 20:49   Re: forcename bug
Reply With Quote #10

Quote:
Originally Posted by EXEQEDat View Post
remember please :p
I was wrong about the person I wrote it for. Here it is:
http://forums.alliedmods.net/showthread.php?t=128498
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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