Check if player inside a taxi and has it's job
#1

Thats the stock itself

PHP код:
IsPlayerInsideTaxi(playerid)
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if (
GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 438)
    {
        foreach (new 
Player)
        {
            if ((
!= playerid) && (PlayerData[i][pJob] == JOB_TAXI && PlayerData[i][pTaxiDuty] && GetPlayerState(i) == PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == vehicleid)
                return 
1;
        }
    }
    return 
0;

Now how I can do that if the player isn't has a taxi job (JOB_TAXI) it will return an error message and kick him out of the taxi. + rep for helpers
Reply
#2

Why are you looping there?

I don't understand...
Reply
#3

Your function is checking if the player is in a taxi with a taxi driver in it. I think. At least, that what's I understand from that code. So.. what exactly do you want to do with that function?
Reply
#4

Quote:
Originally Posted by Denying
Посмотреть сообщение
Your function is checking if the player is in a taxi with a taxi driver in it. I think. At least, that what's I understand from that code. So.. what exactly do you want to do with that function?
I want it to check if the player hasn't possessing the job of the taxi driver, and if not it will eject him out of the taxi.
Reply
#5

Oh, that's easy then.

Put in OnPlayerEnterVehicle the following:
Код:
if((GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 438) && PlayerData[playerid][pJob] != JOB_TAXI)
{
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, -1, "Error: You are not a taxi driver!");
}
Reply
#6

PHP код:
IsPlayerInsideTaxi(playerid)
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if (
GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 438)
    {
        if(
PlayerData[playerid][pJob] == JOB_TAXI && PlayerData[playerid][pTaxiDuty])return 1;
    }
    return 
0;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)