Help me here pls +rep
#1

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.");
            }
        }
    }
Reply
#2

Show the IsATaxiCar function.
Reply
#3

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

pawn Код:
if(IsATaxiCar(GetPlayerVehicleID(playerid)))
Reply
#5

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

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?
Reply
#7

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

Try making it a non else if and just a regular if
Reply
#9

First try

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)