[Help]Team 1 not allowed to enter certain car?
#1

Hi all!

I need help! I have 2 teams, one team have to protect a car and the other have to steal it. How can i make it so that the protectors are not allowed to enter the vehicle.

I dont wanna use RemovePlayerFromVehicle, I just wanna stop the player from entering the vehicle in the first place...

Note: I already have my teams defined as TEAM_AGENTS and TEAM_WORKERS

Note: This is the function just like on Mini Missions, so I know it is possible, I just wanna know how to do it?
Reply
#2

Just lock the car on player spawn
Reply
#3

Right, but i only want to do it for 1 team...

+ I have used this under OnVehicleSpawn:

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    if(vehicleid == Car)
  {
    for(new i = 0; i < MAX_PLAYERS; i++) SetVehicleParamsForPlayer(vehicleid, i, true, false);
  }
    return 1;
}
Do I just copy that line and paste it under OnPlayerSpawn?

Also, i only want to lock 1 car, so how do i do that?

pawn Код:
new car;
pawn Код:
car = CreateVehicle(...);
Reply
#4

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
  if(gTeam[i] //or whatever you use
  == TEAM_SOMETHING)
  {
    SetVehicleParamsForPlayer(vehicleid, i, true, false);
  }
}
Reply
#5

But wouldnt that lock all cars?

I just wanna lock 1 car...
Reply
#6

Apply it for just that vehicleid '-.-
Reply
#7

so i would need to add this line?

pawn Код:
if(vehicleid == Car)
Reply
#8

I recommend using that OnVehicleStreamIn callback here.

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(vehicleid == Car)
    {
        if(gTeam[forplayerid] == TEAM_DEFEND) // Change it to your team you want to lock the doors
        {
            SetVehicleParamsForPlayer(vehicleid, forplayerid, 1, 1);
        }
        else
        {
            SetVehicleParamsForPlayer(vehicleid, forplayerid, 1, 0);
        }
    }
}
Reply
#9

Ok, thnx!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)