Другое С/С++ Вопрос - Ответ

sаnеk

Всефорумный sanek
Друг
2,107
2,059
тогда не заменяй, а дополняй
так я дополнил и крашит)
upload_2017-9-10_19-12-40.png
 

SR_team

like pancake
BH Team
4,720
6,370

sаnеk

Всефорумный sanek
Друг
2,107
2,059
сработало, если разбить на 3 условия, но какая-то хуйня получается
 

Вложения

  • upload_2017-9-10_19-51-10.png
    upload_2017-9-10_19-51-10.png
    39.7 KB · Просмотры: 335

2Shae

Известный
149
8
Код:
std::string result;
DWORD nSize = 255;
GetPrivateProfileSection(LPCSTR("section"), LPSTR(&result), nSize, "SAMPFUNCS\\test.ini");
SF->Log(result.c_str());
Почему крашит, блеать?

Текст в файле:
Код:
[section]
one=lol
two=lul
three=kek
 

BlackKnigga

Известный
BH Team
922
445
Код:
std::string result;
DWORD nSize = 255;
GetPrivateProfileSection(LPCSTR("section"), LPSTR(&result), nSize, "SAMPFUNCS\\test.ini");
SF->Log(result.c_str());
Почему крашит, блеать?

Текст в файле:
Код:
[section]
one=lol
two=lul
three=kek
Ты уверен что в функцию можно передать стринг?
 

2Shae

Известный
149
8
Потому что надо документацию читать, блеать.
lpReturnedString [out]
A pointer to a buffer that receives the key name and value pairs associated with the named section. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character.
Как тогда достать все строки, которые в секции?

Ты уверен что в функцию можно передать стринг?
Ну, бля, конкретную строку в секции же читает.
 
Последнее редактирование модератором:

Karbun

Участник
112
3
Почему не выводятся ники игроков? Вроде всё верно написал:mega_shok:
C++:
void vivod2(void)
{
    for (int i = 0; i > SAMP_MAX_PLAYERS, i++;)
    {
        if (SF->getSAMP()->getPlayers()->iIsListed[i])
        {
            SF->getSAMP()->getChat()->AddChatMessage(-1, "%s"),
                SF->getSAMP()->getPlayers()->GetPlayerName(i);
        }
    }
};

void CALLBACK vivod1(std::string str)
{
    vivod2();
};

void CALLBACK mainloop()
{
    static bool init = false;
    if (!init)
    {
        if (GAME == nullptr)
            return;
        if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
            return;
        if (!SF->getSAMP()->IsInitialized())
            return;
        SF->getSAMP()->registerChatCommand("vivod", vivod1);
        init = true;
    }
}
 

Karbun

Участник
112
3
HELP! До цикла For все работает, но после него нет... Не знаю в чем причина.
C++:
void vivod2(void)
{
    for (int i = 0; i < SAMP_MAX_PLAYERS, i++;)
    {
        if (SF->getSAMP()->getPlayers()->iIsListed[i])
        {
            SF->getSAMP()->getChat()->AddChatMessage(-1, "%s"),
                SF->getSAMP()->getPlayers()->GetPlayerName(i);
        }
    }
};

void CALLBACK vivod1(std::string str)
{
    vivod2();
};

void CALLBACK mainloop()
{
    static bool init = false;
    if (!init)
    {
        if (GAME == nullptr)
            return;
        if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
            return;
        if (!SF->getSAMP()->IsInitialized())
            return;
        SF->getSAMP()->registerChatCommand("vivod", vivod1);
        init = true;
    }
}