Raised This Month: $ Target: $400
 0% 

Catch name changes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SomeonE
New Member
Join Date: Jun 2004
Location: sweden
Old 06-16-2004 , 08:49   Catch name changes
Reply With Quote #1

How can i catch name changes? I tried with: public client_infochanged(id)
but then the name is already changed. And i also tried with: register_clcmd("name"... and then nothing happen.

The thing i want to do is if some one tries to change name to something i dont want him to change to, then will i just change it to something else. How can i do it?
SomeonE is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 06-16-2004 , 08:51  
Reply With Quote #2

I'm not entirely clear either how this works, but for WWW REg I hooked client_infochanged:

Code:
public client_infochanged(id) {     //if (regged(id))         //addregisteredaccess(id)     if (is_user_bot(id) || is_user_connecting(id))         return PLUGIN_CONTINUE     /*     new buffer[128]     get_info_keybuffer(id, buffer, 127)     client_print(0, print_chat, "ic %d:%s", id, buffer)     server_print("ic %d:%s", id, buffer)     */     new newname[32] // oldname[32],     //get_user_name(id, oldname, 31)     get_user_info(id, "name", newname, 31)     new prepend[32]     get_cvar_string(CVAR_PREPEND, prepend, 31)     new const PREPENDLENGTH = strlen(prepend)     if (PREPENDLENGTH > 0 && !regged(id)) { // if prepend cvar is empty, don't bother doing this!         // Force prefix on unregistered players         if (!equal(prepend, newname, PREPENDLENGTH)) {             server_print("[%s] Forcing Pub: name on %s", PLUGINNAME, newname)             new regurl[64]             get_cvar_string(CVAR_REGURL, regurl, 63)             client_print(id, print_console, "Because you aren't registered at %s you must use the prefix ^"%s^".", regurl, prepend)             format(newname, 31, "%s%s", prepend, newname)             //entity_set_string(idd[0], EV_SZ_netname, name)             set_user_info(id, "name", newname)             return PLUGIN_HANDLED         }     }     else if (regged(id)) {         // Regged here         if (!equal(newname, g_forumnames[id])) {             server_print("[%s] Forcing forum name (%s) on %s", PLUGINNAME, g_forumnames[id], newname)             client_print(id, print_console, "Sorry, you must use your name (%s) from forums!", g_forumnames[id], newname)             set_user_info(id, "name", g_forumnames[id]) // Force forum name             return PLUGIN_HANDLED         }     }     //new idd[1]     //idd[0] = id     //set_task(0.1, "checkname", 0, idd, 1)     return PLUGIN_CONTINUE }
Johnny got his gun is offline
SomeonE
New Member
Join Date: Jun 2004
Location: sweden
Old 06-16-2004 , 09:25  
Reply With Quote #3

ok, ill test it. thx.
SomeonE is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 06-16-2004 , 14:08  
Reply With Quote #4

how it works: client cvars like name and model have the CVAR_USERINFO flag.

Code:
#define	FCVAR_USERINFO		(1<<1)	// changes the client's info string
(HLSDK: common/cvardef.h)

When such a cvar changes, the clients info string is changed, and the client_infochanged function in plugins is called
__________________
hello, i am pm
PM is offline
Reply


Thread Tools
Display Modes

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 14:53.


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