SA-MP Forums Archive
[HELP] Script is acting wierd - 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] Script is acting wierd (/showthread.php?tid=319591)



[HELP] Script is acting wierd - Nuke547 - 19.02.2012

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);
            }
           } 



Re: [HELP] Script is acting wierd - V_LOPE - 19.02.2012

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


Re: [HELP] Script is acting wierd - Madd Kat - 19.02.2012

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

HTHs


Re: [HELP] Script is acting wierd - aRoach - 19.02.2012

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;
}



Re: [HELP] Script is acting wierd - ReneG - 19.02.2012

Nevermind.


Re: [HELP] Script is acting wierd - Universal - 19.02.2012

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);
    }
}



Re: [HELP] Script is acting wierd - Madd Kat - 19.02.2012

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);
}



Re: [HELP] Script is acting wierd - aRoach - 19.02.2012

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;
}



Re: [HELP] Script is acting wierd - Nuke547 - 19.02.2012

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


Re: [HELP] Script is acting wierd - Universal - 19.02.2012

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?