Hi guys i have a problem in the job of trucker, when I'm loading, the vehicle closes and opens the door many times to load the truck, in the end, the door is open, the same thing happens when downloading, why is it? They could help me please and thank you
Code: I'll just leave a part of the code because it's big please and thank you
Код:
forward Legal1(playerid);
public Legal1(playerid)
{
ActualizarPuerta(GetPlayerVehicleID(playerid), 2);
ActualizarPuerta(GetPlayerVehicleID(playerid), 3);
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, 0, objective);
if(Cargando2[playerid] < 10)
{
Cargando2[playerid]++;
SetProgressBarValue(Cargando[playerid],Cargando2[playerid]);
UpdateProgressBar(Cargando[playerid],playerid);
if(Cargando2[playerid] == 10)
{
if(CamionID[playerid] != INVALID_PLAYER_ID)
{
HideProgressBarForPlayer(playerid, Cargando[playerid]);
Cargando2[playerid] = 0;
KillTimer(Cargas[playerid]);
//SetPlayerCheckpoint(playerid,1832.3918,-1832.4200,13.1546,7.0);
SetPlayerCheckpoint(playerid, 1323.8273, -865.2881, 39.2973,9.0);
//PuntoCX[playerid] = 1832.3918; PuntoCY[playerid] = -1832.4200; PuntoCZ[playerid] = 13.1546;
PuntoCX[playerid] = 1323.8273; PuntoCY[playerid] = -865.2881; PuntoCZ[playerid] = 39.2973;
SendClientMessage(playerid,-1,"Camion cargado, ve al punto en el mapa para entregar la carga");
CargandoC[playerid] = 0;
TogglePlayerControllable(playerid, 1);
SetPVarInt(playerid, "IsFrozen", 1);
Chofer[CamionID[playerid]] = playerid;
CamionCargado[CamionID[playerid]] = 1;
Carga[playerid] = 1;
SetPVarInt(playerid, "Camionero", 1);
}
}
}
}
forward Legal2(playerid);
public Legal2(playerid)
{
ActualizarPuerta(GetPlayerVehicleID(playerid), 2);
ActualizarPuerta(GetPlayerVehicleID(playerid), 3);
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, 0, objective);
if(Cargando2[playerid] < 10)
{
Cargando2[playerid]++;
SetProgressBarValue(Cargando[playerid],Cargando2[playerid]);
UpdateProgressBar(Cargando[playerid],playerid);
if(Cargando2[playerid] == 10)
{
if(CamionID[playerid] != INVALID_PLAYER_ID)
{
HideProgressBarForPlayer(playerid, Cargando[playerid]);
KillTimer(Cargas[playerid]);
//SetPlayerCheckpoint(playerid,1338.6766,-912.8005,35.6672,7.0);
//PuntoCX[playerid] = 1338.6766; PuntoCY[playerid] = -912.8005; PuntoCZ[playerid] = 35.6672;
SetPlayerCheckpoint(playerid, 1841.4132, -1831.9009, 13.3066,9.0);
PuntoCX[playerid] = 1841.4132; PuntoCY[playerid] = -1831.9009; PuntoCZ[playerid] = 13.3066;
SendClientMessage(playerid,-1,"Camion cargado, ve al punto en el mapa para entregar la carga");
CargandoC[playerid] = 0;
TogglePlayerControllable(playerid, 1);
SetPVarInt(playerid, "IsFrozen", 1);
CamionCargado[CamionID[playerid]] = 1;
Chofer[CamionID[playerid]] = playerid;
Carga[playerid] = 1;
Cargando2[playerid] = 0;
SetPVarInt(playerid, "Camionero", 1);
}
}
}
}
forward Legal3(playerid);
public Legal3(playerid)
{
ActualizarPuerta(GetPlayerVehicleID(playerid), 2);
ActualizarPuerta(GetPlayerVehicleID(playerid), 3);
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, 0, objective);
if(Cargando2[playerid] < 10)
{
Cargando2[playerid]++;
SetProgressBarValue(Cargando[playerid],Cargando2[playerid]);
UpdateProgressBar(Cargando[playerid],playerid);
if(Cargando2[playerid] == 10)
{
if(CamionID[playerid] != INVALID_PLAYER_ID)
{
HideProgressBarForPlayer(playerid, Cargando[playerid]);
KillTimer(Cargas[playerid]);
SetPlayerCheckpoint(playerid,455.0953,-1502.9357,30.8655,9.0);
PuntoCX[playerid] = 455.0953; PuntoCY[playerid] = -1502.9357; PuntoCZ[playerid] = 30.8655;
SendClientMessage(playerid,-1,"Camion cargado, ve al punto en el mapa para entregar la carga");
CargandoC[playerid] = 0;
TogglePlayerControllable(playerid, 1);
SetPVarInt(playerid, "IsFrozen", 1);
CamionCargado[CamionID[playerid]] = 2;
Chofer[CamionID[playerid]] = playerid;
Carga[playerid] = 2;
Cargando2[playerid] = 0;
SetPVarInt(playerid, "Camionero", 1);
}
}
}
}
forward Legal4(playerid);
public Legal4(playerid)
{
ActualizarPuerta(GetPlayerVehicleID(playerid), 2);
ActualizarPuerta(GetPlayerVehicleID(playerid), 3);
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, 0, objective);
if(Cargando2[playerid] < 10)
{
Cargando2[playerid]++;
SetProgressBarValue(Cargando[playerid],Cargando2[playerid]);
UpdateProgressBar(Cargando[playerid],playerid);
if(Cargando2[playerid] == 10)
{
if(CamionID[playerid] != INVALID_PLAYER_ID)
{
HideProgressBarForPlayer(playerid, Cargando[playerid]);
KillTimer(Cargas[playerid]);
SetPlayerCheckpoint(playerid,810.9319,-1391.0319,13.8416,9.0);
PuntoCX[playerid] = 810.9319; PuntoCY[playerid] = -1391.0319; PuntoCZ[playerid] = 13.8416;
SendClientMessage(playerid,-1,"Camion cargado, ve al punto en el mapa para entregar la carga");
CargandoC[playerid] = 0;
TogglePlayerControllable(playerid, 1);
SetPVarInt(playerid, "IsFrozen", 1);
CamionCargado[CamionID[playerid]] = 2;
Chofer[CamionID[playerid]] = playerid;
Carga[playerid] = 2;
Cargando2[playerid] = 0;
SetPVarInt(playerid, "Camionero", 1);
}
}
}
}
forward Legal5(playerid);
public Legal5(playerid)
{
ActualizarPuerta(GetPlayerVehicleID(playerid), 2);
ActualizarPuerta(GetPlayerVehicleID(playerid), 3);
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, 0, objective);
if(Cargando2[playerid] < 10)
{
Cargando2[playerid]++;
SetProgressBarValue(Cargando[playerid],Cargando2[playerid]);
UpdateProgressBar(Cargando[playerid],playerid);
if(Cargando2[playerid] == 10)
{
if(CamionID[playerid] != INVALID_PLAYER_ID)
{
HideProgressBarForPlayer(playerid, Cargando[playerid]);
KillTimer(Cargas[playerid]);
SetPlayerCheckpoint(playerid,488.1939,-1277.0747,15.9604,9.0);
PuntoCX[playerid] = 488.1939; PuntoCY[playerid] = -1277.0747; PuntoCZ[playerid] = 15.9604;
SendClientMessage(playerid,-1,"Camion cargado, ve al punto en el mapa para entregar la carga");
CargandoC[playerid] = 0;
TogglePlayerControllable(playerid, 1);
SetPVarInt(playerid, "IsFrozen", 1);
Chofer[CamionID[playerid]] = playerid;
CamionCargado[CamionID[playerid]] = 2;
Carga[playerid] = 2;
Cargando2[playerid] = 0;
SetPVarInt(playerid, "Camionero", 1);
}
}
}
}
forward Ilegal1(playerid);
public Ilegal1(playerid)
{
ActualizarPuerta(GetPlayerVehicleID(playerid), 2);
ActualizarPuerta(GetPlayerVehicleID(playerid), 3);
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, 0, objective);
if(Cargando2[playerid] < 10)
{
Cargando2[playerid]++;
SetProgressBarValue(Cargando[playerid],Cargando2[playerid]);
UpdateProgressBar(Cargando[playerid],playerid);
if(Cargando2[playerid] == 10)
{
if(CamionID[playerid] != INVALID_PLAYER_ID)
{
KillTimer(Cargas[playerid]);
//SetPlayerCheckpoint(playerid,2169.3521,-2275.2957,13.1360,7.0);
//PuntoCX[playerid] = 2169.3521; PuntoCY[playerid] = -2275.2957; PuntoCZ[playerid] = 13.1360;
SetPlayerCheckpoint(playerid,2444.5535,-1427.2559,23.6748,9.0);
PuntoCX[playerid] = 2444.5535; PuntoCY[playerid] = -1427.2559; PuntoCZ[playerid] = 23.6748;
HideProgressBarForPlayer(playerid, Cargando[playerid]);
SendClientMessage(playerid,-1,"{00FF3F}Camion cargado, {FFFFFF}ve al punto en el mapa para entregar la carga");
CargandoC[playerid] = 0;
TogglePlayerControllable(playerid, 1);
SetPVarInt(playerid, "IsFrozen", 1);
CamionCargado[CamionID[playerid]] = 3;
Carga[playerid] = 3;
Cargando2[playerid] = 0;
Chofer[CamionID[playerid]] = playerid;
SetPVarInt(playerid, "Camionero", 1);
}
}
}
}