Raised This Month: $ Target: $400
 0% 

forward for name changes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 09-04-2008 , 10:33   forward for name changes
Reply With Quote #1

i think i have seen a fm forward which is called whenever a player changes his name but unfortunately i cannot remember the exact forward name :S
does anyone now that forward?
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-04-2008 , 10:56   Re: forward for name changes
Reply With Quote #2

FM_ClientUserInfoChanged, but you can use client_infochanged as well
May be you can filter the fm one with infobuffer.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-04-2008 at 10:59.
ConnorMcLeod is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 09-04-2008 , 11:00   Re: forward for name changes
Reply With Quote #3

This is the closest you're going to get:
PHP Code:
#include <amxmodx>

public client_infochangedid )
{
    static 
old_name[32]
    static 
new_name[32]

    
get_user_infoid "name" old_name 31 )
    
get_user_nameid new_name 31 )

    if( !
equalold_name new_name ) )
    {
        
// player has changed name
    
}

I forget which one is old and which one is new. Doesn't matter anyway.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-04-2008 , 11:19   Re: forward for name changes
Reply With Quote #4

@v3x

Code:
new new_name[32], old_name[32]; get_user_info(index, "name", new_name, sizeof(new_name) - 1); get_user_name(index, old_name, sizeof(oldname) - 1);

The forward is called before the player's name is changed, so the player's current name is still the same.
However, the player has entered the name into their info (name "Exolent") but it hasn't changed their name, yet.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 09-04-2008 , 12:02   Re: forward for name changes
Reply With Quote #5

Best method:
Code:
public SetClientKeyValue( id, infobuffer[], key[], value[] ) {     if ( equal( key, "name" ) && !equal( value,  "New Name" ) )     {         set_user_info( id, "name", "New Name" )         return FMRES_SUPERCEDE     }     return FMRES_IGNORED }
You can catch the change as it's actually happening, also be very careful of set_user_info it's a nice server crasher when issuing to 20+ players at once, it seems ok in above function mind.

Last edited by Orangutanz; 09-04-2008 at 12:08.
Orangutanz is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 09-04-2008 , 12:23   Re: forward for name changes
Reply With Quote #6

He never said he wanted to block it

But that's definitely a better way of doing it.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 09-04-2008 , 12:25   Re: forward for name changes
Reply With Quote #7

It's an example, he can surely work out how to catch the name from that
Orangutanz is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 09-04-2008 , 16:39   Re: forward for name changes
Reply With Quote #8

Quote:
Originally Posted by Orangutanz View Post
It's an example, he can surely work out how to catch the name from that
ofc i can thats exactly the forward i saw sometime ago!
thx to everyone, karma++ orangutanz
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
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 03:18.


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