Water Death
#1

Is there any way that someone dies from falling into the sea as soon as they fall in it?

If so could i get a script please?
Reply
#2

Then you would make many area'a as only checking the Z pos would have many problems. You can prepare some area's with incognito's streamer plugin and check the Z pos in them, if they fall into water is is lower than 0.

also maybe you could do is with getting the animation index of a swimming player , that would be the most efficient method.
Reply
#3

well i want them to die on the water level 0 that would be normal for mine still have no clue how to start though :/
Reply
#4

make a timer,
then:
https://sampwiki.blast.hk/wiki/GetPlayerAnimationIndex

check animation index, if animation equals to swiming animation set the player's health to 0.0 , easy or not? D:
Reply
#5

tbh no lol soz for troubling but its better if i learn it or have an example i have been learning pawn for 2 months so far know some basics but not stuff like this.
Reply
#6

I'm not familiar with the player anim indexes but what yo basically do:
pawn Код:
new Timer[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    Timer[playerid] = SetTimerEx("CheckWater",5000,1,"i",playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(Timer[playerid]);
    return 1;
}

#define PLAYER_ANIMATION_SWIMMING (12345) // 12345 - here you need to fill in the ID of the swimming animation, I don't know what it is.
forward CheckWater(playerid);
public CheckWater(playerid)
{
    if(GetPlayerAnimationIndex(playerid) == PLAYER_ANIMATION_SWIMMING)
    {
        SetPlayerHealth(playerid,0.0);
    }
    return 1;
}
Enjoy and learn. :P

you can use the code on https://sampwiki.blast.hk/wiki/GetPlayerAnimationIndex , then go swim and check what the player animation swimming index is.
Reply
#7

#define PLAYER_ANIMATION_SWIMMING (12345) // 12345 - here you need to fill in the ID of the swimming animation, I don't know what it is.forward CheckWater(playerid);public CheckWater(playerid){ if(GetPlayerAnimationIndex(playerid) == PLAYER_ANIMATION_SWIMMING) { SetPlayerHealth(playerid,0.0); } return 1;}


where does this part go ?
Reply
#8

you can paste it on the global section of your script (outside any callbacks/publics)
Reply
#9

(125) : error 029: invalid expression, assumed zero

forward CheckWater(playerid);


foward does not show up blue for me on pawn

whats wrong?
Reply
#10

bump need help plz
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)