Raised This Month: $ Target: $400
 0% 

decreasing health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zidd
Junior Member
Join Date: Dec 2004
Location: 66.199.236.61:27015
Old 04-08-2005 , 19:44   decreasing health
Reply With Quote #1

does anyone know how to make health decrease by 1HP every .5 seconds til the person gets 1 hp and also does anyone know how to give a person health based on how much damage they do like if you deal 55 damage you get 55 health like that
Zidd is offline
Send a message via AIM to Zidd
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-08-2005 , 19:54  
Reply With Quote #2

Try this:
Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Decrease HP","0.1","John Doe")     register_clcmd("amx_decreasehp","setHp",ADMIN_KICK,"<nick, #userid>") } public setHp(id,lvl,cid) {     if(!cmd_access(id,lvl,cid,2)) {         return PLUGIN_HANDLED     }     new arg[33]     read_argv(1,arg,32)     new player = cmd_target(id,arg,1+2)     if(!player) {         return PLUGIN_HANDLED     }     set_task(0.5,"remHp",player)     return PLUGIN_HANDLED } public remHp(player) {     new userHp = get_user_health(player)     if(userHp == 1) {         remove_task(player)         return PLUGIN_HANDLED     }     set_user_health(player,userHp - 1)     return PLUGIN_HANDLED }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Sp4rt4n
Senior Member
Join Date: Dec 2004
Old 08-03-2005 , 17:46  
Reply With Quote #3

What would you have to do to that code to make it apply to everyone?

(I know, I know, old post )
Sp4rt4n is offline
Send a message via MSN to Sp4rt4n
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-03-2005 , 17:51  
Reply With Quote #4

That code wouldn't even work because it would run once and stop.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Sp4rt4n
Senior Member
Join Date: Dec 2004
Old 08-03-2005 , 18:04  
Reply With Quote #5

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Decrease HP","0.1","John Doe")     register_clcmd("amx_decreasehp","setHp",ADMIN_KICK,"<nick, #userid>") } public setHp(id,lvl,cid) {     if(!cmd_access(id,lvl,cid,2)) {         return PLUGIN_HANDLED     }     new arg[33]     read_argv(1,arg,32)     new player = cmd_target(id,arg,1+2)     if(!player) {         return PLUGIN_HANDLED     }     set_task(0.5,"remHp",player)     return PLUGIN_HANDLED } public remHp(player) {     new userHp = get_user_health(player)     if(userHp == 1) {         remove_task(player)         return PLUGIN_CONTINUE     }     set_user_health(player,userHp - 1)     return PLUGIN_CONTINUE }

Thatd work for what Zidd would want to do, now what about me?
Sp4rt4n is offline
Send a message via MSN to Sp4rt4n
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-03-2005 , 23:31  
Reply With Quote #6

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Decrease HP","0.1","John Doe")     register_clcmd("amx_decreasehp","setHp",ADMIN_KICK,"<nick, #userid | ALL>") } public setHp(id,lvl,cid) {     if(!cmd_access(id,lvl,cid,2)) {         return PLUGIN_HANDLED     }     new arg[33]     read_argv(1,arg,32)     if(equali(arg,"ALL")) {         set_task(0.5,"remHp",0)         return PLUGIN_HANDLED     }     new player = cmd_target(id,arg,1+2)     if(!player) {         return PLUGIN_HANDLED     }     set_task(0.5,"remHp",player)     return PLUGIN_HANDLED } public remHp(player) {     if(player == 0) {         new players[32], num, i, stillalive;         get_players(players,num,"a");         for(i=0;i<num;i++) {             new userHp = get_user_health(players[i]);             if(userHp <= 1) {                 continue;             }             stillalive = 1; // let us know to keep looping             set_user_health(players[i],userHp - 1);         }         if(stillalive == 1) {             set_task(0.5,"remHp",0);         }     }     else {         new userHp = get_user_health(player)         if(userHp == 1) {             return PLUGIN_CONTINUE         }         set_user_health(player,userHp - 1)         set_task(0.5,"remHp",player)     }     return PLUGIN_CONTINUE }

Use ALL to do it to everyone. If everyone is either dead or everyone has 1 HP or less it will stop looping.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 10:01.


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