RemovePlayerFromVehicle
#1

Hi, how i could "exit" some1 from a vehicle like:

*i am civilian*, *enter a PD CAR* *i got removed from it* and give a message like "This car is just for the BCSD and reserver it just for the cop skins?
Reply
#2

OnPlayerStateChange > If PLAYER_STATE_DRIVER > GetPlayerVehicleId > If GetVehicleModel = Police Cars > GetPlayerSkin > If NOT Police Skin > RemovePlayerFromVehicle > SendClientMessage

Make an attempt to script it yourself, that's the only way you'll learn. If you have any further questions or problems with your code, edit your original topic and bump the thread.
Reply
#3

pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerVehicleID(playerid) == lawveh && GetPlayerSkin(playerid) == policeskinid)// change the var to the law vehs var or smthn
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
}
Reply
#4

post a example plz...
Reply
#5

pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(IsCopCar(GetPlayerVehicleID(playerid)) && !IsCopSkin(GetPlayerSkin(playerid)))//is its a law vehicle and he is not wearing a cop skin
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
}

stock IsCopCar(carid)
{
  new Operative[] = { 523, 427, 490, 528, 596, 597, 598, 599 };
  for(new i = 0; i < sizeof(Operative); i++)
  {
    if(GetVehicleModel(carid) == Operative[i]) return 1;
  }
  return 0;
}

stock IsCopSkin(skinid)
{
  new Operative[] = { 165, 166, 280, 281, 282, 283, 288, 284, 285, 286, 287 };
  for(new i = 0; i < sizeof(Operative); i++)
  {
    if(skinid == Operative[i]) return 1;
  }
  return 0;
}
Reply
#6

Hi

I'll teach you how to create cars for factions

Its very easy, Here's what you have to do
First assign a variable for the cars, LSPDcar for ex.

pawn Код:
new LSPDcar[3]
Now lets define these variables

pawn Код:
LSPDcar[0] = AddStaticVehicle(coords and modelid goes here)
// and so on
Now you need to paste this
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)//It means when player's state changes to drivers position
    {
        new Vehid = GetPlayerVehicleID(playerid);//Defining variable Vehid, So Vehid means GetVehicleID
        if(Vehid == LSPDcar[0] && if(PlayerInfo[playerid][pmember] != 1)// if vehicle Id is equal to LSPD car & player is NOT in police
        {
            RemovePlayerFromVehicle(playerid);//GTFO from this car
            SendClientMessage(playerid, color_red, "You're not in LSPD Dumbass!");// Lol
        }
    }
    return 1;
}
PS: I don't understand the 'skin' thingy you asked...
Reply
#7

Quote:
Originally Posted by THE_KNOWN
Посмотреть сообщение
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(IsCopCar(GetPlayerVehicleID(playerid)) && !IsCopSkin(GetPlayerSkin(playerid)))//is its a law vehicle and he is not wearing a cop skin
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
}

stock IsCopCar(carid)
{
  new Operative[] = { 523, 427, 490, 528, 596, 597, 598, 599 };
  for(new i = 0; i < sizeof(Operative); i++)
  {
    if(GetVehicleModel(carid) == Operative[i]) return 1;
  }
  return 0;
}

stock IsCopSkin(skinid)
{
  new Operative[] = { 165, 166, 280, 281, 282, 283, 288, 284, 285, 286, 287 };
  for(new i = 0; i < sizeof(Operative); i++)
  {
    if(skinid == Operative[i]) return 1;
  }
  return 0;
}
That will block the ENTIRE range of cars with that model ID, For ex.
If i buy a LVPD crusier, I'll need to be in LSPD in order to use it...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)