Why this script dont work and all players can enter in the cars ? -
barts - 26.01.2014
PHP код:
enum jobInfo2
{
jtCars[17]
}
PHP код:
new JobInfo2[MAX_JOBS][jobInfo2];
PHP код:
JobInfo2[JOB_TAXIDRIVER][jtCars][0] = CreateVehicle(420, -304.8741, 1582.2256, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][1] = CreateVehicle(420, -302.7424, 1579.9385, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][2] = CreateVehicle(420, -300.1150, 1577.4805, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][3] = CreateVehicle(420, -297.6367, 1574.8727, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][4] = CreateVehicle(420, -295.0744, 1572.3854, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][5] = CreateVehicle(420, -292.6953, 1570.1365, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][6] = CreateVehicle(420, -290.1047, 1567.6472, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][7] = CreateVehicle(420, -287.6207, 1565.0135, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][8] = CreateVehicle(420, -285.1460, 1562.5371, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][9] = CreateVehicle(420, -282.7310, 1560.1447, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][10] = CreateVehicle(420, -280.2410, 1557.3778, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][11] = CreateVehicle(420, -277.7827, 1555.0767, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][12] = CreateVehicle(420, -275.3917, 1552.3762, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][13] = CreateVehicle(420, -270.4198, 1547.5026, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][14] = CreateVehicle(420, -273.0469, 1549.8636, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][15] = CreateVehicle(420, -265.5028, 1542.3480, 75.0000, -45.0000, 6, 6, 100);
JobInfo2[JOB_TAXIDRIVER][jtCars][16] = CreateVehicle(420, -268.0658, 1544.9388, 75.0000, -45.0000, 6, 6, 100);
PHP код:
stock IsTaxiVehicle(vehicleid)
{
for(new i=0; i<10; i++)
{
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(playerid, pos[0], pos[1], pos[2]);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the Taxi Drivers.");
}
Re: Why this script dont work and all players can enter in the cars ? -
Sawalha - 26.01.2014
RemovePlayerFromVehicle?
Re: Why this script dont work and all players can enter in the cars ? -
EiresJason - 26.01.2014
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.");
}
Re: Why this script dont work and all players can enter in the cars ? -
barts - 26.01.2014
dont work and it is called in this callback
Re: Why this script dont work and all players can enter in the cars ? -
Konstantinos - 26.01.2014
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;
}
Re: Why this script dont work and all players can enter in the cars ? -
Don_Cage - 26.01.2014
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.");
}
Re: Why this script dont work and all players can enter in the cars ? -
barts - 26.01.2014
@Konstantinos it dont work with your script....
Re: Why this script dont work and all players can enter in the cars ? -
Konstantinos - 26.01.2014
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.
Re: Why this script dont work and all players can enter in the cars ? -
Yashas - 26.01.2014
There are 16 cars and you are checking only the first 11 cars!
Re: Why this script dont work and all players can enter in the cars ? -
barts - 26.01.2014
No i dont get message....