SA-MP Forums Archive
Not allow to enter 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)
+--- Thread: Not allow to enter car. (/showthread.php?tid=513848)



Not allow to enter car. - Mey6155 - 18.05.2014

How can I make if the player
if(AllowTakeLCar[playerid] == 1)
he can enter and he have 0 kick him of the car.


Re: Not allow to enter car. - Mey6155 - 18.05.2014

Like I mean when he enters the car whats a drivers license car, he enters and get kicked out.


Re: Not allow to enter car. - Dziugsas - 18.05.2014

if (variable == 1)
{your code}
else if(variable == 0 )
{ RemovePlayerFromVehicle(playerid);}


Re: Not allow to enter car. - Mey6155 - 18.05.2014

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == DriversTest)
    {
        if(AllowTakeLCar[playerid] == 1)
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                SCM(playerid, -1, "Let's start the Drivers test Notes:");
                SCM(playerid, -1, "1. If you hit your car its over.");
                SCM(playerid, -1, "2. You will ride true red I will give a - point.");
                SCM(playerid, -1, "GOODLUCK!!");
            }
        }
        else if(AllowTakeLCar[playerid] == 0)
        {
            SCM(playerid, -1, "Your not taking a test!");
            return RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Not working.


Re: Not allow to enter car. - [..MonTaNa..] - 18.05.2014

Try this:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (newstate == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(vehicleid == DriversTest)
        {
            if(AllowTakeLCar[playerid] == 1)
            {
                if(IsPlayerInAnyVehicle(playerid))
                {
                    SCM(playerid, -1, "Let's start the Drivers test Notes:");
                    SCM(playerid, -1, "1. If you hit your car its over.");
                    SCM(playerid, -1, "2. You will ride true red I will give a - point.");
                    SCM(playerid, -1, "GOODLUCK!!");
                }
            }
            else if(AllowTakeLCar[playerid] == 0)
            {
                SCM(playerid, -1, "Your not taking a test!");
                return RemovePlayerFromVehicle(playerid);
            }
        }
    }
        return 1;
}



Re: Not allow to enter car. - Mey6155 - 18.05.2014

Thx.