我是新手 发表于 2011-8-17 12:46:50

(问题没解决)为什么会出来这么多的重复提示信息

本帖最后由 我是新手 于 2011-8-24 18:05 编辑

给急救包插件加上权限,用client_print(id, print_chat, "Sorry,只有成为UIP才能使用急救包" );
输出提示语句,结果出来一堆重复的提示语句。
只想要一行就够了,该如何做? 请达人指教!不胜感激!
见图:
代码重新贴了/*        Copyright ?2009, tuty
Healthkit On Dead Body is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Teleport Destination Angles Editor; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>


/* --| Plugin information */
#define PLUGIN                 "Healthkit on dead body"
#define AUTHOR                 "tuty"
#define VERSION         "3.2b"

/* --| Some plugin defines */
#define MEDKIT_MINSZ         Float:{ -23.160000, -13.660000, -0.050000 }
#define MEDKIT_MAXSZ         Float:{ 11.470000, 12.780000, 6.720000 }
#define MODEL_KIT         "models/w_medkit.mdl"
#define MODEL_KITT         "models/w_medkitt.mdl"
#define SOUND_KIT         "items/smallmedkit1.wav"
#define FFADE_IN         0x0000

/* --| Some globals... */
new gToggleKitEnable;
new gToggleGlowShow;
new gGMsgFade;
new gToggleFadeEnable;
new gToggleRemoveAtRstart;
new gKitHealthCvar;
new gLimitHealthCvar;
new gGMsgItemPickup;

/* --| Medkit classname */
new const gMedKitClassname[] = "medkit_entity";

/* --| Let's start the plugin */
public plugin_init()
{
        /* --| Registering the plugin to show it on plugins list */
        register_plugin( PLUGIN, VERSION, AUTHOR );
       
        /* --| Some usefull events */
        register_event( "DeathMsg","drop_kit","a" );
        register_logevent( "logevent_round_start", 2, "1=Round_Start" );
       
        /* --| Register the touch forward */
        register_touch("medkit_entity","player","touched");
       
        /* --| Cvar list */
        gToggleKitEnable = register_cvar( "kit_enable", "1" );
        gToggleGlowShow = register_cvar( "kit_glow", "1" );
        gToggleFadeEnable = register_cvar( "kit_fade", "1" );
        gToggleRemoveAtRstart = register_cvar( "kit_remove", "1" );
        gKitHealthCvar = register_cvar( "kit_health", "20" );
        gLimitHealthCvar = register_cvar( "kit_limit_health", "100" );
       
        /* --| Let's catch the user message id's */
        gGMsgFade = get_user_msgid( "ScreenFade" );
        gGMsgItemPickup = get_user_msgid( "ItemPickup" );
}

/* --| Precaching stuff */
public plugin_precache()
{
        precache_model( MODEL_KIT );
        precache_model( MODEL_KITT );
        precache_sound( SOUND_KIT );
}

/* --| When player dies, let's drop the kit if plugin is elabled */
public drop_kit()
{
        /* --| Check if plugin is enabled/disabled */
        if( get_pcvar_num( gToggleKitEnable ) == 0 )
        {
                return PLUGIN_HANDLED;
        }       
       
        /* --| Get the victim id */
        new victim = read_data( 2 );
       
        /* --| Get the victim origin */
        static Float:origin[ 3 ];
        pev( victim, pev_origin, origin );
       
        /* --| Creating healthkit entity */
        new ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) );
       
        /* --| Modify the origin a little bit. This is calculated to be set on floor */
        origin[ 2 ] -= 36;
       
        /* --| Setting the ent origin */
        engfunc( EngFunc_SetOrigin, ent, origin );
       
        /* --| Check if isn't a valid ent */
        if( !pev_valid( ent ) )
        {
                return PLUGIN_HANDLED;
        }
       
        /* --| Now let's set the entity model and some stuff */
        set_pev( ent, pev_classname, gMedKitClassname );
        engfunc( EngFunc_SetModel, ent, MODEL_KIT );
        dllfunc( DLLFunc_Spawn, ent );
        set_pev( ent, pev_solid, SOLID_BBOX );
        set_pev( ent, pev_movetype, MOVETYPE_NONE );
        engfunc( EngFunc_SetSize, ent, MEDKIT_MINSZ, MEDKIT_MAXSZ );
        engfunc( EngFunc_DropToFloor, ent );
       
        /* --| If cvar is set to 1, let's glow the entity */
        if( get_pcvar_num( gToggleGlowShow ) == 1 )
        {
                if (get_user_team(victim)==1)
                {
                        fm_set_rendering( ent, kRenderFxGlowShell, 255, 0, 0, kRenderFxNone, 27 );
                        entity_set_int(ent,EV_INT_team,1);
                }
                else if (get_user_team(victim)==2)
                {
                        fm_set_rendering( ent, kRenderFxGlowShell, 0, 0, 255, kRenderFxNone, 27 );
                        entity_set_int(ent,EV_INT_team,2);
                }
        }
       
        return PLUGIN_HANDLED;
}

