Ok, the plugin seems to work fine only oddity is that when a admin is alive and calls amx_admin_icon 1.
When called it returns:
Quote:
|
[RAWCS] ADMIN Icon will be displayed above your head to team members!Unknown command: amx_admin_icon
|
Could someone let me know what is wrong with this?
Thanks,
Tom
Code:
/*
Plugin to identify admin with a sprite over their heads. Much of this code is inspired from the warcraft3 mod written by SpaceDude,
maintained by DopeFish and currently Ferret.
Updated: added Server side CVR:
amx_set_adminicons 1 : enables admin icons, default on
amx_set_adminicons 0 : disables admin icons
*/
#include <amxmodx>
#include <amxmisc>
#pragma tabsize 0
#define TE_PLAYERATTACHMENT 124
//Change the MODEL_LOCATION[] to the location of the sprite.
new MODEL_LOCATION[] = "sprites/admin.spr"
//Change the HEIGHT_ABOVE_MODEL to the distance above the model you want the sprite to appear.
new HEIGHT_ABOVE_MODEL = 70
new PLUGIN[]="Admin Icons"
new AUTHOR[]="Target"
new VERSION[]=".90"
new adminList[33]
new adminSprite
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_admin_icon","admin_icon",ADMIN_KICK,"Turn on(1)/off(0) admin icons.")
register_cvar("amx_set_adminicons","1")
register_event("StatusValue","show_admin","be")
return PLUGIN_CONTINUE
}
public admin_icon(id, level, cid){
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
if (get_cvar_num("amx_set_adminicons") == 0){
client_print(id,print_console,"[RAWCS]Admin Icons are OFF")
return PLUGIN_HANDLED
}
new arg[1]
read_argv(1, arg, 1)
adminList[id] = str_to_num(arg)
if(adminList[id]){
client_print(id, print_console, "[RAWCS]ADMIN Icon will be displayed above your head to team members!")
}else{
client_print(id, print_console, "[RAWCS]ADMIN Icon will not be displayed above your head!")
}
return PLUGIN_CONTINUE
// return PLUGIN_HANDLED
}
public show_admin(id){
if (get_cvar_num("amx_set_adminicons") == 0){
return PLUGIN_HANDLED
}
new tid = read_data(2)
if(get_user_team(id) != get_user_team(tid) || !adminList[tid])
return PLUGIN_HANDLED
message_begin( MSG_ONE, SVC_TEMPENTITY, { 0, 0, 0 }, id )
write_byte( TE_PLAYERATTACHMENT )
write_byte(tid)
write_coord(HEIGHT_ABOVE_MODEL)
write_short(adminSprite)
write_short(10)
message_end()
return PLUGIN_HANDLED
}
public client_putinserver(id){
if (get_cvar_num("amx_set_adminicons")) {
if(access(id, ADMIN_KICK))
adminList[id] = 1
}
return PLUGIN_HANDLED
}
public client_disconnect(id){
if(adminList[id])
adminList[id] = 0
return PLUGIN_HANDLED
}
public plugin_precache(){
adminSprite = precache_model(MODEL_LOCATION)
return PLUGIN_CONTINUE
}