// 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(playerid, params[])
{
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(playerid, 2.0, 1758.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(playerid, checkpointid)
{
if( checkpointid == cp_motoboy1[playerid])
{
new str[100], grana, vehid = 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(playerid, grana);
format(str, 100, "Voce entregou a encomenda e ganhou %i", grana);
SCM(playerid, -1, str);
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], grana, vehid = 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(playerid, grana);
format(str, 100, "Voce entregou a encomenda e ganhou %i", grana);
SCM(playerid, -1, str);
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], grana, vehid = 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(playerid, grana);
format(str, 100, "Voce entregou a encomenda e ganhou %i", grana);
SCM(playerid, -1, str);
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], grana, vehid = 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(playerid, grana);
format(str, 100, "Voce entregou a encomenda e ganhou %i", grana);
SCM(playerid, -1, str);
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], grana, vehid = 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(playerid, grana);
format(str, 100, "Voce entregou a ultima encomenda e ganhou %i, va buscar mais no hq", grana);
SCM(playerid, -1, str);
DestroyDynamicCP(cp_motoboy5[playerid]);
cp_motoboy5[playerid] = 0;
}
return true;
}
#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;
}
}
}
Checkpoints sгo muito bugados.
Crie uma variбvel por player para controlar os checkpoints. pawn 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.0078, 10.0, -1, -1, playerid, STREAMER_CP_SD, -1, 0);
SetPlayerMapIcon(playerid, 0, -1005.3510,-676.9293,32.0078, 0, 0xFF0000FF, MAPICON_GLOBAL);
return 1;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == L_CheckPoint01[playerid])
{
SendClientMessage(playerid, -1, "[WORK] Carga carregada, agora vб descarregar.");
DestroyDynamicCP(L_CheckPoint01[playerid]);
RemovePlayerMapIcon(playerid, 0);
L_CheckPoint01[playerid] = 0;
UL_CheckPoint01[playerid] = CreateDynamicCP(-1046.0258,-655.5824,32.0078, 10.0, -1, -1, playerid, STREAMER_CP_SD, -1, 0);
SetPlayerMapIcon(playerid, 0, -1046.0258,-655.5824,32.0078, 0, 0xFF0000FF, MAPICON_GLOBAL);
return 1;
}
if(checkpointid == UL_CheckPoint01[playerid])
{
SendClientMessage(playerid, -1, "[WORK] Carga descarregada com sucesso, bom trabalho.");
DestroyDynamicCP(UL_CheckPoint01[playerid]);
RemovePlayerMapIcon(playerid, 0);
UL_CheckPoint01[playerid] = 0;
return 1;
}
return 1;
}
static
Float:ShipmentList[][] = {
{1963.3864, 1362.4166, 9.2578},
{1970.6091, 1367.9214, 9.2578},
{1985.4479, 1368.9701, 9.2501},
{1991.4299, 1369.2131, 9.2578},
{2003.6230, 1368.7146, 9.2578},
{2015.5040, 1359.7339, 9.4377},
{2023.8607, 1351.5626, 10.4617},
{2033.3152, 1341.5361, 10.8203},
{2035.1481, 1330.5441, 10.8203},
{2023.8837, 1334.4777, 10.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(playerid, ShipmentList[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(playerid, ShipmentList[index][0], ShipmentList[index][1], ShipmentList[index][2], 3.0);
LastShipment[playerid] = index;
}
return 1;
}