coast_finder include

Authors:

Tornamic (Kirill Tymoshchenko)

Special thanks to:

Vladimir (NoPressF)

Functions:

FindNearestCoast(Float:near_x, Float:near_y, Float:near_z, &Float:coast_x, &Float:coast_y, &Float:coast_z, Float:offset = 3.0, Float:height_limit = 5.0);
IsPlayerNearCoast(playerid, Float:radius = 10.0, Float:height_limit = 10.0);
IsVehicleNearCoast(vehicleid, Float:radius = 10.0, Float:height_limit = 10.0);
IsPointNearCoast(Float:point_x, Float:point_y, Float:point_z, Float:radius = 10.0, Float:height_limit = 10.0);
GetDistanceToNearestCoast(Float:near_x, Float:near_y, Float:near_z, &Float:distance);
GetPlayerDistanceToNearestCoast(playerid, &Float:distance);
GetVehDistanceToNearestCoast(vehicleid, &Float:distance);

Dependencies:

ColAndreas plugin https://github.com/Pottus/ColAndreas

Example:

CMD:coast(playerid)
{	
	new 
		Float:player_x, Float:player_y, Float:player_z,
		Float:coast_x, Float:coast_y, Float:coast_z
	;
	
	GetPlayerPos(playerid, player_x, player_y, player_z);

	if(FindNearestCoast(player_x, player_y, player_z, coast_x, coast_y, coast_z))
	{
		SetPlayerPos(playerid, coast_x, coast_y, coast_z + 0.5);
		SendClientMessage(playerid, -1, "Вы успешно телепортировались к ближайшему берегу");
		return 1;
	}

	SendClientMessage(playerid, -1, "Сервер не смог найти ближайший берег");
	
	return 1;
}