08.09.2012, 16:40
Alguem tem um comando assim /localizar ID ai apareзe um GameTextPlayer la no final dizendo assim DISTANCIA: mostra a distancia em que o player estб, e LOCAL: Mostra aonde o player estб exemplo commerce
CMD:procurar(playerid, params[]) {
if(isnull(params))
return false;
new id = strval(params);
if(!IsPlayerConnected(id))
return false;
new Float:p[4], s[100], n[24], zones[MAX_ZONE_NAME];
GetPlayerName(id, n, 24);
GetPlayerPos(id, p[0], p[1], p[2]);
GetPlayer2DZone(id, zones, MAX_ZONE_NAME);
p[3] = GetPlayerDistanceFromPoint(playerid, p[0], p[1], p[2]);
format(s, 100, "%s estб a %f metros de vocк [localidade: %s]", n, p[3], zones);
SendClientMessage(playerid, -1, s);
return true;
}
#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;
}