MySQL R39 - Grabbing bool data - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL R39 - Grabbing bool data (
/showthread.php?tid=582183)
MySQL R39 - Grabbing bool data -
MotherDucker - 18.07.2015
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.
Re: MySQL R39 - Grabbing bool data -
Kimossab - 18.07.2015
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;
Re: MySQL R39 - Grabbing bool data -
Evocator - 18.07.2015
Or easily
Код:
AccountData[playerid][Tutorial] = !!cache_get_row_int(0, 6);
Re: MySQL R39 - Grabbing bool data -
MotherDucker - 18.07.2015
Quote:
Originally Posted by Ralfie
Or easily
Код:
AccountData[playerid][Tutorial] = !!cache_get_row_int(0, 6);
|
Using this now, it works. Thanks.