17.07.2016, 05:34
Just do this, simple.
Somewhere in your code:
OnPlayerDeath:
Should Work!
Somewhere in your code:
PHP код:
#define MAX_HOSPITALS 8
static const Float:hspawns[MAX_HOSPITALS][4] =
{
{2027.77, -1420.52, 15.99, 137.0},
{1180.85, -1325.57, 12.58, 271.4},
{1244.437, 331.2261, 18.5547, 7.5465},
{-2199.719, -2308.075, 29.6181, 322.8928},
{-2670.285, 616.4364, 13.4531, 183.1042},
{-316.3832, 1056.045, 18.7344, 1.6017},
{-1514.823, 2527.119, 54.7443, 2.3546},
{1578.446, 1770.682, 9.8358, 99.7567}
};
PHP код:
new Float:distance = 99999.0,
Float:tmp_distance,
closest = -1;
for(new i = 0; i < MAX_HOSPITALS; i++)
{
tmp_distance = GetPlayerDistanceFromPoint(playerid, hspawnsr[i][0], hspawns[i][1], hspawns[i][2]);
if (tmp_distance < distance)
{
distance = tmp_distance;
closest = i;
}
}
SetSpawnInfo(playerid, NO_TEAM, GetPlayerSkin(playerid), hspawns[closest][0],hspawns[closest][1],hspawns[closest][2],hspawns[closest][3], 0, 0, 0, 0, 0, 0);