12 Fehler in einer Include

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • ich machs kurz. Fehler:


    Code:
    public OnPlayerConnect(playerid)
    {
    new DERBY[playerid][10] = "FALSE";
    new RACE1[playerid][10] = "FALSE";
    new RACE2[playerid][10] = "FALSE";
    new Race3[playerid][10] = "FALSE";
    return 1;
    }
    public OnPlayerDisconnect(playerid)
    {
    strdel(DERBY[playerid], 0, 10);
    strdel(RACE1[playerid], 0, 10);
    strdel(RACE2[playerid], 0, 10);
    strdel(Race3[playerid], 0, 10);
    }
    Was ist da los?


  • new DERBY[MAX_PLAYERS][10] = "FALSE";
    new RACE[MAX_PLAYERS][10] = "FALSE";
    new RACE2[MAX_PLAYERS][10] = "FALSE";
    new Race3[MAX_PLAYERS][10] = "FALSE";


    public OnPlayerConnect(playerid) {
    DERBY[playerid][10] = "FALSE";
    RACE1[playerid][10] = "FALSE";
    RACE2[playerid][10] = "FALSE";
    Race3[playerid][10] = "FALSE";

    return 1;
    }


    public OnPlayerDisconnect(playerid) {
    strdel(DERBY[playerid], 0, 10);
    strdel(RACE1[playerid], 0, 10);
    strdel(RACE2[playerid], 0, 10);
    strdel(Race3[playerid], 0, 10);
    }

  • Also danke erstmal aber jetzt kommt


    Diesbezüglich noch eine Frage: Bei DERBY[playerid] wird dann schon automatisch z.B. DERBY5 eingefügt?

    Einmal editiert, zuletzt von Hubarz ()

  • Klar geht das:


    new DERBY[MAX_PLAYERS][10];
    new RACE1[MAX_PLAYERS][10];
    new RACE2[MAX_PLAYERS][10];
    new Race3[MAX_PLAYERS][10];



    public OnPlayerConnect(playerid) {
    DERBY[playerid] = "FALSE";
    RACE1[playerid] = "FALSE";
    RACE2[playerid] = "FALSE";
    Race3[playerid] = "FALSE";


    return 1;
    }


    public OnPlayerDisconnect(playerid) {
    strdel(DERBY[playerid], 0, 10);
    strdel(RACE1[playerid], 0, 10);
    strdel(RACE2[playerid], 0, 10);
    strdel(Race3[playerid], 0, 10);
    }

    Miete mich (nicht) :love:

  • THX
    Kommt aber noch ein Warn:

    Zitat

    warning 209: function "OnPlayerDisconnect" should return a value


    Der hat nichts zu sagen, oder?


    Im Script kommen aber noch 6 Fehler:


    Soll ich noch das komplette Script posten?

    Einmal editiert, zuletzt von Hubarz ()

  • Gerne ^^
    Sind acuh nur 90 Zeilen
    #include <a_samp>
    #include <fornewfunc>
    #define COLOR_RED 0xAA3333AA
    new vehicle;


    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print(" Derby - by Hubarz");
    print("--------------------------------------\n");
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp("/derby", cmdtext, true, 10) == 0)
    { SetPlayerInterior(playerid, 82);
    format(DERBY[MAX_PLAYERS], 10, "TRUE");
    SetPlayerCameraPos(playerid, -1516.63, 1004.24, 1038);
    SetPlayerCameraLookAt(playerid, -1417.8927, 932.4482, 1041.5313);
    ShowPlayerDialog(playerid, vehicle, DIALOG_STYLE_LIST, "Bitte ein Fahrzeug wählen", "Sandking\nBloodring Banger\nHotring Racer", "Beitreten!");
    return 1;
    }
    if (strcmp("/exit", cmdtext, true, 10) == 0)
    {
    if(DERBY[MAX_PLAYERS] == "TRUE")
    {
    DestroyVehicle(DerbyVeh[playerid]);
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, 1572.5245361328, -1244.7938232422, 782.60906982422);
    SetCameraOnPlayer(playerid);
    format(DERBY[MAX_PLAYERS], 10, "FALSE");
    return 1;
    }
    }

    return 0;
    }



    public OnPlayerDisconnect(playerid)
    {
    if(DERBY[MAX_PLAYERS] == "TRUE")
    {
    DestroyVehicle(DerbyVeh[playerid]);
    return 1;
    }
    return 1;
    }




    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid == vehicle)
    {
    switch(listitem)
    {
    case 0:
    {
    new DerbyVeh[playerid] = CreateVehicle(495, -1516.63, 1004.24, 1038, -1, -1);
    LinkVehicleToInterior(DerbyVeh[playerid], 82);
    PutPlayerInVehicle(playerid, DerbyVeh[playerid], 0);
    SetCameraBehindPlayer(playerid);
    }
    case 1:
    {
    new DerbyVeh[playerid] = CreateVehicle(503, -1516.63, 1004.24, 1038, -1, -1);
    LinkVehicleToInterior(DerbyVeh[playerid], 82);
    PutPlayerInVehicle(playerid, DerbyVeh[playerid], 0);
    SetCameraBehindPlayer(playerid);
    }
    case 2:
    {
    new DerbyVeh[playerid] = CreateVehicle(504, -1516.63, 1004.24, 1038, -1, -1);
    LinkVehicleToInterior(DerbyVeh[playerid], 82);
    PutPlayerInVehicle(playerid, DerbyVeh[playerid], 0);
    SetCameraBehindPlayer(playerid);
    }
    }
    public OnPlayerExitVehicle(playerid, vehicleid)
    { if(DERBY[MAX_PLAYERS] == "TRUE")
    {
    SetPlayerHealth(playerid, 0);
    SendClientMessage(playerid, COLOR_RED, "Während des Derbys darfst du dein Fahrzeug nicht verlassen!")
    }
    }
    }

  • Sei mir nicht Böse wenn jetzt irgendwas nicht funktioniert.
    Denn das Script ist echt übel ^^


    #include <a_samp>


    #define COLOR_RED 0xAA3333AA
    #define DialogNr 1


    new DERBY[MAX_PLAYERS][10];
    new RACE1[MAX_PLAYERS][10];
    new RACE2[MAX_PLAYERS][10];
    new Race3[MAX_PLAYERS][10];
    new vehicle;


    public OnPlayerConnect(playerid)
    {
    DERBY[playerid] = "FALSE";
    RACE1[playerid] = "FALSE";
    RACE2[playerid] = "FALSE";
    Race3[playerid] = "FALSE";
    return 1;
    }


    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print(" Derby - by Hubarz");
    print("--------------------------------------\n");
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp("/derby", cmdtext, true, 10) == 0)
    { SetPlayerInterior(playerid, 82);
    format(DERBY[playerid], 10, "TRUE");
    SetPlayerCameraPos(playerid, -1516.63, 1004.24, 1038);
    SetPlayerCameraLookAt(playerid, -1417.8927, 932.4482, 1041.5313);
    ShowPlayerDialog(playerid, DialogNr, DIALOG_STYLE_LIST, "Bitte ein Fahrzeug wählen", "Sandking\nBloodring Banger\nHotring Racer", "Beitreten!", "");
    return 1;
    }
    if (strcmp("/exit", cmdtext, true, 10) == 0)
    {
    if(strcmp("TRUE", DERBY[playerid], true, 4) == 0)
    {
    DestroyVehicle(vehicle);
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, 1572.5245361328, -1244.7938232422, 782.60906982422);
    SetCameraBehindPlayer(playerid);
    format(DERBY[playerid], 10, "FALSE");
    return 1;
    }
    }
    return 0;
    }



    public OnPlayerDisconnect(playerid)
    {
    if(strcmp("TRUE", DERBY[playerid], true, 4) == 0)
    {
    DestroyVehicle(vehicle);
    }
    strdel(DERBY[playerid], 0, 10);
    strdel(RACE1[playerid], 0, 10);
    strdel(RACE2[playerid], 0, 10);
    strdel(Race3[playerid], 0, 10);
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid == vehicle)
    {
    switch(listitem)
    {
    case 0:
    {
    vehicle = CreateVehicle(495, -1516.63, 1004.24, 1038, 0, -1, -1, -1);
    LinkVehicleToInterior(vehicle, 82);
    PutPlayerInVehicle(playerid, vehicle, 0);
    SetCameraBehindPlayer(playerid);
    }
    case 1:
    {
    vehicle = CreateVehicle(503, -1516.63, 1004.24, 1038, 0, -1, -1, -1);
    LinkVehicleToInterior(vehicle, 82);
    PutPlayerInVehicle(playerid, vehicle, 0);
    SetCameraBehindPlayer(playerid);
    }
    case 2:
    {
    vehicle = CreateVehicle(504, -1516.63, 1004.24, 1038, 0, -1, -1, -1);
    LinkVehicleToInterior(vehicle, 82);
    PutPlayerInVehicle(playerid, vehicle, 0);
    SetCameraBehindPlayer(playerid);
    }
    }
    }
    }


    public OnPlayerExitVehicle(playerid, vehicleid)
    {
    if(strcmp("TRUE", DERBY[playerid], true, 4) == 0)
    {
    SetPlayerHealth(playerid, 0);
    SendClientMessage(playerid, COLOR_RED, "Während des Derbys darfst du dein Fahrzeug nicht verlassen!");
    }
    return 1;
    }


    Pastebin.com:
    http://pastebin.com/xpXeRcBT

    Miete mich (nicht) :love:

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Ok da waren noch ein paar Fehler meinerseits drin, die ich verbessert habe, allerdings sthet man jetzt ohne car in der Arena und es wird auch keins gespawnt.
    Der aktuelle Code:
    #include <a_samp>


    #define COLOR_RED 0xAA3333AA
    #define DialogNr 1


    new DERBY[MAX_PLAYERS][10];
    new RACE1[MAX_PLAYERS][10];
    new RACE2[MAX_PLAYERS][10];
    new Race3[MAX_PLAYERS][10];
    new vehicle;


    public OnPlayerConnect(playerid)
    {
    DERBY[playerid] = "FALSE";
    RACE1[playerid] = "FALSE";
    RACE2[playerid] = "FALSE";
    Race3[playerid] = "FALSE";
    return 1;
    }


    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print(" Derby - by Hubarz");
    print("--------------------------------------\n");
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp("/derby", cmdtext, true, 10) == 0)
    { SetPlayerPos(playerid, -1518.90, 997.67, 1041);
    SetPlayerCameraPos(playerid, -1516.63, 1004.24, 1038);
    SetPlayerCameraLookAt(playerid, -1417.8927, 932.4482, 1041.5313);
    SetPlayerInterior(playerid, 15);
    format(DERBY[playerid], 10, "TRUE");
    ShowPlayerDialog(playerid, DialogNr, DIALOG_STYLE_LIST, "Bitte ein Fahrzeug wählen", "Sandking\nBloodring Banger\nHotring Racer", "Beitreten!", "");
    return 1;
    }
    if (strcmp("/exit", cmdtext, true, 10) == 0)
    {
    if(strcmp("TRUE", DERBY[playerid], true, 4) == 0)
    {
    DestroyVehicle(vehicle);
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, 1572.5245361328, -1244.7938232422, 782.60906982422);
    SetCameraBehindPlayer(playerid);
    format(DERBY[playerid], 10, "FALSE");
    return 1;
    }
    }
    return 0;
    }



    public OnPlayerDisconnect(playerid)
    {
    if(strcmp("TRUE", DERBY[playerid], true, 4) == 0)
    {
    DestroyVehicle(vehicle);
    }
    strdel(DERBY[playerid], 0, 10);
    strdel(RACE1[playerid], 0, 10);
    strdel(RACE2[playerid], 0, 10);
    strdel(Race3[playerid], 0, 10);
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid == vehicle)
    {
    switch(listitem)
    {
    case 0:
    {
    vehicle = CreateVehicle(495, -1518.90, 997.67, 1041, 0, -1, -1, -1);
    LinkVehicleToInterior(vehicle, 15);
    PutPlayerInVehicle(playerid, vehicle, 0);
    SetCameraBehindPlayer(playerid);
    }
    case 1:
    {
    vehicle = CreateVehicle(503, -1518.90, 997.67, 1041,0, -1, -1, -1);
    LinkVehicleToInterior(vehicle, 15);
    PutPlayerInVehicle(playerid, vehicle, 0);
    SetCameraBehindPlayer(playerid);
    }
    case 2:
    {
    vehicle = CreateVehicle(504, -1518.90, 997.67, 1041, 0, -1, -1, -1);
    LinkVehicleToInterior(vehicle, 15);
    PutPlayerInVehicle(playerid, vehicle, 0);
    SetCameraBehindPlayer(playerid);
    }
    }
    }
    }


    public OnPlayerExitVehicle(playerid, vehicleid)
    {
    if(strcmp("TRUE", DERBY[playerid], true, 4) == 0)
    {
    SetPlayerHealth(playerid, 0);
    SendClientMessage(playerid, COLOR_RED, "Während des Derbys darfst du dein Fahrzeug nicht verlassen!");
    }
    return 1;
    }

  • Weil ich mich erstmal darauf konzentrieren wollte, dass es überhaupt funktioniert. Trotzdem danke.
    Wie kann ich eig machen, dass die Strings(bools) in allen FS und Gamemodes verfügbar ist?
    Ich dachte eig an ein include, aber das wurde von Bubelbub ja zurückgewiesen.

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen