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


Messages In This Thread
Detecting if player crashed in wall/etc... - by RollTi - 24.04.2012, 06:53
Respuesta: Detecting if player crashed in wall/etc... - by Marricio - 24.04.2012, 07:27
Re: Detecting if player crashed in wall/etc... - by RollTi - 24.04.2012, 07:32

Forum Jump:


Users browsing this thread: 1 Guest(s)