31.12.2016, 15:09
Teleport player to the nearest hospital on death
GTA SA Singleplayer Feature
Credits to Konstantinos!GTA SA Singleplayer Feature
PHP код:
new Float:Hospitalcoor[][4] =
{
{2027.4375,-1421.0703,16.9922,137.2809}, // Los Santos Hospital
{1177.9089,-1323.9611,14.0939,269.8222}, // Los Santos Hospital #2
{1579.6106,1769.0625,10.8203,90.7178}, // Las Venturas Hospital
{-321.8259,1056.7279,19.7422,316.0064}, // Fort Carson Hospital
{-1514.8807,2527.8003,55.7315,358.6234}, // El Quebrados Hospital
{-2662.0439,630.5056,14.4531,177.8114}, // San Fierro Hospital
{-2199.2495,-2311.0444,30.6250,321.2772}, // Angel Pine Hospital
{1244.1959,332.2817,19.5547,338.3063} // Montgomery Hospital
};
public OnPlayerDeath(playerid, killerid, reason) {
new Float:distance = 99999.0,
Float:tmp_distance, closest = -1;
for (new i, j = sizeof(Hospitalcoor); i < j; i++)
{
tmp_distance = GetPlayerDistanceFromPoint(playerid, Hospitalcoor[i][0], Hospitalcoor[i][1], Hospitalcoor[i][2]);
if (tmp_distance < distance)
{
distance = tmp_distance;
closest = i;
}
}
SetSpawnInfo(playerid, NO_TEAM, GetPlayerSkin(playerid), Hospitalcoor[closest][0], Hospitalcoor[closest][1], Hospitalcoor[closest][2], Hospitalcoor[closest][3], 0, 0, 0, 0, 0, 0);
return 1;
}