Beiträge von DisturbedNoobTV

    Unterschiedlich da halt auch je nach Busfahrerskill, längere Strecken hinzukommen


    Eigentlich soll er als Daten aus new bsInfo[][busstationInfo] mit der ID 0 oder ID 1 raussuchen. Die ID übergebe ich ja mit SetPVarInt(playerid, "linec1",buslinie);


    Inspiriert ist dieses System von meinem bereits vorhandenem Autohaussystem

    enum dealerInfo{
    Float:d_x,
    Float:d_y,
    Float:d_z,
    Float:d_r
    }
    enum dealercarInfo{
    model,
    Float:dc_x,
    Float:dc_y,
    Float:dc_z,
    Float:dc_r,
    c_price,
    ah_id,
    id_x
    }
    new dInfo[][dealerInfo] = {
    {557.0468,-1261.9884,17.0489,359.2499},
    {-1973.2737,302.4986,34.8973,144.3221},
    {-1636.3423,1204.9303,6.9615,224.0114},
    {2135.3066,-1121.4271,24.9404,260.1840},
    {-2344.2195,2283.4219,-0.3001,270.0000}
    };
    new dcInfo[][dealercarInfo] ={
    {477,541.3029,-1272.5945,17.0018,276.5305,160000,0},
    {506,531.0538,-1279.7189,16.9444,245.5976,180000,0},
    {541,527.4791,-1282.1392,16.8681,245.2433,245000,0},
    {451,538.5888,-1286.8911,16.9384,329.7926,215000,0},
    {415,543.2477,-1287.0684,17.0146,330.0099,215000,0},
    {429,549.4346,-1282.2029,16.9242,45.5237,235000,0},
    {411,554.9614,-1282.0664,16.9763,47.4740,250000,0},
    {558,-1953.6899,299.7094,40.6796,59.6099,60000,1},
    {560,-1953.9619,292.8849,40.7580,122.4033,90000,1},
    {602,-1956.4889,262.2754,40.8539,340.7159,80000,1},
    {561,-1947.6492,270.5701,40.8673,121.4072,35000,1},
    {458,-1946.5969,256.9943,40.9256,31.1106,30000,1},
    {587,-1955.9135,299.2500,35.1931,122.1016,70000,1},
    {562,-1948.2290,256.8454,35.1282,50.8513,80000,1},
    {565,-1946.3008,264.3329,35.0962,80.6945,50000,1},
    {559,-1946.9475,273.1875,35.1312,125.5180,95000,1},
    {508,-1676.9236,1208.2162,21.5321,244.6534,45000,2},
    {409,-1660.5477,1210.8756,20.9572,325.5594,200000,2},
    {424,-1663.1184,1222.0819,20.9371,195.9398,50000,2},
    {442,-1649.7162,1206.9401,20.9790,282.0497,50000,2},
    {546,-1677.9932,1208.1829,13.3971,243.2681,20000,2},
    {426,-1664.5753,1224.3408,13.4193,201.2205,35000,2},
    {550,-1659.5996,1217.7181,13.4894,339.2775,30000,2},
    {547,-1657.0798,1211.7637,13.4123,290.5632,20000,2},
    {551,-1648.7928,1207.5220,13.4678,68.9961,20000,2},
    {540,-1657.5420,1214.5105,7.1145,267.1867,22000,2},
    {462,2135.7932,-1134.5253,25.2950,68.3711,22000,3},
    {586,2118.2900,-1135.0996,24.7416,311.0427,22000,3},
    {468,2136.9927,-1129.2795,25.2884,103.1719,22000,3},
    {462,2126.0593,-1130.0297,25.1065,33.0627,22000,3},
    {581,2123.2844,-1137.8687,24.8146,320.6566,22000,3},
    {522,2123.6748,-1146.0350,24.2052,316.2347,22000,3},
    {521,2131.2915,-1141.7277,24.6563,36.5554,22000,3},
    {461,2136.4080,-1140.1373,24.9229,29.4827,22000,3},
    {446,-2371.7278,2305.4863,-0.3001,270.0000,750000,4},
    {452,-2359.1152,2309.7383,-0.3001,180.0000,650000,4},
    {454,-2377.1187,2314.9712,-0.3001,270.0000,1500000,4},
    {484,-2349.1306,2309.8010,-0.3001,180.0000,2500000,4},
    {493,-2380.3813,2303.5715,-0.3001,180.0000,1000000,4}
    };


    public OnGameModeInit()
    {
    for(new i=0; i<sizeof(dcInfo); i++)
    {
    dcInfo[i][id_x]=AddStaticVehicle(dcInfo[i][model],dcInfo[i][dc_x],dcInfo[i][dc_y],dcInfo[i][dc_z],dcInfo[i][dc_r],-1,-1);
    }
    return 1;
    }


    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if(oldstate==PLAYER_STATE_ONFOOT && newstate==PLAYER_STATE_DRIVER)
    {
    new vID = GetPlayerVehicleID(playerid);
    new vModel = GetVehicleModel(vID);
    new str[128];
    format(str, sizeof(str), "%s",CarName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    for(new i=0; i<sizeof(dcInfo); i++)
    {
    if(dcInfo[i][id_x]!=vID)continue;
    SetPVarInt(playerid,"buyCarID",i);
    new string[256];
    format(string,sizeof(string),"Möchtest du dieses Fahrzeug für %i $ kaufen?",dcInfo[i][c_price]);
    ShowPlayerDialog(playerid,DIALOG_CARDEAL,DIALOG_STYLE_MSGBOX,str,string,"Kaufen","Austeigen");
    break;
    }
    }
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid==DIALOG_CARDEAL)
    {
    if(response)
    {
    new id=GetPVarInt(playerid,"buyCarID");
    if(pInfo[playerid][money]<dcInfo[id][c_price])
    {
    SendClientMessage(playerid,COLOR_RED,"((Info)) Du hat nicht genug Geld, um dir dieses Auto kaufen zu können!");
    RemovePlayerFromVehicle(playerid);
    return 1;
    }
    pInfo[playerid][money]-=dcInfo[id][c_price];
    createPlayerCar(playerid,dcInfo[id][model],dInfo[dcInfo[id][ah_id]][d_x],dInfo[dcInfo[id][ah_id]][d_y],dInfo[dcInfo[id][ah_id]][d_z],dInfo[dcInfo[id][ah_id]][d_r]);
    SendClientMessage(playerid,COLOR_GREEN,"((Info)) Herzlichen Glückwunsch! Du hast dir soeben ein neues Auto gekauft!");
    RemovePlayerFromVehicle(playerid);
    }
    else
    {
    RemovePlayerFromVehicle(playerid);
    }
    return 1;
    }
    return 1;
    }

    Ich hoffe es kann mir jemand helfen. Es handelt sich um das allgemein unbeliebte Busfahrersystem mit mehreren Linien. Habe jetzt inzwischen 4 Wochen daran probiert und gefummelt, aber es will einfach nicht so laufen wie ich das gerne hätte



    Ich will dass er die CPs von nur einer Linie aus dem Enum herausliest, und auch "verarbeitet". Bei der OnPlayerEnterCheckpoint sollen so mit Hilfe der ID der Linie die CPs erfasst und erstellt werden. Hätte ich nur eine Linie für ich das wie MrMonat in seinem TUT machen, aber ich will etwas mehr ohne dabei einen Haufen Zeilen für jede einzelne Linie zu schreiben



    Betroffene Quellcode:

    enum busInfo{
    bid,
    name[64],
    skill,
    income
    }
    enum busstationInfo{
    lid,
    Float:l_x,
    Float:l_y,
    Float:l_z,
    stationname[64],
    l_id
    }
    new blInfo[][busInfo] = {
    {1,"C1 Los Santos",1,1600}, //Buslinie 1
    {2,"L1 Red County",2,2100} //Buslinie 2
    };
    new bsInfo[][busstationInfo] ={
    //C1 Los Santos
    //Citylinie C1
    {0,1171.8597,-1770.1836,13.5021,"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,"GrooveStreet"},
    {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,"Los Santos Marina"},
    {0,1171.8597,-1770.1836,13.5021,"Konferenzzentrum(ZOB)"},



    //Buslinie L1
    {1,1171.8597,-1770.1836,13.5021,"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, "c1lossantos");
    if(IsPlayerInRangeOfPoint(playerid,5,bsInfo[cpID][l_x], bsInfo[cpID][l_y], bsInfo[cpID][l_z]))
    {
    cpID++;
    if(cpID >= sizeof(bsInfo))
    {
    pInfo[playerid][bank] += 200;
    pInfo[playerid][skill1] += 1;
    DisablePlayerCheckpoint(playerid);
    Update3DTextLabelText(busline[vID],COLOR_WHITE,"Leerfahrt");
    SendClientMessage(playerid,COLOR_BLUE,"((Job)) Du hast die Cityline 1 Los Santos beendet und bekommst einen Skillpunkt und 200 $ beim nächsten Payday gutgeschrieben.");
    SetPVarInt(playerid, "c1lossantos", 0);
    SetPVarInt(playerid, "bus", 0);
    pInfo[playerid][onjob] =false;



    }
    else
    {
    SetPlayerCheckpoint(playerid, bsInfo[cpID][l_x], bsInfo[cpID][l_y], bsInfo[cpID][l_z], 5);
    SetPVarInt(playerid, "c1lossantos", cpID);
    }
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_BLUE,"((Info)) Du sitzt nicht im Fahrzeug, mit dem du die Linie gestartet hast.");
    SetPVarInt(playerid, "c1lossantos", 0);
    SetPVarInt(playerid, "bus", 0);
    pInfo[playerid][onjob] =false;
    DisablePlayerCheckpoint(playerid);
    }
    return 1;
    }
    DisablePlayerCheckpoint(playerid);
    return 1;
    }



    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    if(newkeys & KEY_SUBMISSION)
    {
    if(!IsPlayerInAnyVehicle(playerid))return 1;
    if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER) return SendClientMessage(playerid,COLOR_YELLOW,"((Info)) Du bist nicht der Fahrer eines Fahrzeugs!");
    for(new i=0; i<sizeof(BusVehs); i++)
    {
    if(GetPlayerVehicleID(playerid) == BusVehs[i])
    {
    if(pInfo[playerid][onjob]==true)
    {
    pInfo[playerid][onjob]=false;
    SendClientMessage(playerid,COLOR_BLUE,"((Info)) Du bist jetzt nicht mehr auf Linie!");
    Update3DTextLabelText(busline[i],COLOR_WHITE,"Leerfahrt");
    DisablePlayerCheckpoint(playerid);
    return 1;
    }
    else
    {
    new str[128];
    format(str,sizeof(str),"%s\t[%i]\t%i $\n%s\t[%i]\t%i $\nEventfahrt\t[0]\t0 $[Wird vom Eventbetreiber bezahlt]",blInfo[0][name],blInfo[0][skill],blInfo[0][income],blInfo[1][name],blInfo[1][skill],blInfo[1][income]);
    ShowPlayerDialog(playerid,DIALOG_BUSLINE,DIALOG_STYLE_TABLIST,"Buslinien",str,"Schliessen","Okay");
    return 1;
    }
    }
    }
    }
    return 1;
    }



    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid==DIALOG_BUSLINE)
    {
    if(listitem==0)
    {
    for(new i=0; i<sizeof(BusVehs); i++)
    {
    if(GetPlayerVehicleID(playerid) == BusVehs[i])
    {
    pInfo[playerid][onjob]=true;
    new buslinie = 1;
    new vID = GetPlayerVehicleID(playerid);
    SetPVarInt(playerid, "bus", vID);
    SendClientMessage(playerid,COLOR_BLUE,"((Info)) Du bist jetzt auf der Linie 'C1 Los Santos' unterwegs!");
    Update3DTextLabelText(busline[i],COLOR_TURQUOISE,"C1 Los Santos");
    SetPlayerCheckpoint(playerid, bsInfo[0][l_x], bsInfo[0][l_y], bsInfo[0][l_z], 5);
    new text[128];
    format(text,sizeof(text),"Nächste Haltestelle: %s",bsInfo[blInfo[buslinie][bid]][stationname]);´ //Hier soll er eigentlich die Ansagen machen aber es kommt nichts
    SendClientMessage(playerid,COLOR_TURQUOISE,text);
    SetPVarInt(playerid, "c1lossantos", 0);
    SetPVarInt(playerid, "linec1",buslinie);
    }
    }
    }
    if(listitem==1)
    {
    for(new i=0; i<sizeof(BusVehs); i++)
    {
    if(GetPlayerVehicleID(playerid) == BusVehs[i])
    {
    pInfo[playerid][onjob]=true;
    new buslinie = 2;
    new vID = GetPlayerVehicleID(playerid);
    SetPVarInt(playerid, "bus", vID);
    SendClientMessage(playerid,COLOR_BLUE,"((Info)) Du bist jetzt auf der Linie 'L1 Red County' unterwegs!");
    Update3DTextLabelText(busline[i],COLOR_TURQUOISE,"L1 Red County");
    SetPlayerCheckpoint(playerid, bsInfo[0][l_x], bsInfo[0][l_y], bsInfo[0][l_z], 4);
    SetPVarInt(playerid, "l1redcounty", 0);
    SetPVarInt(playerid, "linel1",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;





    Ich hoffe jemand hatte eine Lösung und kann mir ein wenig unter die Arme greifen, den ich denke er könnte allen hilfreich sein!


    Grüße Addra


    Fehlermeldung:



    Logs:
    [mysql]
    Keine Log
    [/mysql]

    Hi _AEROX_


    ich sehe bei dir eigentlich nur einen Fehler. Versuch es mal so:


    Änderung nur auf Zeile 1: ocmd statt cmd, hatte damit auch oft Fehler durch meine Leichtsinnigkeit gemacht


    Ich hoffe, dies hilft dir