SA-MP Forums Archive
Water Death - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Water Death (/showthread.php?tid=259777)



Water Death - muhib777 - 05.06.2011

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?


Re: Water Death - Gamer_Z - 05.06.2011

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.


Re: Water Death - muhib777 - 05.06.2011

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 :/


Re: Water Death - Gamer_Z - 05.06.2011

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:


Re: Water Death - muhib777 - 05.06.2011

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.


Re: Water Death - Gamer_Z - 05.06.2011

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.


Re: Water Death - muhib777 - 05.06.2011

#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 ?


Re: Water Death - Gamer_Z - 06.06.2011

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


Re: Water Death - muhib777 - 06.06.2011

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

forward CheckWater(playerid);


foward does not show up blue for me on pawn

whats wrong?


Re: Water Death - muhib777 - 06.06.2011

bump need help plz