Raised This Month: $ Target: $400
 0% 

Find players name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 01-09-2006 , 08:10   Find players name
Reply With Quote #1

Ok...heres what im doing:

Making a plugin that changes anyones name that is "Player" by default, it will change it to something else.

I just need to know how to find if they persons name is player...other than that, I am almost done with this plugin...I am hoping to make it for all mods because i keep playing in DOD and CS servers that ask people with the name "Player" to change their name.

Please and Thank you.
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Sandurr
Senior Member
Join Date: Aug 2005
Old 01-09-2006 , 08:22  
Reply With Quote #2

Code:
public client_putinserver(id) {      new name[32]      get_user_name(id,name,sizeof(name))      if(equali(name,"Player")) {           new newname[32]           format(newname,31,"ChangeName")           set_user_info(id,"name",newname)      }      return PLUGIN_HANDLED } public client_infochanged(id) {      new name[32]      get_user_name(id,name,sizeof(name))      if(equali(name,"Player")) {           new newname[32]           format(newname,31,"ChangeName")           set_user_info(id,"name",newname)      }      return PLUGIN_HANDLED }
Sandurr is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 01-09-2006 , 09:27  
Reply With Quote #3

Alternately, stop reinventing the wheel and use something like Restrict Names since it has the ability to do exactly what you're trying to do.
Brad is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 01-09-2006 , 11:09  
Reply With Quote #4

Well brad...you could just tell me nicely that it has already been made...

Thanks...i was hoping that i would be the first to make it.
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-09-2006 , 16:42  
Reply With Quote #5

Sandurr, sizeof(name) will return 32. Putting 32 digits into a 32 sized array doesn't save space for the string terminator. sizeof(name)-1 would be correct.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
sodiumchloride91
Junior Member
Join Date: Dec 2005
Location: Malaysia
Old 01-09-2006 , 18:35   Ermm...
Reply With Quote #6

Ermm....I havent saw the 'sizeof' function before. Where did you found it.
Can't find it in the doc.

So i only make it like this.

Quote:
new name[32]

get_user_name(id, name, 31)
I think that will do just the same, rite?
__________________
Salt Rulez! Sodium Reaction!!
MSN Space --> http://spaces.msn.com/members/sodiumchloride91/
sodiumchloride91 is offline
Send a message via MSN to sodiumchloride91
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-09-2006 , 19:41  
Reply With Quote #7

I don't think sizeof is a native.

Anyway, yes, that would be the same. There isn't much of a point to using sizeof if you already know the size of the array, unless you plan on changing it and don't want to change two numbers at once.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 01-09-2006 , 19:51   Re: Ermm...
Reply With Quote #8

Quote:
Originally Posted by sodiumchloride91
Ermm....I havent saw the 'sizeof' function before. Where did you found it.
It's in the Pawn documentation. I believe it's defined on page 58.
Brad is offline
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 01-09-2006 , 21:41   Re: Ermm...
Reply With Quote #9

Quote:
Originally Posted by sodiumchloride91
Ermm....I havent saw the 'sizeof' function before. Where did you found it.
Can't find it in the doc.

So i only make it like this.

Quote:
new name[32]

get_user_name(id, name, 31)
I think that will do just the same, rite?
Yes, It will function. Unless 32 users come onto the server. Bailopan one day said that It subtracts one.
So the correct way to do this would be.

new name[33];

You would also have to change your get_user_name.

get_user_name(id, name, 32)
Unidentified is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-09-2006 , 22:14  
Reply With Quote #10

The size of the name array has nothing to do with the player count.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 16:13.


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