How to eject someone from enemy team ?
#1

Well, I know how to use gteam, and use ''OnPlayerEnterVehicle''
I know to tell him when he get in the car that he don't have right to drive it, but I highly doubt he will get out from car
So, I need some ligne to eject

if(playerid && vehicleid == 520)
{


Thanks!
Reply
#2

for example:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
       if(GetPlayerVehicleID(playerid) == IDofTheCar)
       {
           if(gTeam[playerid] != NumberOfTheTeam)
           {
              RemovePlayerFromVehicle(playerid);
           }
       }
    }
    return 1;
}
Reply
#3

WARNING

vehicleid IS NOT vehicle model.

I Recommend you to use:

OnVehicleStreamIn()
pawn Код:
if(gteam[playerid] != TEAMID){
    SetVehicleParamsForPlayer(forplayerid,vehicleid,0,1);
  }
Reply
#4

My code would also work, but his code is shorter and better xD

Thanks Waff =D
Reply
#5

Quote:
Originally Posted by Last_Stand_Guardian
My code would also work, but his code is shorter and better xD

Thanks Waff =D
Yeah your code should work but i don't like to let the player enter the vehicle just to remove them and say they're not authorized to enter that vehicle.
Reply
#6

Yes I agree, but the only disadvantage is that they also couldn't enter as passenger xD

But! Last but not least your code is best ^^ =D
Reply
#7

Well I have many team, so I want every player get ejected from car.

So should I do this script ?

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
       if(GetPlayerVehicleID(playerid) == IDofTheCar)
       {
           if(gTeam[playerid] != Number of team who own this car)
           {
              SendClientMessage(playerid, COLOR_GREEN, Welcome in LVPD cruiser)
           }
          else
          {
             RemovePlayerFromVehicle(playerid);
          }
       }
    }
    return 1;
}
Reply
#8

You also forgot to get the player's vehicleid.
Reply
#9

Quote:
Originally Posted by samuel_hamza
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
       if(GetPlayerVehicleID(playerid) == IDofTheCar)
       {
           if(gTeam[playerid] != Number of team who own this car)
           {
              SendClientMessage(playerid, COLOR_GREEN, Welcome in LVPD cruiser)
           }
           else
           {
              RemovePlayerFromVehicle(playerid);
           }
       }
    }
    return 1;
}
This means: Every team-member get ejected and others not xD
--> Replace: != by ==

Every player ejected? Then use waff's code, so they don't even enter the car ^^
Reply
#10

I meant every players get ejected except the team.
Like the police and FBI want to get ambulance, but suddenly they get ejected.
And when medic get in ambulance, they could drive it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)