How to use a command with out puttin the person`s id
#4

thats an example of getting the closest hospital i use in my script, the variables are initialized outside of the loop, therefore they still exist outside of the for loop.
Код:
new Float:x, Float:y, Float:z, chospital, Float:sdistance;
GetPlayerPos( playerid, x, y, z);
for (new i = 0; i < MAX_HOSPITALS; i++)
	{
		if (i == 0)
		{
			sdistance = DISTANCE(x, y, z, Hospitals[i][0], Hospitals[i][1], Hospitals[i][2]);
			chospital = i;
		}
		else if (DISTANCE(x, y, z, Hospitals[i][0], Hospitals[i][1], Hospitals[i][2]) < sdistance)
		{
			sdistance = DISTANCE(x, y, z, Hospitals[i][0], Hospitals[i][1], Hospitals[i][2]);
			chospital = i;
		}
	}
Reply


Messages In This Thread
How to use a command with out puttin the person`s id - by MWhite_005 - 20.07.2011, 00:10
Re: How to use a command with out puttin the person`s id - by Scenario - 20.07.2011, 00:22
Re: How to use a command with out puttin the person`s id - by MWhite_005 - 20.07.2011, 03:12
Re: How to use a command with out puttin the person`s id - by dowster - 20.07.2011, 03:15

Forum Jump:


Users browsing this thread: 1 Guest(s)