/* --| Calling the touch forward from fakemeta to see if player touched the entity */
public touched( ent, id )
{
        /* --| Check if is a valid entity and is plugin enabled */
        if( !pev_valid( ent ) || get_pcvar_num( gToggleKitEnable ) == 0 )
        {
                return FMRES_IGNORED;
        }
       
        new ownerTeam = get_user_team(id);
        new whitchTeam = entity_get_int(ent, EV_INT_team);
        if (whitchTeam==ownerTeam)
        {
                return FMRES_IGNORED;
        }
       
        /* --| Find the ent classname */
        new classname[ 32 ];
        pev( ent, pev_classname, classname, charsmax( classname ) );
       
        /* --| Check if isn't our classname */
        if( !equal( classname, gMedKitClassname ) )
        {
                return FMRES_IGNORED;
        }
       
        /* --| Get the user health, and check some cvars */
        new health = get_user_health( id );
        new cvarhealth = get_pcvar_num( gKitHealthCvar );
        new maxhealth = get_pcvar_num( gLimitHealthCvar );
       
        /* --| Check player health */

        if( health >= maxhealth )
        {
                //client_print( id, print_center, "Sorry, your health is %d. You can't take the kit! You must have less then %d to take it.", health, maxhealth );
                return FMRES_IGNORED;
        }

        /* --| Show a red hud message to client */
        //set_hudmessage( 255, 0, 0, -1.0, 0.83, 2, 6.0, 3.0 );
        //show_hudmessage( id, "You received %d HP", cvarhealth );
       
        /* Set the health and show some minor things, for fun */
        if(get_user_flags(id) & read_flags("m") == 0)
        {
        client_print( id, print_center, "Sorry,只有成为UIP才能使用急救包" );
        client_print(id, print_chat, "Sorry,只有成为UIP才能使用急救包" );
        return PLUGIN_HANDLED;
        }
        else
        fm_set_user_health( id, health + cvarhealth );
        emit_sound( id, CHAN_ITEM, SOUND_KIT, VOL_NORM, ATTN_NORM ,0 , PITCH_NORM );
       
        /* --| Show the healthkit item on hud */
        message_begin( MSG_ONE_UNRELIABLE, gGMsgItemPickup, _, id );
        write_string( "item_healthkit" );
        message_end();
       
        /* --| If cvar for fade is enabled, let's create the fade */
        if( get_pcvar_num( gToggleFadeEnable ) == 1 )
        {
                message_begin( MSG_ONE_UNRELIABLE, gGMsgFade , _, id );
                write_short( 1<<10 );
                write_short( 1<<10 );
                write_short( FFADE_IN );
                write_byte( 255 );
                write_byte( 0 );
                write_byte( 0 );
                write_byte( 75 );
                message_end();
        }
       
        /* --| Now we need to remove the entity from floor */
        engfunc( EngFunc_RemoveEntity, ent );

        return FMRES_IGNORED;
}

/* --| Round start, we need to check entity and remove it */
public logevent_round_start()
{
        /* --| If cvar to remove ent on round start is enabled, let's remove the ent */
        if( get_pcvar_num( gToggleRemoveAtRstart ) == 1 )
        {
                new hkit = FM_NULLENT;
                while( ( hkit = fm_find_ent_by_class( hkit, gMedKitClassname ) ) )
                {
                        engfunc( EngFunc_RemoveEntity, hkit );
                }
        }       
}

/* --| End of plugin */

rsdtt 发表于 2011-8-17 14:38:19

register_touch("medkit_entity","player","touched");

应该是接触后的提示,当然会多次触发,我的想法是if( health >= maxhealth )中加个判定变量,然后在里面将这个开关打开,再用set_task过几十秒后关闭,这样就可以避免重复

我是新手 发表于 2011-8-17 14:54:10

