Car doors locked animation (Need help to apply animation)
#1

I want to make a script. Now i have lock and unlock command for car. When the car is locked from somewho, than other players can not enter the vehicle, but they not play the animation for locked doors. So i want to add this:

theres an standard lock unlock command under OnPlayerCommandText:
pawn Code:
if (strcmp(cmdtext, "/lock", true)==0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER)
            {
                SendClientMessage(playerid, GREY,"You can only lock the doors as the driver.");
                return 1;
            }
            new i;
            for(i=0;i<MAX_PLAYERS;i++)
            {
                if(i != playerid)
                {
                    SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
                }
            }
            new Float:X,Float:Y,Float:Z;
            SendClientMessage(playerid, GREY, "Vehicle locked!");
            GetPlayerPos(playerid,X,Y,Z);
            PlayerPlaySound(playerid,1056,X,Y,Z);
        }
        else
        {
            SendClientMessage(playerid, GREY, "You're not in a vehicle!");
        }
      return 1;
    }

  if (strcmp(cmdtext, "/unlock", true)==0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER)
            {
                SendClientMessage(playerid, GREY,"You can only unlock the doors as the driver.");
                return 1;
            }
            new i;
            for(i=0;i<MAX_PLAYERS;i++)
            {
                SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0);
            }
            new Float:X,Float:Y,Float:Z;
            SendClientMessage(playerid, GREY, "Vehicle unlocked!");
            GetPlayerPos(playerid,X,Y,Z);
            PlayerPlaySound(playerid,1057,X,Y,Z);
        }
        else
        {
            SendClientMessage(playerid, GREY, "You're not in a vehicle!");
        }
      return 1;
    }
So how can i make script that if somewho want to enter in locked vehicle, that he will play an animation of locked doors?

I tried with this but i dont know what i must to add near vehicleid == !!
pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if(vehicleid == [color=red]?[/color])
  {
    ApplyAnimation(playerid, "PED", "CAR_doorlocked_LHS or CAR_doorlocked_RHS ", 1, 0, 0, 0, 0, 1);
    SetVehicleParamsForPlayer(vehicleid, playerid, 0, 1);
  }
  return 1;
}
but...

thank you for help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)