AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   User->Damage World->Damage (https://forums.alliedmods.net/showthread.php?t=17183)

DahVid 08-27-2005 00:26

User->Damage World->Damage
 
I need someway to tell the difference between damage from falling/etc and someone killing someone. I'm using get_user_attacker.

Freecode 08-27-2005 00:29

when falling the attacker is 0 (world)

DahVid 08-27-2005 00:32

Odd, I may be doing this wrong, but when I fall it beeps.

Code:
new attacker=get_user_attacker(id) if(attacker>0) {       client_cmd(attacker,"spk buttons/blip2.wav") }

is that the world beeping at me? :)

Freecode 08-27-2005 00:39

wiered. let me see the rest of ocde.

DahVid 08-27-2005 00:40

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> public plugin_init()     {     register_plugin("Hit notifications","0.1","DahVid")     register_event("Damage", "got_hit", "b", "2!0")     register_cvar("hn_redflash","1")     register_cvar("hn_shake","1")     register_cvar("hn_beep","1") } public plugin_precache() {     precache_sound("buttons/blip2.wav") } public got_hit(id)     {     if(is_user_alive(id) && is_user_connected(id)) {             if(get_cvar_num("hn_redflash")) {                 message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id)                 write_short(25)                 write_short(25)                 write_short(9)                 write_byte(255)                 write_byte(0)                 write_byte(0)                 write_byte(100)                 message_end()             }             if(get_cvar_num("hn_shake")) {                 message_begin(MSG_ONE,get_user_msgid("ScreenShake"),{0,0,0},id)                 write_short(10000)                 write_short(500)                 write_short(500)                 message_end()             }             if(get_cvar_num("hn_beep")) {                 new attacker=get_user_attacker(id)                 if(attacker>0) {                     client_cmd(attacker,"spk buttons/blip2.wav")                 }         }     } }

Freecode 08-27-2005 00:41

well that will never give you 0 as attacker because you declare this
Code:
"2!0"
if you dont know what that means i suggest you look it up :wink:

DahVid 08-27-2005 00:42

Ok, thanks man..

DahVid 08-27-2005 01:12

So, if 2 is the attacker. I erased the 2!0, now it should be able to go to any number right? It still beeps. I even tried 2=0, still beeps.

I guess i didn't understand it as much as I though, and the funcwiki/etc arn't helping. :(

XxAvalanchexX 08-27-2005 02:02

I'm pretty sure 2 is in fact the damage done, not the attacker. It may return as you attacking yourself (attacker == id)

DahVid 08-27-2005 02:04

Quote:

Originally Posted by XxAvalanchexX
I'm pretty sure 2 is in fact the damage done, not the attacker. It may return as you attacking yourself (attacker == id)

Yeah, I got that too. Attacker is 1, right? I did the same for 1 and it didn't work.


All times are GMT -4. The time now is 14:26.

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