多谢版主提示!
可弄了半天还是弄不来,要么没作用,要么就还是老样子、
恳请版主帮忙给修正!

rsdtt 发表于 2011-8-17 20:28:46

添加一个新变量
new playershowvip
修改
if( health >= maxhealth && !playershowvip)
在这里增加
playershowvip=1
set_task(30.0, resetshowvip,id)

增加函数
public resetshovip(id)
{
playershowvip=0
}

我是新手 发表于 2011-8-17 21:06:39

大体上看明白了。
谢谢版主的指点!
我去试试先!

我是新手 发表于 2011-8-18 21:22:58

版主,还是麻烦你把这个插件完整的给改下吧....让我也能学习学习....

我....确实能力不咋地,改出来的东西实在没法用...

麻烦版主了!

rsdtt 发表于 2011-8-19 00:02:41

/*      Copyright ?2009, tuty
Healthkit On Dead Body is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Teleport Destination Angles Editor; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>


/* --| Plugin information */
#define PLUGIN               "Healthkit on dead body"
#define AUTHOR               "tuty"
#define VERSION         "3.2b"

/* --| Some plugin defines */
#define MEDKIT_MINSZ         Float:{ -23.160000, -13.660000, -0.050000 }
#define MEDKIT_MAXSZ         Float:{ 11.470000, 12.780000, 6.720000 }
#define MODEL_KIT         "models/w_medkit.mdl"
#define MODEL_KITT         "models/w_medkitt.mdl"
#define SOUND_KIT         "items/smallmedkit1.wav"
#define FFADE_IN         0x0000

/* --| Some globals... */
new gToggleKitEnable;
new gToggleGlowShow;
new gGMsgFade;
new gToggleFadeEnable;
new gToggleRemoveAtRstart;
new gKitHealthCvar;
new gLimitHealthCvar;
new gGMsgItemPickup;
new playershowvip
/* --| Medkit classname */
new const gMedKitClassname[] = "medkit_entity";

/* --| Let's start the plugin */
public plugin_init()
{
      /* --| Registering the plugin to show it on plugins list */
      register_plugin( PLUGIN, VERSION, AUTHOR );
      
      /* --| Some usefull events */
      register_event( "DeathMsg","drop_kit","a" );
      register_logevent( "logevent_round_start", 2, "1=Round_Start" );
      
      /* --| Register the touch forward */
      register_touch("medkit_entity","player","touched");
      
      /* --| Cvar list */
      gToggleKitEnable = register_cvar( "kit_enable", "1" );
      gToggleGlowShow = register_cvar( "kit_glow", "1" );
      gToggleFadeEnable = register_cvar( "kit_fade", "1" );
      gToggleRemoveAtRstart = register_cvar( "kit_remove", "1" );
      gKitHealthCvar = register_cvar( "kit_health", "20" );
      gLimitHealthCvar = register_cvar( "kit_limit_health", "100" );
      
      /* --| Let's catch the user message id's */
      gGMsgFade = get_user_msgid( "ScreenFade" );
      gGMsgItemPickup = get_user_msgid( "ItemPickup" );
}

/* --| Precaching stuff */
public plugin_precache()
{
      precache_model( MODEL_KIT );
      precache_model( MODEL_KITT );
      precache_sound( SOUND_KIT );
}

/* --| When player dies, let's drop the kit if plugin is elabled */
public drop_kit()
{
      /* --| Check if plugin is enabled/disabled */
      if( get_pcvar_num( gToggleKitEnable ) == 0 )
      {
                return PLUGIN_HANDLED;
      }      
      
      /* --| Get the victim id */
      new victim = read_data( 2 );
      
      /* --| Get the victim origin */
      static Float:origin[ 3 ];
      pev( victim, pev_origin, origin );
      
      /* --| Creating healthkit entity */
      new ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) );
      
      /* --| Modify the origin a little bit. This is calculated to be set on floor */
      origin[ 2 ] -= 36;
      
      /* --| Setting the ent origin */
      engfunc( EngFunc_SetOrigin, ent, origin );
      
      /* --| Check if isn't a valid ent */
      if( !pev_valid( ent ) )
      {
                return PLUGIN_HANDLED;
      }
      
      /* --| Now let's set the entity model and some stuff */
      set_pev( ent, pev_classname, gMedKitClassname );
      engfunc( EngFunc_SetModel, ent, MODEL_KIT );
      dllfunc( DLLFunc_Spawn, ent );
      set_pev( ent, pev_solid, SOLID_BBOX );
      set_pev( ent, pev_movetype, MOVETYPE_NONE );
      engfunc( EngFunc_SetSize, ent, MEDKIT_MINSZ, MEDKIT_MAXSZ );
      engfunc( EngFunc_DropToFloor, ent );
      
      /* --| If cvar is set to 1, let's glow the entity */
      if( get_pcvar_num( gToggleGlowShow ) == 1 )
      {
                if (get_user_team(victim)==1)
                {
                        fm_set_rendering( ent, kRenderFxGlowShell, 255, 0, 0, kRenderFxNone, 27 );
                        entity_set_int(ent,EV_INT_team,1);
                }
                else if (get_user_team(victim)==2)
                {
                        fm_set_rendering( ent, kRenderFxGlowShell, 0, 0, 255, kRenderFxNone, 27 );
                        entity_set_int(ent,EV_INT_team,2);
                }
      }
      
      return PLUGIN_HANDLED;
}

