Raised This Month: $ Target: $400
 0% 

Help with plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smarttowers
Junior Member
Join Date: May 2005
Old 05-10-2005 , 20:04   Help with plugin
Reply With Quote #1

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
}
smarttowers is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 05-10-2005 , 20:35  
Reply With Quote #2

Code:
   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 }

Remove the return PLUGIN_CONTINUE and remove the // from in front of return PLUGIN_HANDLED.
__________________
twistedeuphoria is offline
RAW_OmarBKhatab
Member
Join Date: Mar 2004
Location: USA
Old 05-10-2005 , 22:46  
Reply With Quote #3

Quote:
Originally Posted by twistedeuphoria
Code:
   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 }

Remove the return PLUGIN_CONTINUE and remove the // from in front of return PLUGIN_HANDLED.
Thank you but this does not fix the problem. I had return PLUGIN_HANDLED before, got the same error as mentioned above. Then I replaced return PLUGIN_HANDLED with return PLUGIN_CONTINUE and still get the same error.

In both case, plugin does work, but, keep giving error messgae "unknow command".
__________________
RAW_OmarBKhatab 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:38.


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