Requires SAMPFUNCS
Detects if a samp streamed player/actor is dead/alive:
Script Example(Die Detector):
PROBLEMS:
Due to GTA SAMP actually sucks on syncing player death animations. When a player actor is not performing a death animation, this snippet treat it as "ALIVE".
Suggestions:
If you have better ideas about this snippet, feel free to post your suggestions and your own code
Detects if a samp streamed player/actor is dead/alive:
Code:
// Usage:
// only use as conditional statements
// if 0AB1: @playerstatesamp 3 _actor 31@ _player -1 _checkifdead true
// if 0AB1: @playerstatesamp 3 _actor 31@ _player -1 _checkifdead false
// if 0AB1: @playerstatesamp 3 _actor -1 _player 31@ _checkifdead true
// if 0AB1: @playerstatesamp 3 _actor -1 _player 31@ _checkifdead false
// DO NOT USE THIS FUNCTION WIth AND/OR GATES
// if or // INACCURATE RESULT!
// 0AB1: @playerstatesamp 3 _actor 31@ _player -1 _checkifdead true
// ..... blablabla
//
// if and // INACCURATE RESULT!
// 0AB1: @playerstatesamp 3 _actor 31@ _player -1 _checkifdead true
// ..... blablabla
:playerstatesamp
// this initallize both player id and actor handle
if 1@ >= 0
then 0B20: samp 0@ = actor_handle_by_samp_player_id 1@
else
if 056D: actor 0@ defined
then 0B2B: samp 1@ = get_player_id_by_actor_handle 0@
end
end
//
if 856D: not actor 0@ defined
then
if 2@ == true
then 0485: return_true
else 059A: return_false
end
ret 0 // immediately return
end
if 0118: actor 0@ dead
then
if 2@ == true
then 0485: return_true
else 059A: return_false
end
ret 0 // immediately return
end
0B25: samp 31@ = get_player_health 1@
if 31@ > 0 // if the player has an hp then the player is still alive
then
if 2@ == true
then 059A: return_false
else 0485: return_true
end
else // in this stage the player hp was detected to be "0"
// try to detect death animations
if or
0611: actor 0@ performing_animation "KO_shot_face"
0611: actor 0@ performing_animation "KO_shot_front"
0611: actor 0@ performing_animation "KO_shot_stom"
0611: actor 0@ performing_animation "KO_skid_back"
0611: actor 0@ performing_animation "KO_skid_front"
then
if 2@ == true
then 0485: return_true
else 059A: return_false
end
else
if or
0611: actor 0@ performing_animation "CAR_dead_LHS"
0611: actor 0@ performing_animation "CAR_dead_RHS"
0611: actor 0@ performing_animation "Drown"
0611: actor 0@ performing_animation "KO_spin_L"
0611: actor 0@ performing_animation "KO_spin_R"
0611: actor 0@ performing_animation "KD_left"
0611: actor 0@ performing_animation "KD_right"
then
if 2@ == true
then 0485: return_true
else 059A: return_false
end
else
if or
0611: actor 0@ performing_animation "BIKE_fallR"
0611: actor 0@ performing_animation "BIKE_fall_off"
0611: actor 0@ performing_animation "CAR_rollout_LHS"
0611: actor 0@ performing_animation "CAR_rollout_RHS"
0611: actor 0@ performing_animation "FLOOR_hit_f"
0611: actor 0@ performing_animation "FLOOR_hit"
then
if 2@ == true
then 0485: return_true
else 059A: return_false
end
else
if 2@ == true
then 059A: return_false
else 0485: return_true
end
end
end
end
end
ret 0 // barrier
Script Example(Die Detector):
Code:
{$CLEO .cs}
0000:
while 8AFA: not is_samp_available
wait 400
end
:loopers
wait 0
0C8A: samp 0@ = get_max_player_id streamed_only true
for 1@ = 0 to 0@ step 1
if 0AB1: @playerstatesamp 3_actor -1 _player 1@ _checkifdead true
then 0AD1: show_formatted_text_highpriority "Player %d is Dead :(" time 2000 1@
end
end
jump @loopers
:playerstatesamp
// this initallize both player id and actor handle
if 1@ >= 0
then 0B20: samp 0@ = actor_handle_by_samp_player_id 1@
else
if 056D: actor 0@ defined
then 0B2B: samp 1@ = get_player_id_by_actor_handle 0@
end
end
//
if 856D: not actor 0@ defined
then
if 2@ == true
then 0485: return_true
else 059A: return_false
end
ret 0 // immediately return
end
if 0118: actor 0@ dead
then
if 2@ == true
then 0485: return_true
else 059A: return_false
end
ret 0 // immediately return
end
0B25: samp 31@ = get_player_health 1@
if 31@ > 0 // if the player has an hp then the player is still alive
then
if 2@ == true
then 059A: return_false
else 0485: return_true
end
else // in this stage the player hp was detected to be "0"
// try to detect death animations
if or
0611: actor 0@ performing_animation "KO_shot_face"
0611: actor 0@ performing_animation "KO_shot_front"
0611: actor 0@ performing_animation "KO_shot_stom"
0611: actor 0@ performing_animation "KO_skid_back"
0611: actor 0@ performing_animation "KO_skid_front"
then
if 2@ == true
then 0485: return_true
else 059A: return_false
end
else
if or
0611: actor 0@ performing_animation "CAR_dead_LHS"
0611: actor 0@ performing_animation "CAR_dead_RHS"
0611: actor 0@ performing_animation "Drown"
0611: actor 0@ performing_animation "KO_spin_L"
0611: actor 0@ performing_animation "KO_spin_R"
0611: actor 0@ performing_animation "KD_left"
0611: actor 0@ performing_animation "KD_right"
then
if 2@ == true
then 0485: return_true
else 059A: return_false
end
else
if or
0611: actor 0@ performing_animation "BIKE_fallR"
0611: actor 0@ performing_animation "BIKE_fall_off"
0611: actor 0@ performing_animation "CAR_rollout_LHS"
0611: actor 0@ performing_animation "CAR_rollout_RHS"
0611: actor 0@ performing_animation "FLOOR_hit_f"
0611: actor 0@ performing_animation "FLOOR_hit"
then
if 2@ == true
then 0485: return_true
else 059A: return_false
end
else
if 2@ == true
then 059A: return_false
else 0485: return_true
end
end
end
end
end
ret 0 // barrier
PROBLEMS:
Due to GTA SAMP actually sucks on syncing player death animations. When a player actor is not performing a death animation, this snippet treat it as "ALIVE".
Suggestions:
If you have better ideas about this snippet, feel free to post your suggestions and your own code
Last edited: