SA-MP Forums Archive
How to eject someone from enemy team ? - 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: How to eject someone from enemy team ? (/showthread.php?tid=138178)



How to eject someone from enemy team ? - samuel_hamza - 31.03.2010

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!


Re: How to eject someone from enemy team ? - Last_Stand_Guardian - 31.03.2010

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



Re: How to eject someone from enemy team ? - wafffllesss - 31.03.2010

WARNING

vehicleid IS NOT vehicle model.

I Recommend you to use:

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



Re: How to eject someone from enemy team ? - Last_Stand_Guardian - 31.03.2010

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

Thanks Waff =D


Re: How to eject someone from enemy team ? - wafffllesss - 31.03.2010

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.


Re: How to eject someone from enemy team ? - Last_Stand_Guardian - 31.03.2010

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


Re: How to eject someone from enemy team ? - samuel_hamza - 31.03.2010

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



Re: How to eject someone from enemy team ? - bpeterson - 01.04.2010

You also forgot to get the player's vehicleid.


Re: How to eject someone from enemy team ? - Last_Stand_Guardian - 01.04.2010

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 ^^


Re: How to eject someone from enemy team ? - samuel_hamza - 01.04.2010

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.