22.02.2014, 05:30
(
Последний раз редактировалось Aerotactics; 22.02.2014 в 23:39.
)
Quote:
The script works, but when I die right next to one hospital, it will still respawn me at the other hospital. Changing distance doesn't really do anything except anything over 2000 and it will go to hospital 1, or under 2000 and it will go to hospital 2, or something like that. pawn Код:
pawn Код:
|
After yet another script revision, I still come up with the same results -- sending me to hospital 1, or the second hospital. I'm thinking of just searching for a new script bit since I can't seem to get this one to work. I checked my coords and they are not the issue:
pawn Код:
stock SpawnToHospital(playerid)
{
dead[playerid] = 0;
static const Float:hspawns[][4] =
{
{2034.1670,-1406.0623,17.2181,150.4297},
{1177.3391,-1324.2300,14.0658,268.3749}
};
new Float:spawndist[2]; // Change to the number of hospital spawnpoints you use.
new closestspawn;
spawndist[0] = GetPlayerDistanceFromPoint(playerid, 2034.1670,-1406.0623,17.2181);
spawndist[1] = GetPlayerDistanceFromPoint(playerid, 1177.3391,-1324.2300,14.0658);
if (spawndist[0] <= spawndist[1])
{
spawndist[0] = closestspawn;
closestspawn = 0;
print("hos 0 is closer");
}
if (spawndist[1] <= spawndist[0])
{
spawndist[1] = closestspawn;
closestspawn = 1;
print("hos 1 is closer");
}
SetPlayerPos(playerid, hspawns[closestspawn][0], hspawns[closestspawn][1], hspawns[closestspawn][2]);
SetPlayerFacingAngle(playerid, hspawns[closestspawn][3]);
SetCameraBehindPlayer(playerid);
return 1;
}