AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [DONE]Check if player suicided (https://forums.alliedmods.net/showthread.php?t=207915)

Unkolix 02-08-2013 08:04

[DONE]Check if player suicided
 
How to check if player suicided? Becouse I have this code:

PHP Code:

public hook_death()
{
// Killer id
nKiller read_data(1)

if ( (
read_data(3) == 1) && (read_data(5) == 0) )
{
nHp_add get_pcvar_num (health_hs_add)
}
else
nHp_add get_pcvar_num (health_add)
nHp_max get_pcvar_num (health_max)
// Updating Killer HP
if(!(get_user_flags(nKiller) & ADMIN_LEVEL_H))
return;

nKiller_hp get_user_health(nKiller)
nKiller_hp += nHp_add
// Maximum HP check
if (nKiller_hp nHp_maxnKiller_hp nHp_max
set_user_health
(nKillernKiller_hp)
// Hud message "Healed +15/+30 hp"
set_hudmessage(02550, -1.00.1501.01.00.10.1, -1)
show_hudmessage(nKiller"Healed +%d hp"nHp_add)
// Screen fading
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, nKiller)
write_short(1<<10)
write_short(1<<10)
write_short(0x0000)
write_byte(0)
write_byte(0)
write_byte(200)
write_byte(75)
message_end()


And it shows that I got 15 hp after I suicide...



EDIT:
Nevermind, i just checked if player is alive.


All times are GMT -4. The time now is 20:38.

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