Raised This Month: $ Target: $400
 0% 

connect change name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 05-22-2006 , 07:29   connect change name
Reply With Quote #1

is it possible for a plugin to add in a few words at the begining of a user's name when they connect?
something like this...

Mini_Midget Connected...
Mini_Midget is now joining Terrioist (Bla... Can't spell)
Mini_Midget changed named to Sgt. Mini_Midget

and if the user tried to change their name...

Sgt. Mini_Midget changed name to Newbie
Newbie changed name to Sgt. Newbie

i really need this because i'm working on a plugin based on it but can't get the body of the plugin write and keep screwing up...
__________________
It's a mystery.
Mini_Midget is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-22-2006 , 08:53  
Reply With Quote #2



Code:
#include <amxmodx> #include <amxmisc> public client_infochanged(id) {     // this will contain their new or requested name     new szName[33]     get_user_info(id,"name",szName,32)         if(containi(szName,"Sgt.") == -1)     {         // bad coding practice to copy back, but whatever         format(szName,32,"Sgt. %s",szName)         client_cmd(id,"name %s",szName)     } } public client_putinserver(id)     client_infochanged(id)
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 05-23-2006 , 09:11  
Reply With Quote #3

hmm...
doesn't seem to work...
i have no errors with it but in game doesn't work...
__________________
It's a mystery.
Mini_Midget is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-23-2006 , 09:19  
Reply With Quote #4

You must have done something wrong, or something to that effect. The problem might be that it tells them to change their name right when they join.

Instead of

Code:
client_cmd(id,"name %s",szName)

Try

Code:
set_user_info(id,"name",szName)

Or if that doesn't work, try

Code:
client_cmd(id,"setinfo name %s",szName)

EDIT: Also, replace client_putinserver with this:

Code:
public client_putinserver(id)     set_task(20.0,"client_infochanged",id)
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-23-2006 , 11:19  
Reply With Quote #5

Hawk.....instead of
Code:
format(szName,32,"Sgt. %s",szName) client_cmd(id,"name %s",szName)
why not just use
Code:
client_cmd(id,"name ^"Sgt. %s^"",szName)
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-23-2006 , 20:04  
Reply With Quote #6

Quote:
Originally Posted by Suicid3
Hawk.....instead of
Code:
format(szName,32,"Sgt. %s",szName) client_cmd(id,"name %s",szName)
why not just use
Code:
client_cmd(id,"name ^"Sgt. %s^"",szName)
I don't know why I didn't see that, thanks.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 05-24-2006 , 03:39  
Reply With Quote #7

Code:
 client_cmd(id,"setinfo name %s",szName)
the line above doesn't work
but works with
Code:
 set_user_info(id,"name",szName)
but when i use this line, it affects bots aswell and when you change your name, the "Sgt." isn't really part of the name cause it seems like its a pernament thing
eg. in the score board my name is currently "Sgt. Mini_Midget"
and when i want to change my name to a different one
Mini_Midget changed name to Newbie
and now my name is in the scoreboard "Sgt. Newbie"

with Suicid3's line which is
Code:
  client_cmd(id,"name ^"Sgt. %s^"",szName)
it doesn't affect bots and basicly is the opposite of the top one
eg. my name in score board "Sgt. Mini_Midget"
Sgt. Mini_Midget changed name to Newbie
Newbie changed name to Sgt. Newbie

i'm not sure which one i would use but i might go with the
Code:
 set_user_info(id,"name",szName)
just depends how things go i guess
__________________
It's a mystery.
Mini_Midget is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-24-2006 , 08:22  
Reply With Quote #8

I don't understand what's wrong. It looks like it's working fine to me. If you want to check against bots, then just add

Code:
if(is_user_bot(id))      return PLUGIN_CONTINUE
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 16:23.


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