Advertisement
Guest User

Water

a guest
Apr 9th, 2018
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.89 KB | None | 0 0
  1. IsPlayerOnWater(playerid)
  2. {
  3.     new Float:x, Float:y, Float:z, Float:retx[2], Float:rety[2], Float:retz[2], Float: retdist[2], modelids[2];
  4.     GetPlayerPos(playerid, x, y, z);
  5.     new collisions = CA_RayCastMultiLine(x, y, z + 0.7, x, y, z - 0.7, retx, rety, retz, retdist, modelids, 2);
  6.     //---
  7.     if (collisions)
  8.     {
  9.         for(new i = 0; i < collisions; i++)
  10.         {
  11.             if (modelids[i] == 20000)
  12.             {
  13.                 return true;
  14.             }
  15.         }
  16.     }
  17.     return false;
  18. }
  19.  
  20. IsPlayerUnderWater(playerid)
  21. {
  22.     new Float:x, Float:y, Float:z, Float:retx[10], Float:rety[10], Float:retz[10], Float: retdist[10], modelids[10];
  23.     GetPlayerPos(playerid, x, y, z);
  24.     new collisions = CA_RayCastMultiLine(x, y, z + 0.7, x, y, z + 1000.0, retx, rety, retz, retdist, modelids, 10);
  25.     //---
  26.     if (collisions)
  27.     {
  28.         for(new i = 0; i < collisions; i++)
  29.         {
  30.             if (modelids[i] == 20000)
  31.             {
  32.                 return (true);
  33.             }
  34.         }
  35.     }
  36.     return false;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement