threaded querry problem
#1

well i have a problem with a threaded query
this is my code:
PHP код:
public OnPlayerConnect(playerid)
{
    
TogglePlayerSpectating(playeridtrue);
    new
        
query[128],
        
playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    
mysql_format(sqlquerysizeof(query), "SELECT `Banat` FROM `accounts` WHERE `Name` = '%e' LIMIT 1"playername);
    
mysql_tquery(sqlquery"checkban""i"playerid);
    return 
1;
}
public 
checkban(playerid)
{
    new 
query[250];
    
PlayerInfo[playerid][pBanned] = cache_get_field_content_int(0,"Banat");
    
mysql_format(sqlquerysizeof(query), "SELECT `Password`, `ID` FROM `accounts` WHERE `Name` = '%e' LIMIT 1"GetName(playerid));
    
mysql_tquery(sqlquery"OnAccountCheck""i"playerid);
    return 
1;
}
public 
OnAccountCheck(playerid

    new 
        
rows
        
fields
    
cache_get_data(rowsfieldssql); 
     
    if(
rows
    { 
        
cache_get_field_content(0"Password"PlayerInfo[playerid][Password], sql129);
        
PlayerInfo[playerid][ID] = cache_get_field_content_int(0"ID"); 
        if(
PlayerInfo[playerid][pBanned] =0//////////  line with warning
        
{
            
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_INPUT"Login""Bine ai venit!\nContul a fost gasit in baza de date. Terog introdu parola:""Login""Quit"); 
            
PlayAudioStreamForPlayer(playerid,"http://stream.profm.ro:8012/profm.mp3");
        }
        else
        {
            new 
string[128];
            
format(string,sizeof(string),"Esti banat pe acest server.Fa o cerere unban pe %s",Website);
            
SendClientMessage(playerid,-1,string);
        }
    } 
    else 
    { 
        
PlayAudioStreamForPlayer(playerid,"http://stream.profm.ro:8012/profm.mp3");
        
ShowPlayerDialog(playeridRegisterDialogDIALOG_STYLE_INPUT"Register""Bine ai venit!\nNu exista inca un cont cu acel nume. Introdu o parola pentru a te inregistra:""Register""Quit"); 
    } 
    return 
true

the problem is that i get "Esti banat pe acest server.Fa o cerere unban pe" even if in database the banned row is 0 .
i get only one warning and that's
Код:
 warning 211: possibly unintended assignment
Reply
#2

Код:
if(PlayerInfo[playerid][pBanned] =0)
->
Код:
if(PlayerInfo[playerid][pBanned] == 0)
Reply
#3

if(PlayerInfo[playerid][pBanned] =0)

should be

if(PlayerInfo[playerid][pBanned] == 0)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)