MySQL R39 - Grabbing bool data
#1

Hello everyone, I am experiencing a problem with the cache_get_row_int function within the MySQL R39-3 plugin..

I am trying to get a piece of data from my database that will be set to either 0 or 1, So I am using a bool variable for it.. however when i try to set the bool within enum, it comes back with tag mismatch, what is wrong with it?

Код:
../Modules/SQL_Functions.pwn(103) : warning 213: tag mismatch
Код:
enum Account_Data
{
	bool:Tutorial
}
new AccountData[MAX_PLAYERS][Account_Data];
Код:
AccountData[playerid][Tutorial] = cache_get_row_int(0, 6); //Error on this line.
Reply
#2

Tag mismatch means the type of variables are diferent... You're trying to give a int to a bool, either you remove "bool:" from the tutorial or you make something like:

pawn Код:
AccountData[playerid][Tutorial] = cache_get_row_int(0, 6) == 1 ? true : false;
Reply
#3

Or easily
Код:
AccountData[playerid][Tutorial] = !!cache_get_row_int(0, 6);
Reply
#4

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
Or easily
Код:
AccountData[playerid][Tutorial] = !!cache_get_row_int(0, 6);
Using this now, it works. Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)