Detecting if player crashed in wall/etc...
#1

i read OnPlayerStateChange on SA-MP Wiki however
the code i made is not working the helmet is still on attached in players head
i get the few helmet codes from MasterJoker's Helmet [FS] i modify it

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vid = GetPlayerVehicleID(playerid);
    new Float:hp;
    GetPlayerHealth(playerid, hp);
    if(GetVehicleModel(vid) == 448 || GetVehicleModel(vid) == 461 || GetVehicleModel(vid) == 462
    || GetVehicleModel(vid) == 463 || GetVehicleModel(vid) == 468 || GetVehicleModel(vid) == 471
    || GetVehicleModel(vid) == 481 || GetVehicleModel(vid) == 509 || GetVehicleModel(vid) == 510
    || GetVehicleModel(vid) == 521 || GetVehicleModel(vid) == 522 || GetVehicleModel(vid) == 523 ||
    GetVehicleModel(vid) == 571 || GetVehicleModel(vid) == 581 || GetVehicleModel(vid) == 586)
    {
        if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
        {
            SetPlayerHealth(playerid, hp - 1.8);
            pInfo[playerid][WearingHelmet] = false;
            if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
        }
    }
    return 1;
}
Reply
#2

pawn Код:
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
{
     pInfo[playerid][WearingHelmet] = false;
     if( IsPlayerAttachedObjectSlotUsed( playerid, 1 ) )
            RemovePlayerAttachedObject( playerid, 1 );
}
As simple as that.
Reply
#3

Thanks rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)