[HELP] Script is acting wierd
#1

So basically, I'm trying to work on a taxi job, and I want it to check if either your first or second job is a taxi driver.
Basically, one you get in with either job as a taxi driver, it says "You are now accepting taxi calls!", but a second later, it says "You must be a taxi driver to drive a taxi!" and kicks you out. Can you please tell me why?
PHP код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
           {
               if(
Player[playerid][Job] == || Player[playerid][Job2] == 8)
               {
                   
SendClientMessage(playeridWHITE"You are now accepting taxi calls!");
                   
OnTaxiDuty[playerid] = 1;
            }
            else
            {
                
SendClientMessage(playeridWHITE"You must be a taxi driver to drive a taxi!");
                
RemovePlayerFromVehicle(playerid);
            }
           } 
Reply
#2

pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
           {
               if(Player[playerid][Job] == 8 || Player[playerid][Job2] == 8)
               {
                   SendClientMessage(playerid, WHITE, "You are now accepting taxi calls!");
                   OnTaxiDuty[playerid] = 1;
            }
            else
            {
                if(OnTaxiDuty[playerid] == 0)
                {
                  SendClientMessage(playerid, WHITE, "You must be a taxi driver to drive a taxi!");
                  RemovePlayerFromVehicle(playerid);
                }
            }
           }
Try this one
Reply
#3

yeah do another check with
pawn Код:
OnTaxiDuty[playerid] = 1;
check this is 1 and if so skip all that code

HTHs
Reply
#4

Try this:
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
    if(Player[playerid][Job] == 8 && Player[playerid][Job2] == 8)
    {
        SendClientMessage(playerid, WHITE, "You are now accepting taxi calls!");
        OnTaxiDuty[playerid] = 1;
    }
    else
    {
        SendClientMessage(playerid, WHITE, "You must be a taxi driver to drive a taxi!");
        RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
Reply
#5

Nevermind.
Reply
#6

Quote:
Originally Posted by aRoach
Посмотреть сообщение
Try this:
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
    if(Player[playerid][Job] == 8 && Player[playerid][Job2] == 8)
    {
        SendClientMessage(playerid, WHITE, "You are now accepting taxi calls!");
        OnTaxiDuty[playerid] = 1;
    }
    else
    {
        SendClientMessage(playerid, WHITE, "You must be a taxi driver to drive a taxi!");
        RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
This will require you to be a Taxi Driver in your BOTH jobs which isnt what he wants to achieve.
Try this:
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
    if(Player[playerid][Job] == 8 || Player[playerid][Job2] == 8)
    {
       SendClientMessage(playerid, WHITE, "You are now accepting taxi calls!");
       OnTaxiDuty[playerid] = 1;
    }
    else
    {
        SendClientMessage(playerid, WHITE, "You must be a taxi driver to drive a taxi!");
        RemovePlayerFromVehicle(playerid);
    }
}
Reply
#7

after looking again your missing a closing tag on the if statement

pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
   if(Player[playerid][Job] == 8 || Player[playerid][Job2] == 8)
   {
   SendClientMessage(playerid, WHITE, "You are now accepting taxi calls!");
   OnTaxiDuty[playerid] = 1;
   }
}
else
{
    SendClientMessage(playerid, WHITE, "You must be a taxi driver to drive a taxi!");
    RemovePlayerFromVehicle(playerid);
}
Reply
#8

Quote:
Originally Posted by Universal
Посмотреть сообщение
This will require you to be a Taxi Driver in your BOTH jobs.
You're right, failed...

Try this... :
pawn Код:
if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 420 )
{
    if( ( Player[ playerid ][ Job ] != 8 ) || ( Player[ playerid ][ Job2 ] != 8 ) )
    {
        SendClientMessage( playerid, WHITE, "You must be a taxi driver to drive a taxi!" );
        RemovePlayerFromVehicle( playerid );
        return 0;
    }
    else
    {
        SendClientMessage( playerid, WHITE, "You are now accepting taxi calls!" );
        OnTaxiDuty[ playerid ] = 1;
    }
    return 1;
}
Reply
#9

So far, most of those didnt work, but I'm still testing some.
Reply
#10

Quote:
Originally Posted by Nuke547
Посмотреть сообщение
None of those worked. The problem is, when both my jobs are 8, then it works, but otherwise, it still kicks me out
Are you sure you are setting everything correctly? May we take a look at the code where you set the job?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)