[Ajuda] CreateDynamicCP
#1

Ja tou puto com esses CheckPoints pqp

Porque nao ta aparecendo o proximo? quando pega o primeiro aparece que pegou todos
se estiver errado como que faz? '-'

PHP Code:
 // ja tentei usar array tbm
new
    
cp_motoboy1[MAX_PLAYERS],
    
cp_motoboy2[MAX_PLAYERS],
    
cp_motoboy3[MAX_PLAYERS],
    
cp_motoboy4[MAX_PLAYERS],
    
cp_motoboy5[MAX_PLAYERS];
CMD:pegarencomendas(playeridparams[])
{
    if(
Player[playerid][pEmprego] != Motoboy) return SCM(playerid, -1,"voce nao e motoboy");
    new 
vehid GetPlayerVehicleID(playerid);
    if( 
vehid veh_motoboy[0] || vehid veh_motoboy[7]) return SCM(playerid, -1"voce nao esta no veiculo da profissao!");
     if(
IsPlayerInRangeOfPoint(playerid2.01758.7290,-1683.9829,13.4583))
    {
        new 
rand random(sizeof(Encomendas));
        
cp_motoboy1[playerid] = CreateDynamicCP(Encomendas[rand][0], Encomendas[rand][1], Encomendas[rand][2], 3.0,-1,-1,-1,2000.0);
        
SCM(playerid, -1"Entregas iniciadas siga as marcas no mapa para entregar!");
      }
      else 
SCM(playerid, -1,"voce nao esta no local de coleta!");
      return 
true;
}
public 
OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if( 
checkpointid == cp_motoboy1[playerid])
    {
        new 
str[100], granavehid GetPlayerVehicleID(playerid);
        if( 
vehid veh_motoboy[0] || vehid veh_motoboy[7]) return SCM(playerid, -1"voce nao esta no veiculo da profissao!");
        
grana granamotoboyrandom();
        
GivePlayerMoney(playeridgrana);
        
format(str100"Voce entregou a encomenda e ganhou %i"grana);
        
SCM(playerid, -1str);
        
DestroyDynamicCP(cp_motoboy1[playerid]);
        
cp_motoboy1[playerid] = 0;
        new 
rand random(sizeof(Encomendas));
        
cp_motoboy2[playerid] = CreateDynamicCP(Encomendas[rand][0],Encomendas[rand][1],Encomendas[rand][2], 3.0,-1,-1,-1,2000.0);
    }
    if( 
checkpointid == cp_motoboy2[playerid])
    {
        new 
str[100], granavehid GetPlayerVehicleID(playerid);
        if( 
vehid veh_motoboy[0] || vehid veh_motoboy[7]) return SCM(playerid, -1"voce nao esta no veiculo da profissao!");
        
grana granamotoboyrandom();
        
GivePlayerMoney(playeridgrana);
        
format(str100"Voce entregou a encomenda e ganhou %i"grana);
        
SCM(playerid, -1str);
        
DestroyDynamicCP(cp_motoboy2[playerid]);
        
cp_motoboy2[playerid] = 0;
        new 
rand random(sizeof(Encomendas));
        
cp_motoboy3[playerid] = CreateDynamicCP(Encomendas[rand][0],Encomendas[rand][1],Encomendas[rand][2], 3.0,-1,-1,-1,2000.0);
    }
    if( 
checkpointid == cp_motoboy3[playerid])
    {
        new 
str[100], granavehid GetPlayerVehicleID(playerid);
        if( 
vehid veh_motoboy[0] || vehid veh_motoboy[7]) return SCM(playerid, -1"voce nao esta no veiculo da profissao!");
        
grana granamotoboyrandom();
        
GivePlayerMoney(playeridgrana);
        
format(str100"Voce entregou a encomenda e ganhou %i"grana);
        
SCM(playerid, -1str);
        
DestroyDynamicCP(cp_motoboy3[playerid]);
        
cp_motoboy3[playerid] = 0;
        new 
rand random(sizeof(Encomendas));
        
cp_motoboy4[playerid] = CreateDynamicCP(Encomendas[rand][0],Encomendas[rand][1],Encomendas[rand][2], 3.0,-1,-1,-1,2000.0);
        
    }
    if( 
checkpointid == cp_motoboy4[playerid])
    {
        new 
str[100], granavehid GetPlayerVehicleID(playerid);
        if( 
vehid veh_motoboy[0] || vehid veh_motoboy[7]) return SCM(playerid, -1"voce nao esta no veiculo da profissao!");
        
grana granamotoboyrandom();
        
GivePlayerMoney(playeridgrana);
        
format(str100"Voce entregou a encomenda e ganhou %i"grana);
        
SCM(playerid, -1str);
        
DestroyDynamicCP(cp_motoboy4[playerid]);
        
cp_motoboy4[playerid] = 0;
        new 
rand random(sizeof(Encomendas));
        
cp_motoboy5[playerid] = CreateDynamicCP(Encomendas[rand][0],Encomendas[rand][1],Encomendas[rand][2], 3.0,-1,-1,-1,2000.0);
    }
    if( 
checkpointid == cp_motoboy5[playerid])
     {
        new 
str[100], granavehid GetPlayerVehicleID(playerid);
        if( 
vehid veh_motoboy[0] || vehid veh_motoboy[7]) return SCM(playerid, -1"voce nao esta no veiculo da profissao!");
        
grana granamotoboyrandom();
        
GivePlayerMoney(playeridgrana);
        
format(str100"Voce entregou a ultima encomenda e ganhou %i, va buscar mais no hq"grana);
        
SCM(playerid, -1str);
        
DestroyDynamicCP(cp_motoboy5[playerid]);
        
cp_motoboy5[playerid] = 0;
    }
    return 
true;

Reply
#2

Checkpoints sгo muito bugados.
Crie uma variбvel por player para controlar os checkpoints.

pawn Code:
#define CP_PIZZABOY_01 1001
new pCheckpoint[MAX_PLAYERS];

SetPlayerDelivery(playerid)
{
  new n = random(10);
  switch(n)
  {
    case 0:
    {
      SetPlayerDynamicCP(playerid, /*outros parametros*/);
      pCheckpoint[playerid] = CP_PIZZABOY_01;
    }
    // Outras coordenadas com outros checkpoints
  }
}

public OnPlayerEntersDynamicCP(playerid, checkpointid) {

  switch(pCheckpoint[playerid])
  {
    case CP_PIZZABOY_01:
    {
          SendClientMessage(playerid, -1, "Vocк entregou a pizza");
      GivePlayerMoney(playerid, 15);
      pCheckpoint[playerid] = -1;
      return 1;
    }
  }
}
Reply
#3

Quote:
Originally Posted by Ermanhaut
View Post
Checkpoints sгo muito bugados.
Crie uma variбvel por player para controlar os checkpoints.

pawn Code:
#define CP_PIZZABOY_01 1001
new pCheckpoint[MAX_PLAYERS];

SetPlayerDelivery(playerid)
{
  new n = random(10);
  switch(n)
  {
    case 0:
    {
      SetPlayerDynamicCP(playerid, /*outros parametros*/);
      pCheckpoint[playerid] = CP_PIZZABOY_01;
    }
    // Outras coordenadas com outros checkpoints
  }
}

public OnPlayerEntersDynamicCP(playerid, checkpointid) {

  switch(pCheckpoint[playerid])
  {
    case CP_PIZZABOY_01:
    {
          SendClientMessage(playerid, -1, "Vocк entregou a pizza");
      GivePlayerMoney(playerid, 15);
      pCheckpoint[playerid] = -1;
      return 1;
    }
  }
}
Posso fazer esse msm sistema para apenas o SetPlayerCheckpoint?
Reply
#4

Use como base:

PHP Code:

new L_CheckPoint01[MAX_PLAYERS]; // CheckPoint carregar 1;
new UL_CheckPoint01[MAX_PLAYERS]; // Checkpoint descarregar 1;
cmd:work(playerid)
{
    
L_CheckPoint01[playerid] = CreateDynamicCP(-1005.3510,-676.9293,32.007810.0, -1, -1playeridSTREAMER_CP_SD, -1,  0);
    
SetPlayerMapIcon(playerid0, -1005.3510,-676.9293,32.007800xFF0000FFMAPICON_GLOBAL);
    return 
1;
}
public 
OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if(
checkpointid == L_CheckPoint01[playerid])
    {
        
SendClientMessage(playerid, -1"[WORK] Carga carregada, agora vб descarregar.");
        
DestroyDynamicCP(L_CheckPoint01[playerid]);
        
RemovePlayerMapIcon(playerid0);
        
L_CheckPoint01[playerid] = 0;
        
UL_CheckPoint01[playerid] = CreateDynamicCP(-1046.0258,-655.5824,32.007810.0, -1, -1playeridSTREAMER_CP_SD, -1,  0);
        
SetPlayerMapIcon(playerid0, -1046.0258,-655.5824,32.007800xFF0000FFMAPICON_GLOBAL);
        return 
1;
    }
    if(
checkpointid == UL_CheckPoint01[playerid])
    {
        
SendClientMessage(playerid, -1"[WORK] Carga descarregada com sucesso, bom trabalho.");
        
DestroyDynamicCP(UL_CheckPoint01[playerid]);
        
RemovePlayerMapIcon(playerid0);
        
UL_CheckPoint01[playerid] = 0;
        return 
1;
    }
    return 
1;

Reply
#5

Um exemplo abaixo:

PHP Code:
static
    
Float:ShipmentList[][] = {
        {
1963.38641362.41669.2578},
        {
1970.60911367.92149.2578},
        {
1985.44791368.97019.2501},
        {
1991.42991369.21319.2578},
        {
2003.62301368.71469.2578},
        {
2015.50401359.73399.4377},
        {
2023.86071351.562610.4617},
        {
2033.31521341.536110.8203},
        {
2035.14811330.544110.8203},
        {
2023.88371334.477710.4626}
    },
    
Shipments[MAX_PLAYERS],
    
LastShipment[MAX_PLAYERS];
CMD:carregar(playerid) {
    
Shipments[playerid] = 5;
    
SendClientMessage(playerid, -1"Vocк recebeu 5 remessas, entregue-as!");
    new
        
index random(sizeof(ShipmentList));
    
SetPlayerCheckpoint(playeridShipmentList[index][0], ShipmentList[index][1], ShipmentList[index][2], 3.0);
    
LastShipment[playerid] = index;
    return 
1;
}
public 
OnPlayerEnterCheckpoint(playerid) {
    if (
Shipments[playerid]) {
        if (!(-- 
Shipments[playerid])) {
            
SendClientMessage(playerid, -1"Vocк entregou todas as remessas.");
            
DisablePlayerCheckpoint(playerid);
            return 
1;
        }
        new
            
index random(sizeof(ShipmentList));
        while (
index == LastShipment[playerid])
            
index random(sizeof(ShipmentList));
        
SetPlayerCheckpoint(playeridShipmentList[index][0], ShipmentList[index][1], ShipmentList[index][2], 3.0);
        
LastShipment[playerid] = index;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)