Ich gebe nochmal alles
enum busInfo{
name[64],
skill,
income
}
enum busstationInfo{
lid,
Float:l_x,
Float:l_y,
Float:l_z,
stationname[64],
l_id
}
new blInfo[][busInfo] = {
{"C1 Los Santos",1,1600},
{"L1 Red County",2,2100}
};
new bsInfo[][busstationInfo] ={
//Buslinie C1
{0,1171.6305,-1823.2676,13.4984,"Konferenzzentrum(ZOB)"},
{0,1492.7709,-1735.4004,13.5162,"Stadthalle"},
{0,1824.7155,-1654.6996,13.5162,"Club Alhambra"},
{0,1999.0885,-1468.8470,13.5239,"County General Hospital"},
{0,2098.6843,-1721.6963,13.5221,"Idlewood"},
{0,2321.6360,-1662.3466,14.0043,"Groove Street"},
{0,2240.4653,-1381.0345,23.9642,"Jefferson Church"},
{0,1936.8986,-1132.5551,25.3708,"Glen Park"},
{0,1463.1041,-1030.8983,23.7896,"Opera House"},
{0,1186.9722,-935.7852,42.8822,"Burger Shot North"},
{0,794.3947,-1352.1207,13.5213,"Market Station"},
{0,334.2658,-1538.9817,33.3820,"Rodeo"},
{0,863.7578,-1592.1945,13.4894,"Marina"},
{0,1171.8597,-1770.1836,13.5021,"Konferenzzentrum(ZOB)"},
//Buslinie L1
{1,1171.6305,-1823.2676,13.4984,"Konferenzzentrum(ZOB)"},
{1,412.2734,-1699.2111,9.2966,"Santa Maria Beach"},
{1,120.6130,-1535.1813,7.6868,"Los Santos Rodeo"},
{1,-108.3504,-1162.1759,2.4750,"Flint County"},
{1,-200.9118,-315.8221,1.2331,"Blueberry Industriepark"},
{1,42.1276,-213.2097,1.5676,"Blueberry Transport AG"},
{1,235.9211,-16.5521,1.5301,"Blueberry North"},
{1,701.3684,311.4853,19.9844,"Hampton Burns"},
{1,1296.1891,319.0197,19.5087,"Montgomery"},
{1,2290.5161,60.8486,26.4356,"Palomino Creek"},
{1,1551.5598,120.3831,29.5524,"Red County"},
{1,678.4969,-582.1321,16.2911,"Dillimore"},
{1,794.7361,-1351.5454,13.4874,"Los Santos Market Station"},
{1,863.7578,-1592.1945,13.4894,"Los Santos Marina"},
{1,1171.8597,-1770.1836,13.5021,"Konferenzzentrum(ZOB)"}
};
public OnPlayerEnterCheckpoint(playerid)
{
if(pInfo[playerid][onjob])
{
new vID = GetPlayerVehicleID(playerid);
if(GetPVarInt(playerid, "bus") == vID)
{
new cpID = GetPVarInt(playerid, "cpID");
new stID = GetPVarInt(playerid, "station");
if(IsPlayerInRangeOfPoint(playerid,5,bsInfo[cpID][l_x], bsInfo[cpID][l_y], bsInfo[cpID][l_z]))
{
cpID++;
stID++;
new linie = GetPVarInt(playerid, "linie");
if(cpID >= sizeof(bsInfo) || bsInfo[cpID][lid] != linie)
{
pInfo[playerid][bank] += blInfo[linie][income];
pInfo[playerid][skill1] += blInfo[linie][skill];
DisablePlayerCheckpoint(playerid);
Update3DTextLabelText(busline[vID],COLOR_WHITE,"Leerfahrt");
new str[145];
format(str, sizeof(str), "((Job)) Du hast die %s beendet und bekommst %d Skillpunkt(e) und $%d beim nächsten Payday gutgeschrieben.", blInfo[linie][name], blInfo[linie][skill], blInfo[linie][income]);
SendClientMessage(playerid,COLOR_BLUE,str);
SetPVarInt(playerid, "cpID", 0);
SetPVarInt(playerid, "bus", 0);
pInfo[playerid][onjob] =false;
}
else
{
SetPlayerCheckpoint(playerid, bsInfo[cpID][l_x], bsInfo[cpID][l_y], bsInfo[cpID][l_z], 4);
new text[128];
format(text,sizeof(text),"Nächste Haltestelle: %s",bsInfo[stID][stationname]);
for(new e = 0; e < MAX_PLAYERS; e++)
{
if(GetPlayerVehicleID(playerid) == GetPlayerVehicleID(e))
{
PlayerPlaySound(e,1057,0.0,0.0,0.0);
SendClientMessage(e, COLOR_TURQUOISE, text);
SetPVarInt(playerid, "station", stID);
}
}
SetPVarInt(playerid, "cpID", cpID);
}
}
}
else
{
SendClientMessage(playerid,COLOR_BLUE,"((Info)) Du sitzt nicht im Fahrzeug, mit dem du die Linie gestartet hast.");
SetPVarInt(playerid, "cpID", 0);
SetPVarInt(playerid, "bus", 0);
pInfo[playerid][onjob] =false;
DisablePlayerCheckpoint(playerid);
}
return 1;
}
DisablePlayerCheckpoint(playerid);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==DIALOG_BUSLINE)
{
//Buslinien 0 und 1:
if(listitem == 0 || listitem == 1)
{
for(new i=0; i<sizeof(BusVehs); i++)
{
if(GetPlayerVehicleID(playerid) == BusVehs[i])
{
pInfo[playerid][onjob]=true;
new buslinie = listitem;
new vID = GetPlayerVehicleID(playerid);
SetPVarInt(playerid, "bus", vID);
new str[80];
format(str, sizeof(str), "((Info)) Du bist jetzt auf der Linie '%s' unterwegs!", blInfo[buslinie][name]);
SendClientMessage(playerid,COLOR_BLUE,str);
Update3DTextLabelText(busline[i],COLOR_TURQUOISE,blInfo[buslinie][name]);
new id = 0;
for(id = 0; id < sizeof(bsInfo); id++) if(bsInfo[id][lid] == buslinie) break;
SetPlayerCheckpoint(playerid, bsInfo[id][l_x], bsInfo[id][l_y], bsInfo[id][l_z], 4);
new text[128];
for(new e = 0; e < MAX_PLAYERS; e++)
{
if(GetPlayerVehicleID(e) == GetPlayerVehicleID(playerid))
{
format(text,sizeof(text),"Nächste Haltestelle: %s",bsInfo[id][stationname]);
SendClientMessage(e,COLOR_TURQUOISE,text);
PlayerPlaySound(e,1057,0.0,0.0,0.0);
}
}
SetPVarInt(playerid, "station", 0);
SetPVarInt(playerid, "cpID", id);
SetPVarInt(playerid, "linie",buslinie);
}
}
}
if(listitem==2)
{
//Eventfahrt
if(eventactive==false) return SendClientMessage(playerid,COLOR_BLUE,"((Info)) Kein Event ist aktiv!");
for(new i=0; i<sizeof(BusVehs); i++)
{
if(GetPlayerVehicleID(playerid) == BusVehs[i])
{
pInfo[playerid][onjob]=true;
SendClientMessage(playerid,COLOR_BLUE,"((Info)) Du bist jetzt auf der Linie 'Eventfahrt' unterwegs!");
Update3DTextLabelText(busline[i],COLOR_ORANGE,"Eventfahrt");
}
}
}
}
return 1;
}
Habe jetzt alles gepostet, was mit dem System zu tun hat
War bereits am überlegen, zwei Variable aus dem Enum zusammenzufassen sodass bei der "if(cpID >= sizeof(bsInfo) bsInfo[cpID][lid] != linie)" nur noch "if(cpID >= sizeof(bsl1Info)" stehen muss, aber ich überlege da derzeit wie ich dass ohne großartig ein Haufen Zeilen umschreiben und die Busstationen nicht großartig trennen muss