PDA

View Full Version : players_name_fix


RollinDeath
03-22-2009, 10:05 PM
This plug in was made to help the community who do not understand console or do not have enough experience with cfg files to make changes easily.

0.7.2 version
CVAR
name_menu 1 = on 0 = off

/* Plugin generated by AMXX-Studio


Description :

This plug providers people with the default name "Player" a menu to fix their name.
If "Player" accepts the name change option then they simply type the new name without using console
If "Player" declines the offer then their name is changed to their STEAM ID.
You may also type /name in either team chat or public chat and change your name without console


CREDIT:

Based on Client help 1.0 by Dr.G - www.clan-go.net

CHANGELOG:

3-21-09
Replaced the HTML for messagemodes
Added Menu Options

3-22-09
Steam ID used when declined
Some messages are adjusted and changed
Added Cleint spawn check
Added messages on accept
Added message on declined
removed join server
removed join team

3-24-09
Fixed p-on Thanks to Dr.G - www.clan-go.net

TO DO:
Selecting 8 and not entering data changes "Player" name to "empty" unless esc is used


BUGS:

*/

Dr.G
03-23-2009, 04:42 PM
gj! the code looks way better then the first one you posted in the request thread :)

Some things wont work as the code looks now e.g:

public NameHelp(id)
{
if(get_pcvar_num(p_on))
client_cmd(id,"messagemode name;")
set_hudmessage(0, 255, 255, 0.02, 0.10, 0, 6.0, 12.0)
show_hudmessage(id, "Type your name NOW!!!! ")

return PLUGIN_HANDLED
}

The only thing that will happen if p_on isnt positiv is that it will show the HUD message when ppl say /name. Like this it will do nothing:

public NameHelp(id)
{
if(get_pcvar_num(p_on))
{
client_cmd(id,"messagemode name;")
set_hudmessage(0, 255, 255, 0.02, 0.10, 0, 6.0, 12.0)
show_hudmessage(id, "Type your name NOW!!!! ")
}
return PLUGIN_HANDLED
}

But its a simple thing.. You can leave out the branches if you only had this eg:

public NameHelp(id)
{
if(get_pcvar_num(p_on))
client_cmd(id,"messagemode name;")
}

Its always best to leave out the branches if possible the function above could also look like this and still be working:

public NameHelp(id)
if(get_pcvar_num(p_on))
client_cmd(id,"messagemode name;")
but branches will make the code a bit more easy to read for others. I always wrap functions with { }.....

Also public dod_client_spawn(id) will happen even if name_menu is 0, so maybe you should make an overall on/off function.. Idk if that dod_client_spawn forward is still buggy, i would use hamsandwich see the tutorial forum for how to catch it with ham..

RollinDeath
03-24-2009, 09:09 PM
Thank you Dr. G,

Okay I fixed the /name but I wanted to keep the text to make sure people notice they should be typing a name. I have not tested this version yet but I will soon after my server uploads this evening. I will also see if I understand the HAM stuff and do some testing as well before my next post.