new RotaPlayer[MAX_PLAYERS];
CMD:rota1(playerid)
{
return RotaPlayer[playerid] = 1;
}
CMD:rota2(playerid)
{
return RotaPlayer[playerid] = 2;
}
CMD:rota3(playerid)
{
return RotaPlayer[playerid] = 3;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(RotaPlayer[playerid] == 1)
{
//code
}
else if(RotaPlayer[playerid] == 2)
{
//code
}
else if(RotaPlayer[playerid] == 3)
{
//code
}
return 1;
}
Toma essa base que acabei de fazer ae, espero que entenda.
PHP код:
|
CMD:carregar(playerid, params[])
{
new vehicle = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicle) == 514)
{
if (IsPlayerInRangeOfPoint(playerid, 20.0, -7.2738, 1523.3784, 12.7500))
{
ShowPlayerDialog(playerid, rotas, DIALOG_STYLE_LIST, "Rotas", "Usina De San Fierro", "Quero Essa", "Ir nessa");
RemovePlayerMapIcon(playerid, 51);
}else{
SendClientMessage(playerid, -1, "{FF0040}Vocк nгo esta na area de carregamento!");
SendClientMessage(playerid, -1, "{00FF00}Foi marcado em seu mapa a area de carregamento.");
SetPlayerMapIcon(playerid, 51, -7.2738, 1523.3784, 12.7500, 51, 0, MAPICON_GLOBAL);
}
}else{
SendClientMessage(playerid, -1, "{FF0040}Vai carregar nas costa ?");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == rotas)
{
switch(listitem)
{
case 0:
{
new veiculo = GetPlayerVehicleID(playerid);
if(GetVehicleModel(veiculo) == 514){
new vehiclev = GetPlayerVehicleID(playerid);
if(IsTrailerAttachedToVehicle(vehiclev)){
SetPlayerMapIcon(playerid, 24, -1021.5939, -664.9120, 32.0078, -1, 24, MAPICON_GLOBAL);
SetPlayerCheckpoint(playerid, -1021.5939, -664.9120, 32.0078, 10.0);
SendClientMessage(playerid, -1, "{00FF00}Cargueiro carregado!!!");
SendClientMessage(playerid, -1, "{00FF00}Foi marcado em seu mapa o local de descarregamento.");
}else{
SendClientMessage(playerid, -1, "{FF0000}e a carga ???");
}
}
}
}
}
}
public OnPlayerEnterCheckpoint(playerid)
{
if (IsPlayerInCheckpoint(playerid))
{
new vehiclevv = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehiclevv) == 514){
new vehiclev = GetPlayerVehicleID(playerid);
if(IsTrailerAttachedToVehicle(vehiclev))
{
if (IsPlayerInRangeOfPoint(playerid, 10.0, -1021.5939, -664.9120, 32.0078))
{
new vehiclecc = GetPlayerVehicleID(playerid);
new trailerc = GetVehicleTrailer(vehiclecc);
DetachTrailerFromVehicle(trailerc);
SetVehicleToRespawn(trailerc);
SendClientMessage(playerid, -1, "{FF0000}Caminhгo descarregado!");
SendClientMessage(playerid, -1, "{FF0000}Pagamento: {00ff00}$2000");
GivePlayerMoney(playerid, 2000);
RemovePlayerMapIcon(playerid, 24);
DisablePlayerCheckpoint(playerid);
}else{
SendClientMessage(playerid, -1, "{FF0040}Vocк nгo carregou seu caminhгo!");
}
}
}
}else{
SendClientMessage(playerid, -1, "{FF0040}Vocк nгo esta com um caminhгo!");
}
return 1;
}
new RotaCarga[MAX_PLAYERS];
CMD:carregar(playerid, params[])
{
new vehicle = GetPlayerVehicleID(playerid);
if(!GetVehicleModel(vehicle) == 514) return SendClientMessage(playerid, -1, "carai borracha mano pega o caminhau serto");
if(!IsPlayerInRangeOfPoint(playerid, 20.0, -7.2738, 1523.3784, 12.7500)) return SendClientMessage(playerid, -1, "{FF0040}Vocк nгo esta na area de carregamento!");
RemovePlayerMapIcon(playerid, 51);
return ShowPlayerDialog(playerid, rotas, DIALOG_STYLE_LIST, "Rotas", "Usina De San Fierro\nUsina de cidade dos gay", "Quero Essa", "Ir nessa");
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == rotas)
{
switch(listitem)
{
case 0:
{
new veiculo = GetPlayerVehicleID(playerid);
if(!GetVehicleModel(veiculo) == 514) return SendClientMessage(playerid, -1, "Nгo й esse veiculo ta drogado?");
if(!IsTrailerAttachedToVehicle(veiculo)) return SendClientMessage(playerid, -1, "E a carga porra?");
SetPlayerMapIcon(playerid, 24, -1021.5939, -664.9120, 32.0078, -1, 24, MAPICON_GLOBAL);
SetPlayerCheckpoint(playerid, -1021.5939, -664.9120, 32.0078, 10.0);
SendClientMessage(playerid, -1, "{00FF00}Cargueiro carregado, para usina de SF");
SendClientMessage(playerid, -1, "{00FF00}Foi marcado em seu mapa o local de descarregamento.");
RotaCarga[playerid] = 1; // sf
}
case 1:
{
new veiculo = GetPlayerVehicleID(playerid);
if(!GetVehicleModel(veiculo) == 514) return SendClientMessage(playerid, -1, "Nгo й esse veiculo ta drogado?");
if(!IsTrailerAttachedToVehicle(veiculo)) return SendClientMessage(playerid, -1, "E a carga porra?");
SetPlayerMapIcon(playerid, 24, 2424, 2424, 2424, -1, 24, MAPICON_GLOBAL);
SetPlayerCheckpoint(playerid, 2424, 2424, 2424, 10.0);
SendClientMessage(playerid, -1, "{00FF00}Cargueiro carregado, para cidade dos gay");
SendClientMessage(playerid, -1, "{00FF00}Foi marcado em seu mapa o local de descarregamento.");
RotaCarga[playerid] = 2; //cidade dos gay
}
}
}
}
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(RotaCarga[playerid] == 1)
{
new vehiclevv = GetPlayerVehicleID(playerid);
if(!GetVehicleModel(vehiclevv) == 514) return SendClientMessage(playerid, -1, "{FF0040}Vocк nгo esta com um caminhгo!");
if(!IsTrailerAttachedToVehicle(vehiclevv)) return SendClientMessage(playerid, -1, "{FF0040}Vocк nгo carregou seu caminhгo!");
if(!IsPlayerInRangeOfPoint(playerid, 10.0, -1021.5939, -664.9120, 32.0078)) return SendClientMessage(playerid, color, "Nгo estб na area de carregamento");
new trailerc = GetVehicleTrailer(vehiclevv);
DetachTrailerFromVehicle(trailerc);
SetVehicleToRespawn(trailerc);
SendClientMessage(playerid, -1, "{FF0000}Caminhгo descarregado em SanFierro");
SendClientMessage(playerid, -1, "{FF0000}Pagamento: {00ff00}$2000");
GivePlayerMoney(playerid, 2000);
RemovePlayerMapIcon(playerid, 24);
DisablePlayerCheckpoint(playerid);
RotaCarga[playerid] = 0;
}
else if(RotaCarga[playerid] == 2)
{
new vehiclevv = GetPlayerVehicleID(playerid);
if(!GetVehicleModel(vehiclevv) == 514) return SendClientMessage(playerid, -1, "{FF0040}Vocк nгo esta com um caminhгo!");
if(!IsTrailerAttachedToVehicle(vehiclevv)) return SendClientMessage(playerid, -1, "{FF0040}Vocк nгo carregou seu caminhгo!");
if(!IsPlayerInRangeOfPoint(playerid, 10.0, -1021.5939, -664.9120, 32.0078)) return SendClientMessage(playerid, color, "Nгo estб na area de carregamento");
new trailerc = GetVehicleTrailer(vehiclevv);
DetachTrailerFromVehicle(trailerc);
SetVehicleToRespawn(trailerc);
SendClientMessage(playerid, -1, "{FF0000}Caminhгo descarregado na Cidade dos gays");
SendClientMessage(playerid, -1, "{FF0000}Pagamento: {00ff00}$24");
GivePlayerMoney(playerid, 2000);
RemovePlayerMapIcon(playerid, 24);
DisablePlayerCheckpoint(playerid);
RotaCarga[playerid] = 0;
}
return 1;
}
Bem, depois de muito tempo, espero que aproveite bem, otimizei muito seu codigo:
PHP код:
|
[Include] MULTI COLERED FUNCTIONAL CP [by Razor] http://forum.sa-mp.com/showthread.ph...wpost&t=635066 |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == rotas)
{
switch(listitem)
{
case 0:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == rotas)
{
if(listitem == 0)
{
//Funcao
}
PHP код:
PHP код:
|