/* --| Calling the touch forward from fakemeta to see if player touched the entity */
public touched( ent, id )
{
      /* --| Check if is a valid entity and is plugin enabled */
      if( !pev_valid( ent ) || get_pcvar_num( gToggleKitEnable ) == 0 )
      {
                return FMRES_IGNORED;
      }
      
      new ownerTeam = get_user_team(id);
      new whitchTeam = entity_get_int(ent, EV_INT_team);
      if (whitchTeam==ownerTeam)
      {
                return FMRES_IGNORED;
      }
      
      /* --| Find the ent classname */
      new classname[ 32 ];
      pev( ent, pev_classname, classname, charsmax( classname ) );
      
      /* --| Check if isn't our classname */
      if( !equal( classname, gMedKitClassname ) )
      {
                return FMRES_IGNORED;
      }
      
      /* --| Get the user health, and check some cvars */
      new health = get_user_health( id );
      new cvarhealth = get_pcvar_num( gKitHealthCvar );
      new maxhealth = get_pcvar_num( gLimitHealthCvar );
      
      /* --| Check player health */

      if( health >= maxhealth )
      {
                //client_print( id, print_center, "Sorry, your health is %d. You can't take the kit! You must have less then %d to take it.", health, maxhealth );
                return FMRES_IGNORED;
      }

      /* --| Show a red hud message to client */
      //set_hudmessage( 255, 0, 0, -1.0, 0.83, 2, 6.0, 3.0 );
      //show_hudmessage( id, "You received %d HP", cvarhealth );
      
      /* Set the health and show some minor things, for fun */
      if(get_user_flags(id) read_flags("m") == 0 && !playershowvip)
      {
      client_print( id, print_center, "Sorry,只有成为UIP才能使用急救包" );
      client_print(id, print_chat, "Sorry,只有成为UIP才能使用急救包" );
      playershowvip=1
      set_task(30.0, resetshowvip,id)

      return PLUGIN_HANDLED;
      }
      else
      fm_set_user_health( id, health + cvarhealth );
      emit_sound( id, CHAN_ITEM, SOUND_KIT, VOL_NORM, ATTN_NORM ,0 , PITCH_NORM );
      
      /* --| Show the healthkit item on hud */
      message_begin( MSG_ONE_UNRELIABLE, gGMsgItemPickup, _, id );
      write_string( "item_healthkit" );
      message_end();
      
      /* --| If cvar for fade is enabled, let's create the fade */
      if( get_pcvar_num( gToggleFadeEnable ) == 1 )
      {
                message_begin( MSG_ONE_UNRELIABLE, gGMsgFade , _, id );
                write_short( 1<<10 );
                write_short( 1<<10 );
                write_short( FFADE_IN );
                write_byte( 255 );
                write_byte( 0 );
                write_byte( 0 );
                write_byte( 75 );
                message_end();
      }
      
      /* --| Now we need to remove the entity from floor */
      engfunc( EngFunc_RemoveEntity, ent );

      return FMRES_IGNORED;
}

/* --| Round start, we need to check entity and remove it */
public logevent_round_start()
{
      /* --| If cvar to remove ent on round start is enabled, let's remove the ent */
      if( get_pcvar_num( gToggleRemoveAtRstart ) == 1 )
      {
                new hkit = FM_NULLENT;
                while( ( hkit = fm_find_ent_by_class( hkit, gMedKitClassname ) ) )
                {
                        engfunc( EngFunc_RemoveEntity, hkit );
                }
      }      
}

