Please Help Me With This Hosptal System. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Please Help Me With This Hosptal System. (
/showthread.php?tid=141368)
Please Help Me With This Hosptal System. -
Keeboo13 - 13.04.2010
My script has where player can visit hospital but when the player is in the hospital he stays for 1 second then he spawn to regular spot he suposed to spawn to outside the hospital any help please....Heres my code...
forward
Код:
forward ReleaseFromHospital(playerid);
OnPlayerDeath
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new rand;
new string[256];
new cut = deathcost; //PlayerInfo[playerid][pLevel]*deathcost;
PlayerInfo[playerid][pDeaths] += 1;
GivePlayerMoney(playerid, -cut);
format(string, sizeof(string), "DOC: Your Medical Bill comes to $%d, Have a nice day.", cut);
SendClientMessage(playerid, TEAM_CYAN_COLOR, string);
PlayerInfo[playerid][pDeaths] += 1;
SetPlayerHealth(playerid, 100);
SetPlayerInterior(playerid, 18);
rand = random(sizeof(gMedicSpawns));
SetPlayerPos(playerid, gMedicSpawns[rand][0], gMedicSpawns[rand][1], gMedicSpawns[rand][2]); // Warp the player
SetPlayerFacingAngle(playerid, 270.0);
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~You need to rest now ...", 5000, 3);
SetTimerEx("ReleaseFromHospital", 10000, 0, "d", playerid);
PlayerPlaySound(playerid, 1062, 0.0, 0.0, 0.0);
SetPlayerColor(playerid,COLOR_GRAD2);
return 1;
}
Public
Код:
public ReleaseFromHospital(playerid)
{
SendClientMessage(playerid, COLOR_RED, "You have been released from Hospital.");
TogglePlayerControllable(playerid, 1);
SetCameraBehindPlayer(playerid);
SetPlayerHealth(playerid, 50.0);
new decidehosp = random(2);
switch(decidehosp)
{
case 0:
{
SetPlayerPos(playerid, 1177.4866,-1323.9749,14.0731);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerInterior(playerid, 0);
ResetPlayerWeapons(playerid);
}
case 1:
{
SetPlayerPos(playerid, 2025.1497,-1402.8643,17.2089);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerInterior(playerid, 0);
ResetPlayerWeapons(playerid);
}
}
return 1;
}
Re: Please Help Me With This Hosptal System. -
cessil - 13.04.2010
random(2);
should be
random(1);
also putting
SetPlayerPos(playerid, gMedicSpawns[rand][0], gMedicSpawns[rand][1], gMedicSpawns[rand][2]);
in OnPlayerDeath and returning 1 will trigger off the OnPlayerSpawn, so put the SetPlayerPos in OnPlayerSpawn
Re: Please Help Me With This Hosptal System. -
Thrarod - 13.04.2010
Yes because random(2) gives 0,1,2