thxs everyone who helped me out especially Hawk
the plugin works fine now and i added some things but now i've come across a bug in my plugin
when i start a new game, my name is Pte. Mini_Midget
(Pte. means Private) and when I get my first kill in the server, my rank
and name should change to "Cpl. Mini_Midget" but instead it changes to
"Cpl. Pte. Mini_Midget". i change my name and then it resets back to normal "Cpl. Mini_Midget"
btw, when a user connects, i can't get the client_print code to show in game
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Army Ranks"
#define VERSION "0.1"
#define AUTHOR "Mini_Midget"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
}
public client_connect(id)
{
new newName[33]
get_user_info(id,"name",newName,32)
if(containi(newName,"Pte.") == -1)
{
format(newName,32,"Pte. %s",newName)
set_user_info(id,"name",newName)
client_print(id, print_chat, "G'day Private %s", newName)
}
}
public client_infochanged(id)
{
new newName[33]
get_user_info(id,"name",newName,32)
if(get_user_frags(id) >= 1 && containi(newName,"Cpl.") == -1)
{
format(newName,32,"Cpl. %s",newName)
set_user_info(id,"name",newName)
client_print(id, print_chat, "Congratulations Private! You are now promoted to Corporal!")
}
}
public client_putinserver(id)
set_task(20.0,"client_infochanged",id)
i forgot to credit hawk for doing the part when a user connects and he changes his name
http://forums.alliedmods.net/showthread.php?t=28761
__________________