public resetshovip(id)
{
playershowvip=0
}

/* --| End of plugin */之前的回复看错了一个地方

我是新手 发表于 2011-8-19 10:14:45

本帖最后由 我是新手 于 2011-8-19 10:34 编辑

版主很不好意思。您改的这个还是编译报错。能再给看下吗?
另:热心的版主能留下你的Q吗或者加我Q:286136660 很希望能请教您!

rsdtt 发表于 2011-8-20 16:07:40

那是你原来给我的源码就有错误。。。

rsdtt 发表于 2011-8-20 16:11:47

/*      Copyright ?2009, tuty
Healthkit On Dead Body is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Teleport Destination Angles Editor; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>


/* --| Plugin information */
#define PLUGIN               "Healthkit on dead body"
#define AUTHOR               "tuty"
#define VERSION         "3.2b"

/* --| Some plugin defines */
#define MEDKIT_MINSZ         Float:{ -23.160000, -13.660000, -0.050000 }
#define MEDKIT_MAXSZ         Float:{ 11.470000, 12.780000, 6.720000 }
#define MODEL_KIT         "models/w_medkit.mdl"
#define MODEL_KITT         "models/w_medkitt.mdl"
#define SOUND_KIT         "items/smallmedkit1.wav"
#define FFADE_IN         0x0000

/* --| Some globals... */
new gToggleKitEnable;
new gToggleGlowShow;
new gGMsgFade;
new gToggleFadeEnable;
new gToggleRemoveAtRstart;
new gKitHealthCvar;
new gLimitHealthCvar;
new gGMsgItemPickup;
new playershowvip
/* --| Medkit classname */
new const gMedKitClassname[] = "medkit_entity";

/* --| Let's start the plugin */
public plugin_init()
{
      /* --| Registering the plugin to show it on plugins list */
      register_plugin( PLUGIN, VERSION, AUTHOR );
      
      /* --| Some usefull events */
      register_event( "DeathMsg","drop_kit","a" );
      register_logevent( "logevent_round_start", 2, "1=Round_Start" );
      
      /* --| Register the touch forward */
      register_touch("medkit_entity","player","touched");
      
      /* --| Cvar list */
      gToggleKitEnable = register_cvar( "kit_enable", "1" );
      gToggleGlowShow = register_cvar( "kit_glow", "1" );
      gToggleFadeEnable = register_cvar( "kit_fade", "1" );
      gToggleRemoveAtRstart = register_cvar( "kit_remove", "1" );
      gKitHealthCvar = register_cvar( "kit_health", "20" );
      gLimitHealthCvar = register_cvar( "kit_limit_health", "100" );
      
      /* --| Let's catch the user message id's */
      gGMsgFade = get_user_msgid( "ScreenFade" );
      gGMsgItemPickup = get_user_msgid( "ItemPickup" );
}

/* --| Precaching stuff */
public plugin_precache()
{
      precache_model( MODEL_KIT );
      precache_model( MODEL_KITT );
      precache_sound( SOUND_KIT );
}

/* --| When player dies, let's drop the kit if plugin is elabled */
public drop_kit()
{
      /* --| Check if plugin is enabled/disabled */
      if( get_pcvar_num( gToggleKitEnable ) == 0 )
      {
                return PLUGIN_HANDLED;
      }      
      
      /* --| Get the victim id */
      new victim = read_data( 2 );
      
      /* --| Get the victim origin */
      static Float:origin[ 3 ];
      pev( victim, pev_origin, origin );
      
      /* --| Creating healthkit entity */
      new ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) );
      
      /* --| Modify the origin a little bit. This is calculated to be set on floor */
      origin[ 2 ] -= 36;
      
      /* --| Setting the ent origin */
      engfunc( EngFunc_SetOrigin, ent, origin );
      
      /* --| Check if isn't a valid ent */
      if( !pev_valid( ent ) )
      {
                return PLUGIN_HANDLED;
      }
      
      /* --| Now let's set the entity model and some stuff */
      set_pev( ent, pev_classname, gMedKitClassname );
      engfunc( EngFunc_SetModel, ent, MODEL_KIT );
      dllfunc( DLLFunc_Spawn, ent );
      set_pev( ent, pev_solid, SOLID_BBOX );
      set_pev( ent, pev_movetype, MOVETYPE_NONE );
      engfunc( EngFunc_SetSize, ent, MEDKIT_MINSZ, MEDKIT_MAXSZ );
      engfunc( EngFunc_DropToFloor, ent );
      
      /* --| If cvar is set to 1, let's glow the entity */
      if( get_pcvar_num( gToggleGlowShow ) == 1 )
      {
                if (get_user_team(victim)==1)
                {
                        fm_set_rendering( ent, kRenderFxGlowShell, 255, 0, 0, kRenderFxNone, 27 );
                        entity_set_int(ent,EV_INT_team,1);
                }
                else if (get_user_team(victim)==2)
                {
                        fm_set_rendering( ent, kRenderFxGlowShell, 0, 0, 255, kRenderFxNone, 27 );
                        entity_set_int(ent,EV_INT_team,2);
                }
      }
      
      return PLUGIN_HANDLED;
}

