AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Knife atack (https://forums.alliedmods.net/showthread.php?t=53544)

Alka 04-06-2007 02:41

Knife atack
 
hi.I want to make something like this... but,dunno:
*When a player(atacker) hit a victim with knife...,The health of victim decrase with 5hp per second!

Thanks.

SAMURAI16 04-06-2007 06:26

Re: Knife atack
 
Code:
#include <amxmodx> #include <csx> #include <fun> public plugin_init() {     register_plugin("","",""); } public client_damage(attacker,victim,damage,weapon,hitplace,TA) {     if(!attacker || !is_user_alive(victim))         return;             if(weapon != CSW_KNIFE)         return;         set_task(1.0,"decrease_health", victim+35435,"",0, "b") } public decrease_health(taskid) {     new victim = taskid - 35435;         new health = get_user_health(victim);         if(health == 0)         remove_task(victim+35435);             set_user_health(victim, health - 5); }

Rolnaaba 04-06-2007 10:49

Re: Knife atack
 
wouldnt you do:
Code:
if(health == 0)         remove_task(victim+35435);
since the set_task's taskid is the victim+35435?

SAMURAI16 04-06-2007 10:51

Re: Knife atack
 
Quote:

Originally Posted by Rolnaaba (Post 461523)
wouldnt you do:
Code:
if(health == 0) remove_task(victim+35435);

since the set_task's taskid is the victim+35435?

ups, my fault. Thanks

Alka 04-06-2007 12:06

Re: Knife atack
 
oh...Thanks... :wink:

I found a bug:When i hit someone with knife...and the round is finished, on nextround he continue to bleed(health decrase) Can you fix this?Thanks...

Emp` 04-06-2007 15:38

Re: Knife atack
 
Code:
if(health < 0)         remove_task(victim+35435);

Alka 04-06-2007 15:51

Re: Knife atack
 
Ok..Thanks...hope to work!


All times are GMT -4. The time now is 06:40.

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