Quote:
Originally Posted by Cheap_Suit
If you are going do it with engine, register_touch is alot easier to use imo.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <engine>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Owner"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_touch("item_healthkit", "player", "touch_healthkit")
}
public touch_healthkit(ent, id)
{
if(!is_valid_ent(ent) || !is_user_alive(id))
return PLUGIN_CONTINUE
//do stuff
//remove ent if touched (do some checks first to make sure they player meets your requirements)
remove_entity(ent)
return PLUGIN_CONTINUE
}
Another way is setting the classname and let hl handle it. An example would be Healthkit (like in HL) by VEN.
|
Thanks alot, too bad I can't karma you anymore... damn system...
anyway...
I tested this on SCSTUFF plugin
Code:
public touch_healthkit(ent, id)
{
if(is_valid_ent(ent) || is_user_alive(id) || get_user_health(id) > 75)
{
player_kits[id] +=1
client_print(id,print_chat,"[SCSP] You picked up a medkit! (%i medkits left)",player_kits[id])
remove_entity(ent)
return PLUGIN_HANDLED
}
else
{
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
gives me tag mismatch, and when on <75 hp it forces the entity to go into inventory.
Although if I spawn it on myself it works so I just have to pick it up and use it <more realistic anyway -_->
Plus the medkits don't respawn, I suspected this... but how do I fix it?