Trying to make an aka command in mysql but not working
#1

PHP Code:
CMD:aka(playerid,params[])   
{   
    if(
pInfo[playerid][AdminLvl] >= 2)
    {
        new 
minfo[500],pID,ip[16];
        if(
isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /aka [playerid]");
        
pID = strval(params);
        if(!
IsPlayerConnected(pID)) return SendClientMessage(playerid,-1,"Invalid playerid");  
        new 
str[128], Cache:reuslt; 
        
GetPlayerIp(pID, ip, sizeof(ip));
        
mysql_format(gSQL, str, sizeof(str), "SELECT * FROM `Users` WHERE `IP`= %s",ip); 
        
reuslt = mysql_query(gSQL, str, true); 
        new 
count = cache_num_rows(); 
        new 
string[1024];
        if(
count > 0) 
        { 
            new 
i; 
            new 
Id,Name[150],Scores,Ip[16],Reg_Date[24]; 
            for(
i = 0; i < count; i++) 
            { 
                
cache_get_value_int(i, "Id", Id); 
                
cache_get_value_name(i, "Name", Name); 
                
cache_get_value_int(i, "Score", Scores); 
                
cache_get_value_name(i,"IP",Ip);
                
cache_get_value_name(i,"Reg",Reg_Date);
                
format(minfo,sizeof(minfo),"\n%d\t%s\t%d\t%s\t%s",Id,Name,Scores,Ip,Reg_Date);
                
strcat(string, minfo);
            }
            new 
string2[1024];
            
format(string2, sizeof string2, "Id\tName\tScore\tIp\tReg_Date\n%s", string);
            
ShowPlayerDialog(playerid, 123, DIALOG_STYLE_TABLIST_HEADERS," {FFFFFF}-{00FF00}Accounts On Player Ip",string2, "Okay", "Close"); 
        } 
        
cache_delete(reuslt); 
    }
    else
    {
        return -
1;
    }
    return 
1; 
} 
when player id is provide nothing shown
Reply
#2

you gotta use sscanf
Reply
#3

try this ShowPlayerDialog(playerid, 123, DIALOG_STYLE_TABLIST_HEADERS," {FFFFFF}-{00FF00}Accounts On Player Ip",string2, "Okay", "Close"); without MySQL code, I think that your SQL code is right but Dialog is not appearing, probably u exceed a limit of strings in dialog.

also add debugs and provide mysql logs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)