Bekomme mehrere Errors?!

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
  • N'Abend Brotfische,
    Habe mit einem Freund eben das SCript formatiert, jedoch bekommen
    wir einige Error-Messages:


    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(519) : warning 219: local variable "pname" shadows a variable at a preceding level
    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(537) : warning 219: local variable "pname" shadows a variable at a preceding level
    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(555) : warning 204: symbol is assigned a value that is never used: "string"
    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(555 -- 614) : error 010: invalid function or declaration
    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(555 -- 616) : error 010: invalid function or declaration
    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(555 -- 621) : error 010: invalid function or declaration
    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(555 -- 621) : fatal error 107: too many error messages on one line


    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    4 Errors.


    Die betroffenen Zeilen
    new pname[MAX_PLAYERS],accFormat[128];
    new pname[MAX_PLAYERS],accFormat[128];
    new string[256];


    //Hier gehts los mit den 555-621 Errors
    new string[256];
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp("/clear", cmdtext, true, 10) == 0)
    {
    if(Player[playerid][Admin] >= 1)
    {
    for (new MSG=1; MSG<=51; MSG++) SendClientMessageToAll(0," ");
    new AdminName[MAX_PLAYERS];
    new ClearChatString[256];
    GetPlayerName(playerid,AdminName, sizeof(AdminName));
    format(ClearChatString,sizeof(ClearChatString),"Administrator: %s has cleared the Chat!",AdminName);
    SendClientMessageToAll(0xFFFFFF,ClearChatString);
    return 1;
    }
    else
    {
    SendClientMessage(playerid,0xFFFFFF,"You aren't a admin!");
    return 1;
    }
    }
    if (strcmp(cmdtext, "/delete", true) == 0)
    {
    RemovePlayerAttachedObject(playerid, 1);
    }
    if (strcmp(cmdtext, "/me", true) == 0)
    {
    if(gTeam[playerid] == TEAM_LSPD)
    {
    GameTextForPlayer(playerid,"~w~YOu are a cop)!",2500,3);
    }
    else if(gTeam[playerid] == TEAM_BALLAS)
    {
    GameTextForPlayer(playerid,"~w~You are a Saint Jefferson Fighter)!",2500,3);
    }
    else if(gTeam[playerid] == TEAM_Grove)
    {
    GameTextForPlayer(playerid,"~w~You are a Grove Street Homie)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_RMafia)
    {
    GameTextForPlayer(playerid,"~w~You are a Member of the Russian Mafia)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_Atztecas)
    {
    GameTextForPlayer(playerid,"~w~You are a Member of the Various Atztecas)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_LCN)
    {
    GameTextForPlayer(playerid,"~w~You are a Member of the Sizilian Mafia)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_Triads)
    {
    GameTextForPlayer(playerid,"~w~You are a Triad)!",2500,3);
    }
    }
    return 1;
    }
    if (strcmp(cmdtext, "/pd", true) == 0)
    {
    if(gTeam[playerid] == TEAM_LSPD)
    {
    SetObjectRot(pdgate, 0, 1.7499694824219, 89.749908447266);
    SetTimer("GateClosePd", 3500, 0);
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED,"You aren`t a cop!");
    }
    return 1;
    }


    edit:// Kompletter PD Befehl gepostet...


    lg

    2 Mal editiert, zuletzt von Zcelo12 () aus folgendem Grund: RS

  • Sollte deine Fehler vermindern...



    new pname[MAX_PLAYERS],accFormat[128];


    //Hier gehts los mit den 555-621 Errors
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp("/clear", cmdtext, true, 10) == 0)
    {
    if(Player[playerid][Admin] >= 1)
    {
    for (new MSG=1; MSG<=51; MSG++) SendClientMessageToAll(0," ");
    new AdminName[MAX_PLAYERS];
    new ClearChatString[256];
    GetPlayerName(playerid,AdminName, sizeof(AdminName));
    format(ClearChatString,sizeof(ClearChatString),"Administrator: %s has cleared the Chat!",AdminName);
    SendClientMessageToAll(0xFFFFFF,ClearChatString);
    return 1;
    }
    else
    {
    SendClientMessage(playerid,0xFFFFFF,"You aren't a admin!");
    return 1;
    }
    }
    if (strcmp(cmdtext, "/delete", true) == 0)
    {
    RemovePlayerAttachedObject(playerid, 1);
    }
    if (strcmp(cmdtext, "/me", true) == 0)
    {
    if(gTeam[playerid] == TEAM_LSPD)
    {
    GameTextForPlayer(playerid,"~w~YOu are a cop)!",2500,3);
    }
    else if(gTeam[playerid] == TEAM_BALLAS)
    {
    GameTextForPlayer(playerid,"~w~You are a Saint Jefferson Fighter)!",2500,3);
    }
    else if(gTeam[playerid] == TEAM_Grove)
    {
    GameTextForPlayer(playerid,"~w~You are a Grove Street Homie)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_RMafia)
    {
    GameTextForPlayer(playerid,"~w~You are a Member of the Russian Mafia)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_Atztecas)
    {
    GameTextForPlayer(playerid,"~w~You are a Member of the Various Atztecas)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_LCN)
    {
    GameTextForPlayer(playerid,"~w~You are a Member of the Sizilian Mafia)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_Triads)
    {
    GameTextForPlayer(playerid,"~w~You are a Triad)!",2500,3);
    }
    }
    return 1;
    }
    if (strcmp(cmdtext, "/pd", true) == 0)
    {
    if(gTeam[playerid] == TEAM_LSPD)
    {
    SetObjectRot(pdgate, 0, 1.7499694824219, 89.749908447266);
    SetTimer("GateClosePd", 3500, 0);
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED,"You aren`t a cop!");
    }
    return 1;
    }



    Zu den Errors:


    pname ist zweimal definiert wieso?
    string wird nicht genutzt!


    Teste mal so

  • Jo:


    new pname[MAX_PLAYERS],accFormat[128]; //error unter OnPlayerConnectt
    new pname[MAX_PLAYERS],accFormat[128]; //error unter OnPlayerDisConnect
    //Der Abschnitt wird komplett angezeigt (error)
    new string[256];
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp("/clear", cmdtext, true, 10) == 0)
    {
    if(Player[playerid][Admin] >= 1)
    {
    for (new MSG=1; MSG<=51; MSG++) SendClientMessageToAll(0," ");
    new AdminName[MAX_PLAYERS];
    new ClearChatString[256];
    GetPlayerName(playerid,AdminName, sizeof(AdminName));
    format(ClearChatString,sizeof(ClearChatString),"Administrator: %s has cleared the Chat!",AdminName);
    SendClientMessageToAll(0xFFFFFF,ClearChatString);
    return 1;
    }
    else
    {
    SendClientMessage(playerid,0xFFFFFF,"You aren't a admin!");
    return 1;
    }
    }
    if (strcmp(cmdtext, "/delete", true) == 0)
    {
    RemovePlayerAttachedObject(playerid, 1);
    }
    if (strcmp(cmdtext, "/me", true) == 0)
    {
    if(gTeam[playerid] == TEAM_LSPD)
    {
    GameTextForPlayer(playerid,"~w~YOu are a cop)!",2500,3);
    }
    else if(gTeam[playerid] == TEAM_BALLAS)
    {
    GameTextForPlayer(playerid,"~w~You are a Saint Jefferson Fighter)!",2500,3);
    }
    else if(gTeam[playerid] == TEAM_Grove)
    {
    GameTextForPlayer(playerid,"~w~You are a Grove Street Homie)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_RMafia)
    {
    GameTextForPlayer(playerid,"~w~You are a Member of the Russian Mafia)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_Atztecas)
    {
    GameTextForPlayer(playerid,"~w~You are a Member of the Various Atztecas)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_LCN)
    {
    GameTextForPlayer(playerid,"~w~You are a Member of the Sizilian Mafia)!",2500,3);
    }
    else if (gTeam[playerid] == TEAM_Triads)
    {
    GameTextForPlayer(playerid,"~w~You are a Triad)!",2500,3);
    }
    }
    return 1;
    }
    if (strcmp(cmdtext, "/pd", true) == 0)
    {
    if(gTeam[playerid] == TEAM_LSPD)
    {
    SetObjectRot(pdgate, 0, 1.7499694824219, 89.749908447266);
    SetTimer("GateClosePd", 3500, 0);
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED,"You aren`t a cop!");
    }
    return 1;
    }


    DIe Errors sind nach der Reihenfolge des 1. Post ;)


    lg ?(

  • Ok,
    zu den ersten beiden Warnings



    new pname[MAX_PLAYERS],accFormat[128];


    hast du unter OnPlayerConnect und OnPlayerDisconnect definiert.
    Nenn es unter OnPlayerDIsconnect mal um auf



    new pname2[MAX_PLAYERS],accFormat[128];


    und natürlich musst du dann unter OnPlayerDisconnect auch pname in pname2 umbenennen.


    Der Warning erscheint, wenn das selbe mehrmals definiert wird.


    Bei dem Befehl /clear mach mal das return1; weg und teste nochmal.

  • Jezt nur noch folgende Error'r


    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(557) : warning 204: symbol is assigned a value that is never used: "string"
    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(557 -- 615) : error 010: invalid function or declaration
    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(557 -- 617) : error 010: invalid function or declaration
    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(557 -- 622) : error 010: invalid function or declaration
    C:\Dokumente und Einstellungen\Vitalij\Desktop\GTA- San Andreas\gamemodes\GML.pwn(557 -- 622) : fatal error 107: too many error messages on one line


    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    4 Errors.
    Sobald ich String aber lösche bekomme ich 26 Error's ?(


    lg