AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   A biteing command. (https://forums.alliedmods.net/showthread.php?t=29478)

Chex 06-06-2006 15:50

A biteing command.
 
Code:
}     new bite[23]     set_task(1.0,"bite",id,_,_,"b")     set_user_health(id,600)     client_print(id,print_chat,"You sink you teeth in the person's neck.^n")     client_print(entid,print_chat,"You just got bit by a vampire!^n")     return PLUGIN_HANDLED } public bite(id){             new entid, entbody     get_user_aiming(id,entid,entbody,400)             set_user_health(entid,get_user_health(entid)-10)         return PLUGIN_HANDLED     }

I have a little problem with that. If I do the command /bite, any one I look at will start to lose health. How do I make it stop when the player dies? for some reason this does not work.
Code:
public bite(id){             new entid, entbody     get_user_aiming(id,entid,entbody,400)     if(get_user_health(entid) <=10){                          user_silentkill(entid)                       return PLUGIN_HANDLED }            else{        set_user_health(entid,get_user_health(entid)-10)         return PLUGIN_HANDLED     } return PLUGIN_HANDLED }

v3x 06-06-2006 16:03

Code:
remove_task(id);

Chex 06-06-2006 16:30

Ok that fixed it going on forever, but there is still a problem. If I use the command on some one the start to loss hp. But if I turn and look at some one else the person that I was looking at stops losing hp and the new person starts. Is there a way to fix that? Thanks.

Smokey485 06-07-2006 15:31

Yes, I think...

Replace your current settask with this
Code:
set_task(1.0,"bite",id+40,0,0,"b")

And then in public bite(id){
put this at the beginning

Code:
id -= 40

Then it sha'll work!

v3x 06-07-2006 16:15

Better idea:
Code:
#define TASK_BITE 98239
:arrow:
Code:
set_task(1.0 , "bite" , id + TASK_BITE , _ , _ , "b");
:arrow:
Code:
public bite(id) {   id -= TASK_BITE;   // .. }
:arrow:
Code:
remove_task(id + TASK_BITE);


All times are GMT -4. The time now is 16:25.

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