I'm sure this has been asked before, but I couldn't find it.
I'm making an ns plugin where aliens can (voluntarily) devour each other to gain health. The eating thing works nicely, with one exception.
I need a player to be able to type "devour" into the console, which changes a flag or client side cvar or some other variable to "1", and then the next alien to touch them eats them.
How do I store this value saying "I can be eaten"?
Here's what I have so far:
Code:
public plugin_init() {
register_plugin("amxxNsPlugin","0.5","smdobay")
register_concmd("sacrifice","prep_sacrifice")
register_touch("player", "player", "devour_other")
register_cvar("sv_devour","1",FCVAR_SERVER|FCVAR_SPONLY)
}
public prep_sacrifice(id){
}
public devour_other(id,cid){
if (get_cvar_num("sv_devour") == 1){
new youName[32]
new otherName[32]
get_user_name(id,youName,31)
get_user_name(cid,otherName,31)
new youHealth = get_user_health(id)
new otherHealth = get_user_health(cid)
if (otherHealth < 0){
otherHealth = 0
}
set_user_health(id,youHealth + otherHealth)
user_silentkill(cid)
new msgStr[31]
format(msgStr,30, "You just consumed %s.", otherName)
client_print(id,print_chat,msgStr)
format(msgStr,30, "You were just consumed by %s.", youName)
client_print(cid,print_chat,msgStr)
}
}