Erster Checkpoint wird gesetzt aber weiter gehts nicht!
Buslinie:
Dialogdefine:
#define DIALOG_Buslinien 5
Enums:
enum bus1Enum{
Float:g_x,
Float:g_y,
Float:g_z
}
enum bus2Enum{
Float:v_x,
Float:v_y,
Float:v_z
}
enum bus3Enum{
Float:n_x,
Float:n_y,
Float:n_z
}
enum bus4Enum{
Float:m_x,
Float:m_y,
Float:m_z
}
new bust1cps[][bus1Enum]={
{1135.5480,-1693.4392,13.7931}, // busstarten
{1722.2972,-1599.5205,13.5478},//buscp 1
{1526.4220,-1660.5486,13.4871}, //buscp1
{1467.7390,-1728.8627,13.4710}, //buscp1
{1361.6545,-1285.1267,13.5398}, //buscp1
{1446.1191,-1029.5895,23.8441},//buscp 1
{1275.4427,-1380.3951,13.3839} //buscp1 letzte
};
new bust2cps[][bus2Enum]={
{1135.5480,-1693.4392,13.7931}, // busstarten
{1378.1691,-1876.8495,13.1888},
{1937.2477,-2171.4868,13.1890},
{2327.6970,-2054.9773,13.1441},
{2719.7451,-2029.7438,13.1351},
{2774.6575,-1942.9828,13.1381},
{2683.9724,-1871.7905,10.6911},
{2741.3979,-1610.1760,12.5695},
{2682.0027,-1459.3654,30.1905},
{2418.9873,-1251.8312,23.5439},
{2007.6500,-1455.2505,13.1968}
};
new bust3cps[][bus3Enum]={
{1135.5480,-1693.4392,13.7931}, // busstarten
{1679.9683,-1293.2322,13.6465},
{1453.7729,-1029.0790,23.4661},
{1330.3799,-920.0157,36.3406},
{1208.4860,-930.5677,42.5413},
{1000.6902,-953.3558,41.7086},
{820.6417,-1032.6522,24.7459},
{792.3692,-1120.2891,23.4660},
{937.4135,-1202.0179,17.4626}
};
new bust4cps[][bus4Enum]={
{1135.5480,-1693.4392,13.7931}, // busstarten
{912.7061,-1544.2203,13.1864},
{1373.5081,-1737.3380,13.1889},
{1460.0719,-1386.0859,13.1890},
{1191.4703,-1472.5956,13.1890},
{1087.5948,-1707.3693,13.1890},
{978.7953,-1567.1348,13.2248},
{484.9120,-1577.5508,21.0505},
{454.7106,-1498.5461,30.7047},
{343.1253,-1523.9889,33.0096},
{280.3340,-1643.8889,33.0396},
{425.5682,-1696.6198,9.6370},
{237.6003,-1737.2343,3.8593}
};
OCMD-Befehl:
ocmd:buslinie(playerid,params[])
{
if(!IsPlayerInRangeOfPoint(playerid,5,1135.5480,-1693.4392,13.7931))return
SendClientMessage(playerid,helblau,"Du kannst den Job hier nicht starten");
new Float:ox,Float:oy,Float:oz,Float:or;
GetPlayerPos(playerid,ox,oy,oz);
GetPlayerFacingAngle(playerid,or);
new vID = CreateVehicle(431,ox,oy,oz,or,-1,-1,-1);
SetPVarInt(playerid,"bus_car",vID);
SendClientMessage(playerid,rot,"Du hast dein Routenplaner geöffnent.");
PutPlayerInVehicle(playerid,vID,0);
ShowPlayerDialog(playerid,DIALOG_Buslinien,DIALOG_STYLE_LIST,"Busstrecke.","Buslinie1\nBuslinie2\nBuslinie3\nBuslinie4","Annehmen","Abbrechen");
SetPVarInt(playerid,"bus_cp",0);
SetPVarInt(playerid,"bus_job",1);
return 1;
}
OnPlayerEnterCheckpoint:
if(GetPVarInt(playerid,"bus_job") == 1)
{
//wenn bus_job ausgeführt wird.
new bID = GetPVarInt(playerid,"bus_cp");
if(IsPlayerInRangeOfPoint(playerid,7,bust1cps[bID][g_x],bust1cps[bID][g_y],bust1cps[bID][g_z]))
{
bID++;
if(bID >= sizeof(bust1cps))
{
GivePlayerMoney(playerid,6000);
SetPVarInt(playerid,"bus_cp",0);
SetPlayerCheckpoint(playerid,bust1cps[0][g_x],bust1cps[0][g_y],bust1cps[0][g_z],5);
SendClientMessage(playerid,rot,"Du hast soeben 6.000$ verdient");
}
else
{
SetPVarInt(playerid,"bus_cp",bID);
SetPlayerCheckpoint(playerid,bust1cps[bID][g_x],bust1cps[bID][g_y],bust1cps[bID][g_z],5);
}
}
}
else if(GetPVarInt(playerid,"bus_job") == 2)
{
//wenn bus_job ausgeführt wird.
new bID = GetPVarInt(playerid,"bus_cp");
if(IsPlayerInRangeOfPoint(playerid,7,bust2cps[bID][v_x],bust2cps[bID][v_y],bust2cps[bID][v_z]))
{
bID++;
if(bID >= sizeof(bust2cps))
{
GivePlayerMoney(playerid,12000);
SetPVarInt(playerid,"bus_cp",0);
SetPlayerCheckpoint(playerid,bust2cps[0][v_x],bust2cps[0][v_y],bust2cps[0][v_z],5);
SendClientMessage(playerid,rot,"Du hast soeben 12.000$ verdient");
}
else
{
SetPVarInt(playerid,"bus_cp",bID);
SetPlayerCheckpoint(playerid,bust2cps[bID][v_x],bust2cps[bID][v_y],bust2cps[bID][v_z],5);
}
}
}
else if (GetPVarInt(playerid,"bus_job") == 3)
{
new bID = GetPVarInt(playerid,"bus_cp");
if(IsPlayerInRangeOfPoint(playerid,7,bust3cps[bID][n_x],bust3cps[bID][n_y],bust3cps[bID][n_z]))
{
bID++;
if(bID >= sizeof(bust3cps))
{
GivePlayerMoney(playerid,15000);
SetPVarInt(playerid,"bus_cp",8);
SetPlayerCheckpoint(playerid,bust3cps[bID][n_x],bust3cps[bID][n_y],bust3cps[bID][n_z],5);
SendClientMessage(playerid,rot,"Du hast soeben 15.000$ verdient");
}
else
{
SetPVarInt(playerid,"bus_cp",bID);
SetPlayerCheckpoint(playerid,bust3cps[bID][n_x],bust3cps[bID][n_y],bust3cps[bID][n_z],5);
}
}
}
else if(GetPVarInt(playerid,"bus_job") == 4)
{
new bID = GetPVarInt(playerid,"bus_cp");
if(IsPlayerInRangeOfPoint(playerid,7,bust4cps[bID][m_x],bust4cps[bID][m_y],bust4cps[bID][m_z]))
{
bID++;
if(bID >= sizeof(bust4cps))
{
GivePlayerMoney(playerid,30000);
SetPVarInt(playerid,"bus_cp",8);
SetPlayerCheckpoint(playerid,bust4cps[bID][m_x],bust4cps[bID][m_y],bust4cps[bID][m_z],5);
SendClientMessage(playerid,rot,"Du hast soeben 30.000$ verdient");
}
else
{
SetPVarInt(playerid,"bus_cp",bID);
SetPlayerCheckpoint(playerid,bust4cps[bID][m_x],bust4cps[bID][m_y],bust4cps[bID][m_z],5);
}
}
}
DisablePlayerCheckpoint(playerid);
return 1;
}
Dialgo:
if(dialogid==DIALOG_Buslinien)
{
if(response)
{
if(listitem== 0)
{
if(!IsPlayerInRangeOfPoint(playerid,5,bust1cps[0][g_x],bust1cps[0][g_y],bust1cps[0][g_z]))return 1;
SendClientMessage(playerid,helblau,"Du hast die Busroute 1 gestartet.");
SetPlayerCheckpoint(playerid,bust1cps[0][g_x],bust1cps[0][g_y],bust1cps[0][g_z],5);
}
if(listitem== 1)
{
//Busliniet2
if(!IsPlayerInRangeOfPoint(playerid,5,bust2cps[0][v_x],bust2cps[0][v_y],bust2cps[0][v_z]))return 1;
SendClientMessage(playerid,helblau,"Du hast die Busroute 2 gestartet.");
SetPlayerCheckpoint(playerid,bust2cps[0][v_x],bust2cps[0][v_y],bust2cps[0][v_z],5);
}
if(listitem== 2)
{
//Buslinie3
if(!IsPlayerInRangeOfPoint(playerid,5,bust3cps[0][n_x],bust3cps[0][n_y],bust3cps[0][n_z]))return 1;
SendClientMessage(playerid,helblau,"Du hast die Busroute 3 gestartet.");
SetPlayerCheckpoint(playerid,bust3cps[0][n_x],bust3cps[0][n_y],bust3cps[0][n_z],5);
}
if(listitem== 3)
{
//Buslinie 4
if(!IsPlayerInRangeOfPoint(playerid,5,bust4cps[0][m_x],bust4cps[0][m_y],bust4cps[0][m_z]))return 1;
SendClientMessage(playerid,helblau,"Du hast die Busroute 4 gestartet.");
SetPlayerCheckpoint(playerid,bust4cps[0][m_x],bust4cps[0][m_y],bust4cps[0][m_z],5);
}
}
else
{
SendClientMessage(playerid,grün,"Du hast keine Buslinie ausgewählt.");
DestroyVehicle(GetPlayerVehicleID(playerid));
return 1;
}
}
return 1;
}