call when leave water
#1

How can i make callback which is called when player leaves the water?
Reply
#2

get if player is in water each 1 second, once he is not, he left the water, and you can give him a towel.
Reply
#3

You can use this include.
http://pastebin.com/RXr8ZfJ9
Function:
pawn Код:
IsPlayerInWater( playerid ) //Check if player is in any ocean from the GTA SA
Credits to Gen.SoNN.
Reply
#4

That included returns '1' when the player z-position is below 1.5, so it will also return '1' when the player is in the quarry, since that's below sea level too.
Reply
#5

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(InWater[playerid] == true && !IsPlayerInWater(playerid))
    {
          InWater[playerid] = false;
          CallLocalFunction("OnPlayerLeaveWater", "i", playerid);
          return true;
    }
    if(IsPlayerInWater(playerid)) InWater[playerid] = true;
    return 1;
}
Using an include such as the one shared above for the simple IsPlayerInWater function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)