|
Veteran Member
Join Date: Nov 2004
Location: CA USA
|

01-15-2012
, 01:00
[REQ$] plugin edit for namehelper
|
#1
|
can someone please edit this plugin so the menu does not pop up. I just want the player to have to say "/name" in chat and then have the ability to change their name by typing it in.
It still needs to show the players current name and then it should only say, to change your name, type it now and hit enter. Then it should say, your name has been changed to whatever their new name is. I think it already has support for names with spaces, but if not, then can you add that.
Thanks.
Code:
#include <amxmodx>
#include <hamsandwich>
#define TID_AUTO_NH_MENU 95823
new g_nh_setinfo_key[] = "dod_nh"
new bool:g_in_menu[33]
new bool:g_is_human[33]
new g_p_name[33][32]
new bool:g_changing_now[33]
public plugin_init(){
register_plugin("DoD NameHelper", "1.1", "Sylwester")
register_menucmd(register_menuid("\y[DoD NameHelper]^n"), 1023, "nh_menu_handler")
register_clcmd("say", "handle_say")
register_clcmd("say_team", "handle_say")
register_message(get_user_msgid("TextMsg"), "class_selected")
RegisterHam(Ham_Killed, "player", "Player_Killed")
}
public class_selected(msg_id, msg_dest, msg_entity){
static tmp[32]
if(!g_is_human[msg_entity] || get_msg_args() < 3)
return
get_msg_arg_string(2, tmp, 31)
if(equal(tmp, "#game_spawn_as")){
set_task(0.1, "auto_menu", TID_AUTO_NH_MENU+msg_entity)
}
}
public Player_Killed(id){
if(!g_changing_now[id])
return
g_changing_now[id] = false
nh_menu(id)
}
public handle_say(id){
static args[31]
read_args(args, 30)
remove_quotes(args)
if(equali(args, "/name")||equali(args, "!name")){
get_user_name(id, g_p_name[id], 31)
set_user_info(id, g_nh_setinfo_key, "")
nh_menu(id)
}else if(g_in_menu[id] && g_changing_now[id]){
g_changing_now[id] = false
set_user_info(id, "name", args)
}
}
public client_putinserver(id){
if(is_user_bot(id) || is_user_hltv(id))
return
g_is_human[id] = true
}
public client_disconnect(id){
g_is_human[id] = false
g_in_menu[id] = false
g_changing_now[id] = false
}
public auto_menu(tid){
static id, tmp[5]
id = tid-TID_AUTO_NH_MENU
get_user_name(id, g_p_name[id], 31)
get_user_info(id, g_nh_setinfo_key, tmp, 4)
if(strlen(tmp)<=0){
nh_menu(id)
}
}
public client_infochanged(id){
static name[32]
if(!g_in_menu[id])
return
get_user_info(id, "name", name, 30)
if(!equal(name, g_p_name[id])){
format(g_p_name[id], 30, name)
nh_menu(id)
}
}
public nh_menu(id){
static cache[512], pos
g_in_menu[id] = true
pos = format(cache, 511, "\y[DoD NameHelper]^n")
pos += format(cache[pos], 511, "Your name is: \w%s^n^n", g_p_name[id])
if(g_changing_now[id]){
pos += format(cache[pos], 511, "\yOpen chat to change your name!^n")
show_menu(id, 1023, cache, -1)
return
}
pos += format(cache[pos], 511, "\yDo you want to change your name?^n")
pos += format(cache[pos], 511, "^n\w1. Yes, Now! (you must be alive)^n")
pos += format(cache[pos], 511, "2. Exit menu^n^n")
pos += format(cache[pos], 511, "0. Don't show this menu again^n")
show_menu(id, 515, cache, -1)
}
public nh_menu_handler(id, key){
if(g_changing_now[id]){
g_changing_now[id] = false
nh_menu(id)
return PLUGIN_HANDLED
}
g_in_menu[id] = false
switch(key){
case 0: {
if(!is_user_alive(id)){
client_print(id, print_chat, "[DoD NameHelper]You must be alive to use this option!")
nh_menu(id)
return PLUGIN_HANDLED
}
client_cmd(id, "messagemode")
g_changing_now[id] = true
nh_menu(id)
}
case 9: client_cmd(id, "setinfo %s 1", g_nh_setinfo_key)
}
return PLUGIN_HANDLED
}
__________________
{FJ}Justice STEAM_0:0:633975 If anyone needs any help with their server, Just add me to steam friends and I'll help you out.
Last edited by MAUGHOLD; 01-15-2012 at 01:04.
|
|