SA-MP Forums Archive
Help me here pls +rep - 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: Help me here pls +rep (/showthread.php?tid=325507)



Help me here pls +rep - N0FeaR - 13.03.2012

Whats the problem here, cus when you are not a taxi driver you can still drive it whats the problem in this code?
pawn Код:
else if(newstate == PLAYER_STATE_DRIVER)
    {
        if(IsATaxiCar(GetPlayerVehicleID(playerid))==420) //if Vehicle model that player enter is taxi
        {
            if( PlayerInfo[ playerid ][ pJob ] != 2 ) //if Player job is not "2" or "taxi driver (maybe)"
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this car.");
            }
        }
    }



Re: Help me here pls +rep - T0pAz - 13.03.2012

Show the IsATaxiCar function.


Re: Help me here pls +rep - N0FeaR - 13.03.2012

pawn Код:
}
public IsATaxiCar(carid)
{
    new model = GetVehicleModel(carid);
    if(model == 420)
    {
        return 1;
    }
    return 0;
}



Re: Help me here pls +rep - T0pAz - 13.03.2012

pawn Код:
if(IsATaxiCar(GetPlayerVehicleID(playerid)))



Re: Help me here pls +rep - N0FeaR - 13.03.2012

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
pawn Код:
if(IsATaxiCar(GetPlayerVehicleID(playerid)))
Still same problem i can still drive taxi when im not taxi driver why?


Re: Help me here pls +rep - T0pAz - 13.03.2012

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
Still same problem i can still drive taxi when im not taxi driver why?
The code above looks fine. Are you sure that the id of the job is 2?


Re: Help me here pls +rep - N0FeaR - 13.03.2012

Yes cus i try when i dont have any job... cus want so only taxi driver can drive it.


Re: Help me here pls +rep - [ABK]Antonio - 13.03.2012

Try making it a non else if and just a regular if


Re: Help me here pls +rep - suhrab_mujeeb - 13.03.2012

First try

pawn Код:
else if(IsATaxiCar(GetPlayerVehicleID(playerid)) == 1)
If still doesnt work change the 'else if' to 'if' only..


Re: Help me here pls +rep - [ABK]Antonio - 13.03.2012

Quote:
Originally Posted by suhrab_mujeeb
Посмотреть сообщение
First try

pawn Код:
else if(IsATaxiCar(GetPlayerVehicleID(playerid)) == 1)
If still doesnt work change the 'else if' to 'if' only..
pawn Код:
else if(IsATaxiCar(GetPlayerVehicleID(playerid)) == 1)
and

pawn Код:
else if(IsATaxiCar(GetPlayerVehicleID(playerid)))
are the same thing btw