Tipologie server: pvm - pvp
*Resursă folosită: Extrasa din alt svf
*ServerFiles utilizat: marty c11 clean
*Syserr:
cmd_gm.cpp: In function 'void do_trivia(LPCHARACTER, const char*, int, int)':
cmd_gm.cpp:4627:16: error: aggregate 'std::ofstream myQuestions' has incomplete type and cannot be defined
std::ofstream myQuestions;
^
cmd_gm.cpp:4628:79: error: incomplete type 'std::ofstream {aka std::basic_ofstream<char>}' used in nested name specifier
myQuestions.open("/usr/home/game/share/locale/romania/trivia/intrebari.txt", std::ofstream::out | std::ofstream::trunc);
^
cmd_gm.cpp:4628
error: incomplete type 'std::ofstream {aka std::basic_ofstream<char>}' used in nested name specifier
myQuestions.open("/usr/home/game/share/locale/romania/trivia/intrebari.txt", std::ofstream::out | std::ofstream::trunc);
^
cmd_gm.cpp:4639:16: error: aggregate 'std::ofstream myAnswers' has incomplete type and cannot be defined
std::ofstream myAnswers;
^
cmd_gm.cpp:4640:78: error: incomplete type 'std::ofstream {aka std::basic_ofstream<char>}' used in nested name specifier
myAnswers.open("/usr/home/game/share/locale/romania/trivia/raspunsuri.txt", std::ofstream::out | std::ofstream::trunc);
^
cmd_gm.cpp:4640:99: error: incomplete type 'std::ofstream {aka std::basic_ofstream<char>}' used in nested name specifier
myAnswers.open("/usr/home/game/share/locale/romania/trivia/raspunsuri.txt", std::ofstream::out | std::ofstream::trunc);
^
cmd_gm.cpp:4659:2: error: 'string' was not declared in this scope
string questionLine;
^
cmd_gm.cpp:4659:2: note: suggested alternatives:
In file included from /usr/local/lib/gcc49/include/c++/string:39:0,
from /usr/local/lib/gcc49/include/c++/random:40,
from /usr/local/lib/gcc49/include/c++/bits/stl_algo.h:66,
from /usr/local/lib/gcc49/include/c++/algorithm:62,
from stdafx.h:15,
from cmd_gm.cpp:1:
/usr/local/lib/gcc49/include/c++/bits/stringfwd.h:62:33: note: 'std::string'
typedef basic_string<char> string;
^
/usr/local/lib/gcc49/include/c++/bits/stringfwd.h:62:33: note: 'std::string'
/usr/local/lib/gcc49/include/c++/bits/stringfwd.h:62:33: note: 'std::string'
/usr/local/lib/gcc49/include/c++/bits/stringfwd.h:62:33: note: 'std::string'
/usr/local/lib/gcc49/include/c++/bits/stringfwd.h:62:33: note: 'std::string'
/usr/local/lib/gcc49/include/c++/bits/stringfwd.h:62:33: note: 'std::string'
cmd_gm.cpp:4660:2: error: 'ifstream' was not declared in this scope
ifstream myQuestionFile("/usr/home/game/share/locale/romania/trivia/intrebari.txt");
^
cmd_gm.cpp:4660:2: note: suggested alternatives:
In file included from /usr/local/lib/gcc49/include/c++/bits/localefwd.h:41:0,
from /usr/local/lib/gcc49/include/c++/string:43,
from /usr/local/lib/gcc49/include/c++/random:40,
from /usr/local/lib/gcc49/include/c++/bits/stl_algo.h:66,
from /usr/local/lib/gcc49/include/c++/algorithm:62,
from stdafx.h:15,
from cmd_gm.cpp:1:
/usr/local/lib/gcc49/include/c++/iosfwd:157:34: note: 'std::ifstream'
typedef basic_ifstream<char> ifstream;
^
/usr/local/lib/gcc49/include/c++/iosfwd:157:34: note: 'std::ifstream'
/usr/local/lib/gcc49/include/c++/iosfwd:157:34: note: 'std::ifstream'
/usr/local/lib/gcc49/include/c++/iosfwd:157:34: note: 'std::ifstream'
/usr/local/lib/gcc49/include/c++/iosfwd:157:34: note: 'std::ifstream'
/usr/local/lib/gcc49/include/c++/iosfwd:157:34: note: 'std::ifstream'
cmd_gm.cpp:4661:6: error: 'myQuestionFile' was not declared in this scope
if (myQuestionFile.is_open())
^
cmd_gm.cpp:4663:27: error: 'questionLine' was not declared in this scope
getline(myQuestionFile, questionLine);
^
cmd_gm.cpp:4663:39: error: 'getline' was not declared in this scope
getline(myQuestionFile, questionLine);
^
cmd_gm.cpp:4663:39: note: suggested alternatives:
In file included from /usr/local/lib/gcc49/include/c++/string:52:0,
from /usr/local/lib/gcc49/include/c++/random:40,
from /usr/local/lib/gcc49/include/c++/bits/stl_algo.h:66,
from /usr/local/lib/gcc49/include/c++/algorithm:62,
from stdafx.h:15,
from cmd_gm.cpp:1:
/usr/local/lib/gcc49/include/c++/bits/basic_string.h
5: note: 'std::getline'
getline(basic_istream<_CharT, _Traits>&& __is,
^
/usr/local/lib/gcc49/include/c++/bits/basic_string.h
5: note: 'std::getline'
/usr/local/lib/gcc49/include/c++/bits/basic_string.h
5: note: 'std::getline'
/usr/local/lib/gcc49/include/c++/bits/basic_string.h
5: note: 'std::getline'
/usr/local/lib/gcc49/include/c++/bits/basic_string.h
5: note: 'std::getline'
/usr/local/lib/gcc49/include/c++/bits/basic_string.h
5: note: 'std::getline'
cmd_gm.cpp:4667:38: error: too many arguments to function 'void BroadcastNotice(const char*)'
BroadcastNotice(triviaNotice1, true);
^
cmd_gm.cpp
6: note: declared here
void BroadcastNotice(const char * c_pszBuf)
^
cmd_gm.cpp:4676:37: error: too many arguments to function 'void BroadcastNotice(const char*)'
BroadcastNotice(triviaNotice2, true);
^
cmd_gm.cpp
6: note: declared here
void BroadcastNotice(const char * c_pszBuf)
^
*Detalii suplimentare:
Este o comanda pentru eventul trivia, am mai bagat-o pe alte surse dar cu gcc48, aici ma cam lovesc si daca ma poate ajuta cineva Aici este si comanda
ACMD(do_trivia)
{
char arg1[256], arg2[256], arg3[256], arg4[256], arg5[256];
five_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2), arg3, sizeof(arg3), arg4, sizeof(arg4), arg5, sizeof(arg5));
if (!*arg1 || !*arg2 || !*arg3 || !*arg4 || !*arg5)
{
ch->ChatPacket(CHAT_TYPE_COMMAND, "OpenTriviaPanel");
return;
}
if (*arg1 && strcmp(arg1, "sistemtriviahahaha"))
{
ch->ChatPacket(CHAT_TYPE_INFO, "<trivia> Incorrect password!");
return;
}
std::string textQuestions = arg2;
std::ofstream myQuestions;
myQuestions.open("/usr/home/game/share/locale/romania/trivia/intrebari.txt", std::ofstream::out | std::ofstream::trunc);
myQuestions << textQuestions.c_str();
myQuestions.close();
char buf_copy[strlen(arg3)+1];
strcpy(buf_copy, arg3);
for (int z=0;z<strlen(buf_copy);z++)
{
if (islower(buf_copy[z]))
buf_copy[z] = toupper(buf_copy[z]);
}
std::ofstream myAnswers;
myAnswers.open("/usr/home/game/share/locale/romania/trivia/raspunsuri.txt", std::ofstream::out | std::ofstream::trunc);
myAnswers << buf_copy;
myAnswers.close();
int winVnum = 0, winCount = 0;
str_to_number(winVnum, arg4);
str_to_number(winCount, arg5);
TItemTable * pTable = ITEM_MANAGER::instance().GetTable(winVnum);
if (!pTable)
{
ch->ChatPacket(CHAT_TYPE_INFO, "<Trivia> Itemul cu id-ul %d nu exista.", winVnum);
return;
}
quest::CQuestManager::instance().RequestSetEventFlag("trivia_event", 1);
quest::CQuestManager::instance().RequestSetEventFlag("trivia_win_vnum", winVnum);
quest::CQuestManager::instance().RequestSetEventFlag("trivia_win_count", winCount);
string questionLine;
ifstream myQuestionFile("/usr/home/game/share/locale/romania/trivia/intrebari.txt");
if (myQuestionFile.is_open())
{
getline(myQuestionFile, questionLine);
char triviaNotice1[256];
snprintf(triviaNotice1, sizeof(triviaNotice1), LC_TEXT("Intrebare: %s"), questionLine.c_str());
BroadcastNotice(triviaNotice1, true);
myQuestionFile.close();
}
char triviaNotice2[256];
snprintf(triviaNotice2, sizeof(triviaNotice2), LC_TEXT("Cine raspunde corect, primeste: %s (x%d)"), pTable->szLocaleName, winCount);
BroadcastNotice(triviaNotice2, true);
}
