Максимкин

[закрыто] warning 219: local variable "string" shadows a variable at a preceding level.

Рекомендованные сообщения



Не найдено.

4 posts in this topic

Решил я значит написать команду Баг-Репорта,как выскакивает 2 варнинга в этих строках:

Спойлер

    new string[sizeof(bug_str)+MAX_PLAYER_NAME+144]; // Warning в первой кмд.
/*Много строк*/
    new string[sizeof(sug_str)+MAX_PLAYER_NAME+144]; // Warning во второй кмд.

Варнинг:  warning 219: local variable "string" shadows a variable at a preceding level
Я начинающий в pawno.
Мой Баг-Репорт разделен на 2-е кмд.

Share this post


Link to post
Share on other sites

@Максимкин в конце команды перед } поставь return true; 

Share this post


Link to post
Share on other sites
Спойлер

CMD:bug(playerid, params[])
{
    static const str_usage[] = !"Èñïîëüçîâàíèå: /bug [îïèñàíèå áàãà]";
    if(isnull(params))
        return SendClientMessage(playerid, -1, str_usage);
    if(CheckBugReportCooldown(playerid))
        return 1;
    static    const bug_str[] = " ñîîáùèë î áàãå: ";
    new string[sizeof(bug_str)+MAX_PLAYER_NAME+144];
    GetPlayerName(playerid, string, sizeof(string));
    strcat(string, bug_str), strcat(string, params);
    new File:bug_report_file = fopen(!BUG_REPORT_FILE_NAME, io_append);
    static const str_couldnt_open_file[] =
        !"Îøèáêà: Íå óäàëîñü îòêðûòü ôàéë \"" BUG_REPORT_FILE_NAME "\" !";
    if(_:bug_report_file == 0)
        return SendClientMessage(playerid, -1, str_couldnt_open_file);
    fwrite(bug_report_file, string);
    fclose(bug_report_file);
    SendClientMessage(playerid, -1, !"Âû óñïåøíî ñîîáùèëè î áàãå. Ñïàñèáî!");
    string[0] = ' ', string[1] = '\0', strcat(string, params);
    return SendClientMessage(playerid, -1, string);
}

//
CMD:sug(playerid, params[])
{
    static const str_usage[]= !"Èñïîëüçîâàíèå: /sug [ïðåäëîæåíèå ïî óëó÷øåíèþ]";
    if(isnull(params))
        return SendClientMessage(playerid, -1, str_usage);
    if(CheckBugReportCooldown(playerid))
        return 1;
    static    const sug_str[] = " ïðåäëîæèë: ";
    new string[sizeof(sug_str)+MAX_PLAYER_NAME+144];
    GetPlayerName(playerid, string, sizeof(string));
    strcat(string, sug_str), strcat(string, params);
    new File:suggestion_file = fopen(!SUGGESTION_FILE_NAME, io_append);
    static const str_couldnt_open_file[] =
        !"Îøèáêà: Íå óäàëîñü îòêðûòü ôàéë \"" SUGGESTION_FILE_NAME "\" !";
    if(_:suggestion_file == 0)
        return SendClientMessage(playerid, -1, str_couldnt_open_file);
    fwrite(suggestion_file, string);
    fclose(suggestion_file);
    SendClientMessage(
        playerid, -1,
        !"Âû óñïåøíî íàïèñàëè ïðåäëîæåíèå ïî óëó÷øåíèþ. Ñïàñèáî!"
    );
    string[0] = ' ', string[1] = '\0', strcat(string, params);
    return SendClientMessage(playerid, -1, string);
}

Вот две этих КМД,мне кажется в конце где } - это закрывает саму кмд,получается туда надо поставить retrun true;? Мне кажется бред..
Ну или я не особо одаренный.
@DEST

Цитата

@Максимкин в конце команды перед } поставь return true; 

 

Edited by Максимкин

Share this post


Link to post
Share on other sites

@Максимкин тогда замените в одной из команд string на другое название

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • x_SkYAs_x
      By x_SkYAs_x
      Здравствуйте у меня возникла проблема вот с этим
      D:\gamemodes\new.pwn(976) : fatal error 100: cannot read from file: "../sourse/other/colors.inc" Compilation aborted. Pawn compiler 3.10.7 Copyright (c) 1997-2006, ITB CompuPhase 1 Error. Помогите пожалуйста
    • _bogdan_
      By _bogdan_
      Доброго времени суток, столкнулся в первые с такой проблемой. В консоле вылезли warning sampgdk.
      Подскажите в чем суть проблемы.
      [02:01:44] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:44] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:44] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:44] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:44] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:44] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:44] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:45] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:45] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:45] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:45] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:45] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:45] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:45] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:46] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051) [02:01:48] [sampgdk:warning] Index mismatch for OnUnoccupiedVehicleUpdate (-10052 != -10051)