Posts: 106
Threads: 40
Joined: Aug 2010
Reputation:
0
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?
Posts: 1,047
Threads: 23
Joined: Jun 2009
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.
Posts: 106
Threads: 40
Joined: Aug 2010
Reputation:
0
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 :/
Posts: 1,047
Threads: 23
Joined: Jun 2009
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:
Posts: 106
Threads: 40
Joined: Aug 2010
Reputation:
0
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.
Posts: 1,047
Threads: 23
Joined: Jun 2009
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.
Posts: 106
Threads: 40
Joined: Aug 2010
Reputation:
0
#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 ?
Posts: 1,047
Threads: 23
Joined: Jun 2009
you can paste it on the global section of your script (outside any callbacks/publics)
Posts: 106
Threads: 40
Joined: Aug 2010
Reputation:
0
(125) : error 029: invalid expression, assumed zero
forward CheckWater(playerid);
foward does not show up blue for me on pawn
whats wrong?