Hospital System.
#1

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:
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;
}
And then when the timer is up it does this:
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;
}
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
Reply
#2

Mmmh, try SetTimer instead of SetTimerEx?
Reply
#3

"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...."
Reply
#4

Sorry i read it wrong, try the SetTimer if not, i don't know the problem, ur code looks good.
Reply
#5

Quote:
Originally Posted by Mariooo
Посмотреть сообщение
Mmmh, try SetTimer instead of SetTimerEx?
This will NOT fix it


do you have 'ForceClassSelection' anywhere in your script?
Reply
#6

Quote:
Originally Posted by HuSs3n
Посмотреть сообщение
This will NOT fix it


do you have 'ForceClassSelection' anywhere in your script?
I do not and no the timer didn't fix it.

Just to give you a better idea this is what happens when I die:


This is where I last /q'd and Y_INI Saved my position there
Now when I press spawn:

Reply
#7

post your OnPlayerSpawn..
Reply
#8

Already did up there but here it is again:
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);
        SetTimer("Hosptime", 30000, false);
    }
    return 1;
}
Reply
#9

well , try this
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SetSpawnInfo(playerid,0,GetPlayerSkin(playerid),1177.5485,-1323.5773,11.0761,90.0,0,0,0,0,0,0);
    PlayerInfo[killerid][Kills]++;
    PlayerInfo[playerid][Deaths]++;
    PlayerInfo[playerid][Hospital] =1;
    return 1;
}
Reply
#10

Didnt work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)