15.12.2017, 16:22
Primeiramente a public OnPlayerDeath..
Agora a public OnPlayerSpawn
Criei esse stock caso queira adicionar em mais locais
Код:
public OnPlayerDeath(playerid, killerid, reason) { GetProxHosp(playerid); }
Код:
public OnPlayerSpawn(playerid) { if(GetPVarType(playerid, "HospPosA") == PLAYER_VARTYPE_FLOAT) { SetPlayerPos(playerid, GetPVarFloat(playerid, "HospPosX"), GetPVarFloat(playerid, "HospPosY"), GetPVarFloat(playerid, "HospPosZ")); SetPlayerFacingAngle(playerid, GetPVarFloat(playerid, "HospPosA")); DeletePVar(playerid, "HospPosX"); DeletePVar(playerid, "HospPosY"); DeletePVar(playerid, "HospPosZ")); DeletePVar(playerid, "HospPosA"); } }
Код:
stock GetProxHosp(playerid) { if(!IsPlayerConnected(playerid)) return 0; new Float:Hospital[][4] = { {-2651.6501, 634.451000, 14.4531, 180.0}, {1173.58420, -1324.5615, 15.1953, 270.0}, {2031.94150, -1404.3578, 17.2614, 165.0}, {1582.56150, 1768.79210, 10.8203, 90.00}, {-318.81500, 1050.88900, 20.3403, 360.0}, {-1514.7959, 2522.85060, 55.8246, 0.000}, {-2200.2214, -2306.5452, 30.6250, 320.0}, {1242.37130, 328.452000, 19.7555, 335.0} }; new hospitalproximo; for(new hospid = 0, Float:prevdist, Float:dist; hospid < sizeof(Hospital); hospid++) { dist = GetPlayerDistanceToPoint(playerid, Hospital[hospid][0], Hospital[hospid][1], Hospital[hospid][2]); if(hospid == 0 || dist < prevdist) prevdist = dist, hospitalproximo = hospid; } SetPVarFloat(playerid, "HospPosX", Hospital[hospitalproximo][0]); SetPVarFloat(playerid, "HospPosY", Hospital[hospitalproximo][1]); SetPVarFloat(playerid, "HospPosZ", Hospital[hospitalproximo][2]); SetPVarFloat(playerid, "HospPosA", Hospital[hospitalproximo][3]); return 1; }