Why this script dont work and all players can enter in the cars ?
#1

PHP код:
enum jobInfo2
{
    
jtCars[17]

PHP код:
new JobInfo2[MAX_JOBS][jobInfo2]; 
PHP код:
    JobInfo2[JOB_TAXIDRIVER][jtCars][0] = CreateVehicle(420, -304.87411582.225675.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][1] = CreateVehicle(420, -302.74241579.938575.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][2] = CreateVehicle(420, -300.11501577.480575.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][3] = CreateVehicle(420, -297.63671574.872775.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][4] = CreateVehicle(420, -295.07441572.385475.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][5] = CreateVehicle(420, -292.69531570.136575.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][6] = CreateVehicle(420, -290.10471567.647275.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][7] = CreateVehicle(420, -287.62071565.013575.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][8] = CreateVehicle(420, -285.14601562.537175.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][9] = CreateVehicle(420, -282.73101560.144775.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][10] = CreateVehicle(420, -280.24101557.377875.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][11] = CreateVehicle(420, -277.78271555.076775.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][12] = CreateVehicle(420, -275.39171552.376275.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][13] = CreateVehicle(420, -270.41981547.502675.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][14] = CreateVehicle(420, -273.04691549.863675.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][15] = CreateVehicle(420, -265.50281542.348075.0000, -45.000066100);
    
JobInfo2[JOB_TAXIDRIVER][jtCars][16] = CreateVehicle(420, -268.06581544.938875.0000, -45.000066100); 
PHP код:
stock IsTaxiVehicle(vehicleid)
{
    for(new 
i=0i<10i++)
    {
        if(
vehicleid == JobInfo2[JOB_TAXIDRIVER][jtCars][i]) return 1;
    }
    return 
0;

PHP код:
        else if(IsTaxiVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TAXIDRIVER)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the Taxi Drivers.");
        } 
Reply
#2

RemovePlayerFromVehicle?
Reply
#3

Is this called in this callback?
pawn Код:
OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
If it is, try this.

pawn Код:
else if(IsTaxiVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TAXIDRIVER)
        {
            ClearAnimations(playerid);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the Taxi Drivers.");
        }
Reply
#4

dont work and it is called in this callback
Reply
#5

In the enum, jtCars can store 17 cars and in IsTaxiVehicle you loop only 10 times so if the car is one of the rest (7) cars, it will just ignore it.

pawn Код:
stock IsTaxiVehicle(vehicleid)
{
    for(new i=0; i<17; i++)
    {
        if(vehicleid == JobInfo2[JOB_TAXIDRIVER][jtCars][i]) return 1;
    }
    return 0;
}
Reply
#6

Try this:
pawn Код:
else if(IsTaxiVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TAXIDRIVER)
        {
            new engine,lights,alarm,doors,bonnet,boot,objective;
            GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the Taxi Drivers.");
        }
Reply
#7

@Konstantinos it dont work with your script....
Reply
#8

Quote:
Originally Posted by barts
Посмотреть сообщение
@Konstantinos it dont work with your script....
Do you get the message " You can't start the engine as it belongs to the Taxi Drivers."? If not, there's another problem.
Reply
#9

There are 16 cars and you are checking only the first 11 cars!
Reply
#10

No i dont get message....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)