Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

MySQL - Threaded queries not being called?

$
0
0
Hello there,

I started scripted a register/ login system from scratch using MySQL R41-2. This is the first time that I've done MySQL based work from scratch and with least to none help from others. However, I've a few problems with some queries and thought of creating a thread, even after I don't like to create one :p

Problem: Query not being called?
Status: UNSOLVED
Code:
OnPlayerConnect
PHP Code:

    new query[95];
    
mysql_format(gSQLquerysizeof query"SELECT * FROM `Bans` WHERE `Name` = %e OR `IP` = %e LIMIT 1"pName(playerid), IP);
    
mysql_tquery(gSQLquery"OnBanCheck""i"playerid); 

OnBanCheck
PHP Code:

forward OnBanCheck(playerid);
public 
OnBanCheck(playerid)
{
    if(
cache_num_rows() >= 1)
    {
        new 
By[MAX_PLAYER_NAME], Reason[50], Name[MAX_PLAYER_NAME], str[130], IDExpireDate;
        
cache_get_value_int(0"ID"ID);
        
cache_get_value_int(0"ExpireDate"ExpireDate);
        
cache_get_value_name(0"BanBy"By);
        
cache_get_value_name(0"Name"Name);
        
cache_get_value_name(0"Reason"Reason);
        
format(strsizeof str"* Account name: %s | Ban ID: %d | Expire date: %s | Banned by: %s"NameID, (ExpireDate == 0) ? ("Permanent") : (ReturnDate(ExpireDate)), By);
        
SendClientMessage(playeridCOLOR_REDstr);
        if(
ExpireDate >= && ExpireDate gettime())
        {
            new 
query[65], IP[16];
            
cache_get_value_name(0"IP"IP);
            
SendClientMessage(playeridCOLOR_RED"* Your account is now unbanned.");
            
mysql_format(gSQLquerysizeof query"REMOVE * FROM `Bans` WHERE `Name` = %e OR `IP` = %e"pName(playerid), IP);
            
mysql_tquery(gSQLquery);
        }
    }
    else
    {
    new 
query[65];
    
mysql_format(gSQLquerysizeof query"SELECT * FROM `Users` WHERE `Name`= %e LIMIT 1"pName(playerid));
    
mysql_tquery(gSQLquery"OnAccountCheck""d"playerid);
    }
    return 
1;


+ My Sublime Text 3 doesn't show the 'updated' natives from includes such as MySQL r41 and Streamer 2.9+.

Thanks.

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>