Пользователь
- Регистрация
- 12 Дек 2025
- Сообщения
- 5
- Автор темы
- #1
Как сделать, чтобы после смерти т/п в больницу?
Зарегистрировавшись у нас, вы сможете обсуждать, делиться и отправлять личные сообщения другим участникам нашего сообщества.
Зарегистрироваться!public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid, 1172.9266, -1323.8269, 15.4005); // координаты больницы лс
SetPlayerFacingAngle(playerid, 0.0);
SetPlayerHealth(playerid, 100.0);
SendClientMessage(playerid, 0x33AA33AA, "Вас доставили в больницу Лос-Сантоса.");
return 1;
}
new Float:HospitalPositions[][4] =
{
{1172.9266, -1323.8269, 15.4005, 0.0},
{-2660.8823, 609.9429, 14.4531, 0.0},
{1605.5602, 1815.2690, 10.8203, 0.0}
};
public OnPlayerDeath(playerid, killerid, reason)
{
SetTimerEx("RespawnAtHospital", 2000, false, "i", playerid);
return 1;
}
forward RespawnAtHospital(playerid);
public RespawnAtHospital(playerid)
{
new random_hospital = random(sizeof(HospitalPositions));
TogglePlayerControllable(playerid, 0);
SetPlayerPos(playerid,
HospitalPositions[random_hospital][0],
HospitalPositions[random_hospital][1],
HospitalPositions[random_hospital][2]
);
SetPlayerFacingAngle(playerid, HospitalPositions[random_hospital][3]);
SetPlayerHealth(playerid, 100.0);
SetTimerEx("EnablePlayerControl", 1000, false, "i", playerid);
SendClientMessage(playerid, 0x33AA33AA, "Вас доставили в больницу для лечения.");
return 1;
}
forward EnablePlayerControl(playerid);
public EnablePlayerControl(playerid)
{
TogglePlayerControllable(playerid, 1);
return 1;
}
через OnPlayerSpawn.
вписывай в свой мод этот код:
B pawno:public OnPlayerSpawn(playerid) { SetPlayerPos(playerid, 1172.9266, -1323.8269, 15.4005); // координаты больницы лс SetPlayerFacingAngle(playerid, 0.0); SetPlayerHealth(playerid, 100.0); SendClientMessage(playerid, 0x33AA33AA, "Вас доставили в больницу Лос-Сантоса."); return 1; }
либо c использованием OnPlayerDeath:
B pawno:new Float:HospitalPositions[][4] = { {1172.9266, -1323.8269, 15.4005, 0.0}, {-2660.8823, 609.9429, 14.4531, 0.0}, {1605.5602, 1815.2690, 10.8203, 0.0} }; public OnPlayerDeath(playerid, killerid, reason) { SetTimerEx("RespawnAtHospital", 2000, false, "i", playerid); return 1; } forward RespawnAtHospital(playerid); public RespawnAtHospital(playerid) { new random_hospital = random(sizeof(HospitalPositions)); TogglePlayerControllable(playerid, 0); SetPlayerPos(playerid, HospitalPositions[random_hospital][0], HospitalPositions[random_hospital][1], HospitalPositions[random_hospital][2] ); SetPlayerFacingAngle(playerid, HospitalPositions[random_hospital][3]); SetPlayerHealth(playerid, 100.0); SetTimerEx("EnablePlayerControl", 1000, false, "i", playerid); SendClientMessage(playerid, 0x33AA33AA, "Вас доставили в больницу для лечения."); return 1; } forward EnablePlayerControl(playerid); public EnablePlayerControl(playerid) { TogglePlayerControllable(playerid, 1); return 1; }
если помог, ставь галочку решения и лайк)