SA-MP Forums Archive
[Help]Team 1 not allowed to enter certain car? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help]Team 1 not allowed to enter certain car? (/showthread.php?tid=106965)



[Help]Team 1 not allowed to enter certain car? - Tigerbeast11 - 07.11.2009

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?


Re: [Help]Team 1 not allowed to enter certain car? - dice7 - 07.11.2009

Just lock the car on player spawn


Re: [Help]Team 1 not allowed to enter certain car? - Tigerbeast11 - 07.11.2009

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(...);



Re: [Help]Team 1 not allowed to enter certain car? - dice7 - 07.11.2009

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



Re: [Help]Team 1 not allowed to enter certain car? - Tigerbeast11 - 07.11.2009

But wouldnt that lock all cars?

I just wanna lock 1 car...


Re: [Help]Team 1 not allowed to enter certain car? - dice7 - 07.11.2009

Apply it for just that vehicleid '-.-


Re: [Help]Team 1 not allowed to enter certain car? - Tigerbeast11 - 07.11.2009

so i would need to add this line?

pawn Код:
if(vehicleid == Car)



Re: [Help]Team 1 not allowed to enter certain car? - MadeMan - 07.11.2009

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);
        }
    }
}



Re: [Help]Team 1 not allowed to enter certain car? - Tigerbeast11 - 07.11.2009

Ok, thnx!