16.04.2013, 20:17
pawn Код:
#include <a_samp>
#include <a_zones>
#include <zcmd>
new Timer[MAX_PLAYERS];
forward Localizador(playerid, otherid);
public Localizador(playerid, otherid)
{
if(!IsPlayerConnected(otherid)) return KillTimer(Timer[playerid]);
new Float:x, Float:y, Float:z, Float:o_Distance, a[128], zone[MAX_ZONE_NAME];
GetPlayerPos(otherid, x, y, z);
o_Distance = GetPlayerDistanceFromPoint(playerid, x, y, z),
format(a, sizeof(a), "%s~n~Distвncia: %0.2f metros~n~Local: %s", PlayerName(otherid), o_Distance, GetPlayer2DZone(otherid, zone, MAX_ZONE_NAME));
GameTextForPlayer(playerid, a, 3000, 5);
return 1;
}
CMD:procurar(playerid, params[])
{
if(isnull(params)) return false;
new otherid = strval(params);
if(!IsPlayerConnected(otherid)) return false;
Timer[playerid] = SetTimerEx("Localizador", 1500, true, "dd", playerid, otherid);
return 1;
}
CMD:parar(playerid, params[])
{
#pragma unused params
KillTimer(Timer[playerid]);
return 1;
}
stock PlayerName(playerid)
{
new a[MAX_PLAYER_NAME];
GetPlayerName(playerid, a, MAX_PLAYER_NAME);
return a;
}
Tуpico: https://sampforum.blast.hk/showthread.php?tid=375945