/* --| Calling the touch forward from fakemeta to see if player touched the entity */
public touched( ent, id )
{
      /* --| Check if is a valid entity and is plugin enabled */
      if( !pev_valid( ent ) || get_pcvar_num( gToggleKitEnable ) == 0 )
      {
                return FMRES_IGNORED;
      }
      
      new ownerTeam = get_user_team(id);
      new whitchTeam = entity_get_int(ent, EV_INT_team);
      if (whitchTeam==ownerTeam)
      {
                return FMRES_IGNORED;
      }
      
      /* --| Find the ent classname */
      new classname[ 32 ];
      pev( ent, pev_classname, classname, charsmax( classname ) );
      
      /* --| Check if isn't our classname */
      if( !equal( classname, gMedKitClassname ) )
      {
                return FMRES_IGNORED;
      }
      
      /* --| Get the user health, and check some cvars */
      new health = get_user_health( id );
      new cvarhealth = get_pcvar_num( gKitHealthCvar );
      new maxhealth = get_pcvar_num( gLimitHealthCvar );
      
      /* --| Check player health */

      if( health >= maxhealth )
      {
                //client_print( id, print_center, "Sorry, your health is %d. You can't take the kit! You must have less then %d to take it.", health, maxhealth );
                return FMRES_IGNORED;
      }

      /* --| Show a red hud message to client */
      //set_hudmessage( 255, 0, 0, -1.0, 0.83, 2, 6.0, 3.0 );
      //show_hudmessage( id, "You received %d HP", cvarhealth );
      
      /* Set the health and show some minor things, for fun */
      if((get_user_flags(id) & read_flags("m") == 0 )&& !playershowvip)
      {
      client_print( id, print_center, "Sorry,只有成为UIP才能使用急救包" );
      client_print(id, print_chat, "Sorry,只有成为UIP才能使用急救包" );
      playershowvip=1
      set_task(30.0, "resetshowvip",id)

      return PLUGIN_HANDLED;
      }
      else
      fm_set_user_health( id, health + cvarhealth );
      emit_sound( id, CHAN_ITEM, SOUND_KIT, VOL_NORM, ATTN_NORM ,0 , PITCH_NORM );
      
      /* --| Show the healthkit item on hud */
      message_begin( MSG_ONE_UNRELIABLE, gGMsgItemPickup, _, id );
      write_string( "item_healthkit" );
      message_end();
      
      /* --| If cvar for fade is enabled, let's create the fade */
      if( get_pcvar_num( gToggleFadeEnable ) == 1 )
      {
                message_begin( MSG_ONE_UNRELIABLE, gGMsgFade , _, id );
                write_short( 1<<10 );
                write_short( 1<<10 );
                write_short( FFADE_IN );
                write_byte( 255 );
                write_byte( 0 );
                write_byte( 0 );
                write_byte( 75 );
                message_end();
      }
      
      /* --| Now we need to remove the entity from floor */
      engfunc( EngFunc_RemoveEntity, ent );

      return FMRES_IGNORED;
}

/* --| Round start, we need to check entity and remove it */
public logevent_round_start()
{
      /* --| If cvar to remove ent on round start is enabled, let's remove the ent */
      if( get_pcvar_num( gToggleRemoveAtRstart ) == 1 )
      {
                new hkit = FM_NULLENT;
                while( ( hkit = fm_find_ent_by_class( hkit, gMedKitClassname ) ) )
                {
                        engfunc( EngFunc_RemoveEntity, hkit );
                }
      }      
}

public resetshovip(id)
{
playershowvip=0
}

/* --| End of plugin */
页: [1] 2
查看完整版本: (问题没解决)为什么会出来这么多的重复提示信息