PHP Code:
#define? ? ? ? FISH_THRESHOLD? ? ? ? ? ? 3.0
#define? ? ? ? WATER_CHECK_RADIUS? ? ? ? 5.0
IsPlayerNearWater(playerid)
{
? ? new
Float:x,
Float:y,
Float:z,
Float:cx,
Float:cy,
Float:cz,
Float:angle;
? ? GetPlayerPos(playerid, x, y, z);
? ? // Will not work near the dam
? ? if(z > 0.0 && z < FISH_THRESHOLD)
? ? {
? ? ? ? for(new i = 0; i < 4; i)
? ? ? ? {
? ? ? ? ? ? cx = x (WATER_CHECK_RADIUS * floatsin(-angle, degrees));
? ? ? ? ? ? cy = y (WATER_CHECK_RADIUS * floatcos(-angle, degrees));
? ? ? ? ? ? angle = 90.0;
? ? ? ? ? ? MapAndreas_FindZ_For2DCoord(cx, cy, cz);
? ? ? ? ? ? // Doesn't work under bridges
? ? ? ? ? ? if(cz == 0.0) return 1;
? ? ? ? }
? ? }
? ? return 0;
}
PHP Code:
if (IsPlayerNearWater(playerid))
{
SendClientMessage(playerid,-1,"You have to near water to start fishing.");
}