problema con trabajo
#1

Hola tengo un problemilla con un trabajo de camionero. el trabajo tiene 2 checkpoints uno de ida y otro de vuelta . si trabaja solo uno puede hacerlo correctamente sin ningun fallo pero si se ponen 2 a trabajar aparece un fallo. al pasar el 2 jugador por el 1 checkpoint se le entrega . solo funciona bien si el que iva primero lo entrego . cual es el motivo ?

Espero su ayuda
Reply
#2

Si no dejas el cуdigo no te podremos decir el motivo del problema.
Reply
#3

este es el codigo :



CMD:camionero(playerid, params[])
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 455)
{
truckjobrunning = 1;
SetPlayerCheckpoint(playerid, -139.1432,-1239.7986,3.1348, 10);
GameTextForPlayer(playerid, "~g~Usted empezу el trabajo, buena suerte!", 3000, 3);
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s ahora es un conductor de camiуn.", name );
SendClientMessageToAll(COLOR_YELLOW, string);

} else
{
SendClientMessage(playerid, COLOR_YELLOW,"Debes estar en un camiуn para iniciar el trabajo");
}
return 1;
}

CMD:infocamionero(playerid, params[])
{
SendClientMessage(playerid, COLOR_YELLOW, "Usted necesita traer el camiуn hasta el aeropuerto.");
SendClientMessage(playerid, COLOR_YELLOW, "Allн se te recompensarб por tu ayuda.");
SendClientMessage(playerid, COLOR_YELLOW, "Si entra en el camiуn. Tipee /camion y un marcador rojo aparecerб.");
SendClientMessage(playerid, COLOR_YELLOW, "Sуlo conduzca la unidad al marcador y ya estб.");
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 455 && contador1==0)
{
DisablePlayerCheckpoint(playerid);
truckjobrunning = 1;
SetPlayerCheckpoint(playerid, -70.8119,-1112.9839,1.0781, 7.0);



}


if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 455 && contador1!=0)
{
DisablePlayerCheckpoint(playerid);
truckjobrunning = 0;
//GivePlayerMoney(playerid, 10000);
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
PlayerInfo[playerid][pDex]++;

SendClientMessage(playerid, COLOR_YELLOW, "Has ganado 1 punto de habilidad de camionero.");

if(PlayerInfo[playerid][pDex] == 10 && PlayerInfo[playerid][pCamion] == 1)
{
PlayerInfo[playerid][pDex]=0;
PlayerInfo[playerid][pCamion]=2;
SendClientMessage(playerid, COLOR_YELLOW, "Has subido al nivel 2, ahora pasas a cobrar 50K.");
}

if(PlayerInfo[playerid][pDex] == 2 && PlayerInfo[playerid][pCamion] == 2)
{
PlayerInfo[playerid][pDex]=0;
PlayerInfo[playerid][pCamion]=3;
SendClientMessage(playerid, COLOR_YELLOW, "Has subido al nivel 3, ahora pasas a cobrar 100K.");
}

if(PlayerInfo[playerid][pCamion] == 1)
{

GivePlayerMoney(playerid, 10000);

}
if(PlayerInfo[playerid][pCamion] == 2)
{

GivePlayerMoney(playerid, 50000);


}
if(PlayerInfo[playerid][pCamion] == 3)
{

GivePlayerMoney(playerid, 100000);


}


}


if(contador1==0)
{
contador1=1;
}else
{
contador1=0;
}
}


public OnPlayerExitVehicle(playerid, vehicleid)
{
if((truckjobrunning) == 1)
{
truckjobrunning = 0;
SendClientMessage(playerid, COLOR_YELLOW, "Usted dejу su camiуn atras, entre de nuevo si desea continuar con su trabajo.");

}else if((truckjobrunning) == 0){

//Nothing
}
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == info)
{
GameTextForPlayer(playerid, "~g~Bienvenido al trabajo de camionero. Usй /infocamion para saber mбs", 3000, 3);
}
}
Reply
#4

Si no veo mal, ya que el cуdigo me cuesta leerlo cuando estб desordenado, el problema es la variable "truckjobrunning", hace que sea un array y utiliza uno para cada jugador.
Reply
#5

despues de definir la array como hago que utilize uno para jugador ?
Reply
#6

truckjobrunning[playerid]
Reply
#7

defini la array con [MAX_PLAYERS] y despues con playerid en los truckjobrunning y no me funciono hizo lo mismo
Reply
#8

"contador1" tambien debe ser una array
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)