Hospital problem
#1

Hello, I am making a RP script from scratch, but I have a little problem.

When I die, I don't go to hospital. I just spawn normally.
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PInfo[playerid][AdminDuty] == 1)
    {
        label[playerid] = Create3DTextLabel("On-Duty admin, do not attack",0x008080FF,30.0,40.0,50.0,40.0,0);
        Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
        SetPlayerSkin(playerid, 217);
        SetPlayerHealth(playerid, 10000);
        GivePlayerWeapon(playerid, WEAPON_MINIGUN, 100000);
    }
    SetTimerEx( "HospitalTimer2", 1000, 0, "d", playerid );
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    PInfo[playerid][Deaths]++;
    PInfo[killerid][Kills]++;
    PInfo[ playerid ][ ForHospital ] = 1;
    return 1;
}
pawn Код:
public HospitalTimer( playerid )
{
    TogglePlayerControllable( playerid, 1 );
    GameTextForPlayer( playerid, "Realased from hospital", 3000, 6 );
    SpawnPlayer( playerid );
    return 1;
}

public HospitalTimer2( playerid )
{
    if( PInfo[ playerid ][ ForHospital ] == 1 )
    {
        TogglePlayerControllable( playerid, 0 );
        SetPlayerPos( playerid, 2309.0232,-1142.1338,1055.1511 );
        SetPlayerInterior( playerid, 12 );
        SetPlayerFacingAngle( playerid, 359.8549 );
        SetPlayerCameraLookAt( playerid, 2309.0232,-1142.1338,1055.1511 );
        GameTextForPlayer( playerid, "You are in hospital now, please wait for doctors to cure you", 3000, 6 );
        SetTimerEx( "HospitalTimer", 60*1000, 0, "d", playerid );
        PInfo[ playerid ][ ForHospital ] = 0;
    }
    return 1;
}
AnyHelp?
Reply
#2

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PInfo[playerid][AdminDuty] == 1)
    {
        label[playerid] = Create3DTextLabel("On-Duty admin, do not attack",0x008080FF,30.0,40.0,50.0,40.0,0);
        Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
        SetPlayerSkin(playerid, 217);
        SetPlayerHealth(playerid, 10000);
        GivePlayerWeapon(playerid, WEAPON_MINIGUN, 100000);
    }
    if(PlayerInfo[playerid][ForHospital] == 1)
    {
         SetTimerEx( "HospitalTimer2", 1000, 0, "d", playerid );
    }
    return 1;
}



public HospitalTimer2( playerid )
{
        TogglePlayerControllable( playerid, 0 );
        SetPlayerPos( playerid, 2309.0232,-1142.1338,1055.1511 );
        SetPlayerInterior( playerid, 12 );
        SetPlayerFacingAngle( playerid, 359.8549 );
        SetPlayerCameraLookAt( playerid, 2309.0232,-1142.1338,1055.1511 );
        GameTextForPlayer( playerid, "You are in hospital now, please wait for doctors to cure you", 3000, 6 );
        SetTimerEx( "HospitalTimer", 60*1000, 0, "d", playerid );
        PInfo[ playerid ][ ForHospital ] = 0;
    return 1;
}
I guess that's the problem
I changed the spital check.I moved it at OnPlayerSpawn
Reply
#3

Will try later. Will say here if it did work. Can't now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)