13.09.2012, 18:54
I've been trying to create a hospital system that when you die it will send to you to All Saints Hospital and set the camera pos looking at it from above. It Should keep you in the hospital for 30 seconds and then spawn you infront of it. but it doesnt.. It brings the player to the login screen and takes them to their last position and it has the two arrows and the spawn buttons....
I have under the enum pInfo: "Hospital" and it gets set to 1 if you are killed:
And then in onplayerspawn it checks if you are set to 1 And if you are it should do this:
And then when the timer is up it does this:
There are no errors or warnings.. If just doesnt seem to work in game. So if you know how I can make this work it would be appreciated if you could help me
I have under the enum pInfo: "Hospital" and it gets set to 1 if you are killed:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][Kills]++;
PlayerInfo[playerid][Deaths]++;
PlayerInfo[playerid][Hospital] =1;
return 1;
}
And then in onplayerspawn it checks if you are set to 1 And if you are it should do this:
pawn Код:
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][Hospital] == 1)
{
SendClientMessage(playerid, COLOR_RED, "You have been sent to the hospital");
SetPlayerPos(playerid, 1177.5485,-1323.5773,11.0761);
SetPlayerCameraPos(playerid,1223.2250,-1289.4913,31.9257);
SetPlayerCameraLookAt(playerid,1177.5485,-1323.5773,14.0761);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 0);
SetTimerEx("Hosptime", 30000, false, "d", playerid);
}
return 1;
}
pawn Код:
forward Hosptime(playerid);
public Hosptime(playerid)
{
PlayerInfo[playerid][Hospital] =0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
SetPlayerHealth(playerid, 40);
SetPlayerArmour(playerid, 0);
SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
SetPlayerPos(playerid,1176.7356,-1323.7495,14.0360);
return 1;
}