Raised This Month: $ Target: $400
 0% 

Stupid question...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smdobay
Member
Join Date: Feb 2005
Old 03-04-2005 , 17:55   Stupid question...
Reply With Quote #1

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)     } }
smdobay is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-04-2005 , 18:17  
Reply With Quote #2

Code:
new eatable[33]; 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) } public client_putinserver() {     eatable[id] = 0; // make sure to reset it } public prep_sacrifice(id){     if(eatable[id] == 0) {         client_print(id,print_chat,"You can now be eaten by other aliens.");         eatable[id] = 1;     }     else {         client_print(id,print_chat,"You can no longer be eaten by other aliens.");         eatable[id] = 0;     } } public devour_other(id,cid){     if(eatable[cid] == 1) {         set_user_health(id,get_user_health(id) + get_user_health(cid))         client_print(id,print_chat,"You ate another player.")         client_print(cid,print_chat,"You were eaten by another player.")         user_silentkill(cid)     } }

You will also want to check that only aliens can use the sacrifice command and that aliens can't eat marines that had it on.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-04-2005 , 18:18  
Reply With Quote #3

EDIT: Meant to edit other post, not make a new reply. Delete this please.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
smdobay
Member
Join Date: Feb 2005
Old 03-04-2005 , 18:19  
Reply With Quote #4

Thanks
smdobay 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 14:12.


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