Script fehler

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
  • Liebe Community,
    undzwar möchte ich ein kleines DM script anfertigen, um mich ein bisschen an scripten zu setzen,
    doch leider kann ich den fehler nicht beheben, hier die line:


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid == DIA_LOG)
    {
    if(response == 0)
    {
    SendClientMessage(playerid, WHITE, "You have clicked Cancel and will kicked!");
    Kick(playerid);
    return 1;
    }
    else
    {
    if(!strlen(inputtext))
    {
    SendClientMessage(playerid, RED, "The password must have at least 6 numbers & letters!");
    ShowPlayerDialog(playerid, DIA_LOG, DIALOG_STYLE_INPUT, "Login","Please Login!","Login","Cancel");
    return 1;
    }
    else
    {return Login(playerid, key);}
    }
    }
    }
    {
    if(dialogid == DIA_REG)
    {
    if(response == 0)
    {
    SendClientMessage(playerid, WHITE, "You have clicked Cancel and will kicked!");
    Kick(playerid);
    return 1;
    }
    else
    {
    if(!strlen(inputtext))
    {
    SendClientMessage(playerid, RED, "The password must have at least 6 numbers & letters!");
    ShowPlayerDialog(playerid, DIA_REG, DIALOG_STYLE_INPUT, "Register","Please register!","Register","Cancel");
    return 1;
    }
    else
    {return Register(playerid, inputtext);}
    }
    }
    }





    Und hier der Error:C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(229) : warning 217: loose indentation
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(238) : error 017: undefined symbol "Login"
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(241) : warning 209: function "OnDialogResponse" should return a value
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(242) : error 055: start of function body without function header
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(243) : error 010: invalid function or declaration
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(245) : error 010: invalid function or declaration
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(249) : error 010: invalid function or declaration
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(251) : error 010: invalid function or declaration
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(253) : error 010: invalid function or declaration
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(257) : error 010: invalid function or declaration
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(259) : error 010: invalid function or declaration
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(260) : error 010: invalid function or declaration
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    10 Errors.

    3 Mal editiert, zuletzt von Failpm ()

  • Du schließt die Klammer immer wieder zu viel. So wär es richtig.


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid == DIA_LOG)
    {
    if(response == 0)
    {
    SendClientMessage(playerid, WHITE, "You have clicked Cancel and will kicked!");
    Kick(playerid);
    return 1;
    }
    else
    {
    if(!strlen(inputtext))
    {
    SendClientMessage(playerid, RED, "The password must have at least 6 numbers & letters!");
    ShowPlayerDialog(playerid, DIA_LOG, DIALOG_STYLE_INPUT, "Login","Please Login!","Login","Cancel");
    return 1;
    }
    else
    {return Login(playerid, key);}
    }
    }
    if(dialogid == DIA_REG)
    {
    if(response == 0)
    {
    SendClientMessage(playerid, WHITE, "You have clicked Cancel and will kicked!");
    Kick(playerid);
    return 1;
    }
    else
    {
    if(!strlen(inputtext))
    {
    SendClientMessage(playerid, RED, "The password must have at least 6 numbers & letters!");
    ShowPlayerDialog(playerid, DIA_REG, DIALOG_STYLE_INPUT, "Register","Please register!","Register","Cancel");
    return 1;
    }
    else
    {return Register(playerid, inputtext);}
    }
    }
    }


    Öffne den Expander wenn du wissen willst, was genau falsch war.


    Spoiler anzeigen

    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid == DIA_LOG)
    {
    if(response == 0)
    {
    SendClientMessage(playerid, WHITE, "You have clicked Cancel and will kicked!");
    Kick(playerid);
    return 1;
    }
    else
    {
    if(!strlen(inputtext))
    {
    SendClientMessage(playerid, RED, "The password must have at least 6 numbers & letters!");
    ShowPlayerDialog(playerid, DIA_LOG, DIALOG_STYLE_INPUT, "Login","Please Login!","Login","Cancel");
    return 1;
    }
    else
    {return Login(playerid, key);}
    }
    }
    }//<--
    {//<--
    if(dialogid == DIA_REG)
    {
    if(response == 0)
    {
    SendClientMessage(playerid, WHITE, "You have clicked Cancel and will kicked!");
    Kick(playerid);
    return 1;
    }
    else
    {
    if(!strlen(inputtext))
    {
    SendClientMessage(playerid, RED, "The password must have at least 6 numbers & letters!");
    ShowPlayerDialog(playerid, DIA_REG, DIALOG_STYLE_INPUT, "Register","Please register!","Register","Cancel");
    return 1;
    }
    else
    {return Register(playerid, inputtext);}
    }
    }
    }


  • if(strcmp(key, dini_Get(Spielerdatei, "Password", true) == 0)

    Da kommt dann der fehler, hast du dafür ne lösung? Danke schonmal^^
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(230) : warning 217: loose indentation
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(239) : error 017: undefined symbol "key"
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(250) : warning 217: loose indentation
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(262) : warning 209: function "OnDialogResponse" should return a value
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(286) : warning 202: number of arguments does not match definition
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(286) : error 033: array must be indexed (variable "dini_Get")
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(290) : warning 217: loose indentation
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(292) : warning 209: function "Login" should return a value
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    2 Errors.

  • Ich meine

    if(strcmp(key, dini_Get(Spielerdatei, "Password", true) == 0)


    Fehler: C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(286) : error 033: array must be indexed (variable "dini_Get")

  • Danke dir ;)


    Leider habe ich noch diese warnings:


    C:\Users\LeNoVo\Desktop\Server\pawno\include\Dini.inc(50) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\pawno\include\Dini.inc(109) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\pawno\include\Dini.inc(115) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\pawno\include\Dini.inc(119) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\pawno\include\Dini.inc(125) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\pawno\include\Dini.inc(129) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\pawno\include\Dini.inc(133) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\pawno\include\Dini.inc(140) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\pawno\include\Dini.inc(187) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\pawno\include\Dini.inc(214) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(230) : warning 217: loose indentation
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(250) : warning 217: loose indentation
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(262) : warning 209: function "OnDialogResponse" should return a value
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(269) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(280) : warning 219: local variable "key" shadows a variable at a preceding level
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(292) : warning 217: loose indentation
    C:\Users\LeNoVo\Desktop\Server\gamemodes\testgamemode.pwn(294) : warning 203: symbol is never used: "key"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    17 Warnings.


    Sorry für die ganzen fragen, bin aber sehr neu in der Pawno script szene^^

    2 Mal editiert, zuletzt von Failpm ()

  • Guck dir doch mal diesen Thread an, da hat der Trooper[Y] einen netten deutschen Pawn-Compiler erstellt. Der listet dir dann die Warnings und Errors in deutsch.


    Link:


    Die Warnung: "local variable "key" shadows a variable at a preceding level" bedeutet so viel wie, du hast die Variable "key" an andere Stelle bereits definiert.


    IM AUFBAU!