27.12.2008, 19:06
Theory:
Get all the cords of the hospitals, and save them in separate global variables:
new H1X = 423.43, H1Y = 1353.56, H1Z = 3.23;
new H2X = 1353.43, H2Y = 133.56, H2Z = 8.32;
etc. Do that for all the hospitals.
When a player dies, get his location, and do:
X - H1X = Var1X; Y - H1Y = Var1Y; Z - H1Z = Var1Z;
X - H2X = Var2Z; Y - H2Y = Var2Z; Z - H2Z = Var2Z;
etc, etc, etc.
Then add up the remainders:
Var1X - Var1Y = Close1; Close1 - Var1Z = Close1;
Var2X - Var2Y = Close2; Close2 - Var2Z = Close2;
etc, etc, etc.
What ever number is smaller:
if(Close1 < Close2) return SetPlayerPos(playerid, H1X H1Y H1Z);
else if(Close1 > Close2) return SetPlayerPos(playerid, H2X H2Y H2Z);
etc, etc, etc.
Yes, I know I'm making a lot of "new"s, but I'm not looking for quality, I'm looking for functionality, you can always change it :P.
Get all the cords of the hospitals, and save them in separate global variables:
new H1X = 423.43, H1Y = 1353.56, H1Z = 3.23;
new H2X = 1353.43, H2Y = 133.56, H2Z = 8.32;
etc. Do that for all the hospitals.
When a player dies, get his location, and do:
X - H1X = Var1X; Y - H1Y = Var1Y; Z - H1Z = Var1Z;
X - H2X = Var2Z; Y - H2Y = Var2Z; Z - H2Z = Var2Z;
etc, etc, etc.
Then add up the remainders:
Var1X - Var1Y = Close1; Close1 - Var1Z = Close1;
Var2X - Var2Y = Close2; Close2 - Var2Z = Close2;
etc, etc, etc.
What ever number is smaller:
if(Close1 < Close2) return SetPlayerPos(playerid, H1X H1Y H1Z);
else if(Close1 > Close2) return SetPlayerPos(playerid, H2X H2Y H2Z);
etc, etc, etc.
Yes, I know I'm making a lot of "new"s, but I'm not looking for quality, I'm looking for functionality, you can always change it :P.