public GPSUpdate()
{
new string[128];
for(new i = 0; i < MAX_PLAYERS; ++i)
{
if(PlayerInfo[i][pGPS] != INVALID_PLAYER_ID)
{
if(IsPlayerConnected(PlayerInfo[i][pGPS]))
{
new Distance;
new Float:X, Float:Y, Float:Z;
new Float:X2, Float:Y2, Float:Z2;
GetPlayerPos(i, X, Y, Z);
GetPlayerPos(PlayerInfo[i][pGPS], X2, Y2, Z2);
Distance = floatround(floatsqroot(floatadd(floatadd(floatpower(floatabs(floatsub(X,X2)),2),floatpower(floatabs(floatsub(Y,Y2)),2)),floatpower(floatabs(floatsub(Z,Z2)),2))));
format(string, sizeof(string), "- %s -~n~city:~w~ %s ~l~- ~p~Distance: ~w~%dm", PlayerName(i), GetPlayerCity(i), Distance);
TextDrawSetString(GPS[i], string);
}
else
{
SendClientMessage(i, COLOR_LIGHTRED, "error, gps must be turned off");
PlayerInfo[i][pGPS] = INVALID_PLAYER_ID;
}
}
}
return 1;
}
|
I dont really get what you mean, but you might want to use "SetTimerEx();".
https://sampwiki.blast.hk/wiki/SetTimerEx |
|
His doing it fine, I mean I would perfer one timer than a server with heaps of players running a single timer at a time.
Does 'distance' work or what's the problem? |
/gps [id] I must create a variable to set who i'm locating, for example: PlayerInfo[playerid][pGps] = giveid; After this, I create a loop to compare with this function "GetDistanceBetweenPlayers(i, PlayerInfo[i][pGps]);