-
Member
[Help] Found Error from Ban Command codes by BBim
Found error this part
-----------------------
BAN COMMAND:
else if(_stricmp(command, "ban") == 0){ //check if it is the ban command
char* who = strtok_s(NULL, " ",&next_token); //take the next part just after the space after the ban word, wich is the player name
Player* who2 = getPlayerByName(who); //take the player by player name
int acc_id;
if (who2 != NULL) //if who2 is different of NULL, the player is online
{
who2->setAccessLevel(0); //sets it accesslevel ingame to 0
acc_id = who2->getOwner(); //takes the account id of that char
MySQL::setInt("accounts", "accesslvl", acc_id, 0); //update the accounts table changing its accesslevel to 0
}
else
{
char * sAcc_id = new char[]; //variable to store the account id from the characters table
MySQL::getString("characters", "name", who, "owner", sAcc_id); //takes the account id
acc_id = strval(sAcc_id); //take account id as integer
MySQL::setInt("accounts", "accesslvl", acc_id, 0); //update the accounts table changing its accesslevel to 0
delete[] sAcc_id; //delete sAcc_id from the memory(if you dont do, nobody will do for you in this case)
}
return true; //dont let !ban <player name> appears at the screen
}
-----------------------
I have done everything except the ban part, when I remove the Ban command codes, the errors gone 0 errors, 4 warnings, but when the ban codes are in the Players.cpp found 6 errors, 4 warnings,
the errors
----------------------------
2>Players.cpp
2>c:\dragonflyff_source\gameserver\players.cpp(387) : error C2653: 'MySQL' : is not a class or namespace name
2>c:\dragonflyff_source\gameserver\players.cpp(387) : error C3861: 'setInt': identifier not found
2>c:\dragonflyff_source\gameserver\players.cpp(392) : error C2653: 'MySQL' : is not a class or namespace name
2>c:\dragonflyff_source\gameserver\players.cpp(392) : error C2661: 'getString' : no overloaded function takes 5 arguments
2>c:\dragonflyff_source\gameserver\players.cpp(394) : error C2653: 'MySQL' : is not a class or namespace name
2>c:\dragonflyff_source\gameserver\players.cpp(394) : error C3861: 'setInt': identifier not found
can't find way to fix it.
-
-
Alpha Member
Re: Found Error from Ban Command codes by BBim
add the include file "MySQLM.h" in the include section. although you need the relative path to the file which is in the common folder i think. check the player.cpp file for an example and use it for the players.cpp file.
-
Member
Re: Found Error from Ban Command codes by BBim
Hehehe... great it works.
2>GameServer - 0 error(s), 4 warning(s)
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========