SA-MP Forums Archive
call when leave water - 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)
+--- Thread: call when leave water (/showthread.php?tid=549126)



call when leave water - edzis84 - 04.12.2014

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


Re: call when leave water - ikey07 - 04.12.2014

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


Re: call when leave water - MohanedZzZ - 04.12.2014

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.


Re: call when leave water - Schneider - 04.12.2014

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.


Re: call when leave water - Abagail - 04.12.2014

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.