[Help] Please, GPS System.
#1

What can I put on my function "GPSUpdate"?
I must check position between 2 players, but in "GPSUpdate" i must use only 1 var "i" (cuz is from my loop).

for example:
Код:
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;
}
thx a lot!
Reply


Messages In This Thread
[Help] Please, GPS System. - by Avalanche! - 09.09.2011, 01:39
Re: [Help] Please, GPS System. - by Wesley221 - 09.09.2011, 08:30
Re: [Help] Please, GPS System. - by Lorenc_ - 09.09.2011, 08:51
Re: [Help] Please, GPS System. - by Avalanche! - 09.09.2011, 15:53

Forum Jump:


Users browsing this thread: 3 Guest(s)