SA-MP Forums Archive
Eject if player is driver. Car locks - 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)
+--- Thread: Eject if player is driver. Car locks (/showthread.php?tid=310918)



Eject if player is driver. Car locks - milanosie - 14.01.2012

Hello there, Me and a friend are making a new gamemode but I have a li'l question.

For the vehicle locks I use this code:
Code:
{
	if(vteam[GetPlayerVehicleID(playerid)] == 1)
	{
  		if(PlayerInfo[playerid][Fmember] == 1 || PlayerInfo[playerid][Fleader] == 1)
  		{
    		SendClientMessage(playerid, 0x999999AA, "U started this police car!");
  		}
		else
		{
    		RemovePlayerFromVehicle(playerid);
    		TogglePlayerControllable(playerid, 1);
    		SendClientMessage(playerid, 0x999999AA, "You don't have the key of this vehicle.");
  		}
      }
	}
But now, Even passengers who aren't Fmember == 1 get ejected, How do I make it so that only the driver gets ejected from the car when he is no fMember 1?


Re: Eject if player is driver. Car locks - spedico - 14.01.2012

pawn Code:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
    // stuff here
}



Re: Eject if player is driver. Car locks - Mean - 14.01.2012

pawn Code:
if(vteam[GetPlayerVehicleID(playerid)] == 1) {
    if(PlayerInfo[playerid][Fmember] == 1 || PlayerInfo[playerid][Fleader] == 1) SendClientMessage(playerid, 0x999999AA, "You started this police car!");
    else {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid, 1);
            SendClientMessage(playerid, 0x999999AA, "You don't have the key of this vehicle.");
        }
    }
}