Tag mismatch, Cached variables [MySQL]
#1

Hey guys, I'm trying to make an offline admin removal CMD, and I wan't to verify if the account exists and the account admin level is lower than the command performer

This is the warning:
PHP код:
D:\MySQL\gamemodes\ALRP.pwn(27442) : warning 213: tag mismatch 
This is the CMD:
PHP код:
CMD:oremoveadmin(playerid, params[])
{
    new 
playerb[32], string[128], query[248], Cache:result;
       if(!
IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
    if(
PlayerInfo[playerid][pAdmin] < 7) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(
sscanf(params, "s[32]s[128]", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /oremoveadmin [playername] [confirm]");
    if(
RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /makeadmin instead.");
    
mysql_format(mysql, query, sizeof(query), "SELECT `Admin` FROM `users` WHERE `Name` = '%e' LIMIT 1", playerb);
    
result = mysql_tquery(mysql, query);
    if(
cache_get_row_count(mysql))
    {
        new 
adminlevel;
        
adminlevel = cache_get_row_int(0, 0, mysql);
        if(
PlayerInfo[playerid][pAdmin] < adminlevel) return SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
         
mysql_format(mysql, query, sizeof(query), "UPDATE `users` SET `Admin`='0', `AdminAccount`='0' WHERE `Name`='%e' LIMIT 1", playerb);
         
mysql_tquery(mysql, query);
    }
    else return 
SendClientMessage(playerid, COLOR_GREY, "Player name not found");
    
cache_delete(result);
    
format(string, sizeof(string), "AdmWarn: %s has been offline removed from the Administrators team by %s", playerb, RPN(playerid));
    
SendAdminMessage(COLOR_DARKRED, 1, string);
    return 
1;
} 
This is the line:
PHP код:
result = mysql_tquery(mysql, query); 
Note: It's my first time using cached variables instead of callback, Let me know if you have any tips

Thanks.
Reply
#2

To use this mode you must use mysql_query, not mysql_tquery.
Reply
#3

Quote:
Originally Posted by aoEXE
Посмотреть сообщение
To use this mode you must use mysql_query, not mysql_tquery.
Works, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)