If the vehicle health lower than 250, remove the player
#6

Quote:
Originally Posted by LivingLikeYouDo
Посмотреть сообщение
@Raweresh - Why not RemovePlayerFromVehicle?

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new Float:health;
        GetVehicleHealth(GetPlayerVehicleID(playerid), health);
        if(health < 300.0)
        {
            printf("DEBUG: Removed player %d from vehicle due to low health", playerid); //For debug purposes (optional)
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Should work^^ If the player is not removed from the vehicle and the debug is shown, please post below.
Thanks but still it's not removing the player from the vehicle.

Here's my current OnPlayerStateChange, if you want it.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if((newstate == PLAYER_STATE_DRIVER) && IsABumperCar(GetPlayerVehicleID(playerid)))
    {
        if(!pChip[playerid] || bRoundStarted) { RemovePlayerFromVehicle(playerid); }
        else
        {
            SendClientMessage(playerid,0xFFFFFFAA,"* You inserted your chip into the car");
            SendClientMessage(playerid,0xFFFFFFAA,"* Please wait for the next round.");
            pChip[playerid]=0;
            TogglePlayerControllable(playerid,0);
        }
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)