Little issue with a command
#1

Well, i was trying to make an AKA (Also known as) command, i used the script's variables and everything, also compiled without any error, but when i test it, i get Player Doesn't exist what did i do wrong?

PHP код:
COMMAND:aka(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
        new 
otherIDplayersIP[10], playername[500][30], query[100];
        if(
playerData[playerid][playerLevel] >= 4)
        {
            if(
sscanf(params"u"otherID))
            {
                
SendClientMessage(playeridCOLOR_ORANGE"Usage:\"aka <playername/id>\"");
            }
            else
            {
                if(
IsPlayerConnected(otherID))
                {
                    if(
playerData[otherID][playerLoggedIn])
                    {
                        
GetPlayerIp(otherIDplayersIPsizeof(playersIP));
                        
format(querysizeof(query), "SELECT playerName FROM playerdata  WHERE playerIP`='%s' ORDER BY `playerName asc"playersIP);    
                        
mysql_query(query);
                        
mysql_store_result();
                        new 
i=0;
                        new 
num=mysql_num_rows();
                        new 
row[20];
                        if(
mysql_num_rows())
                        {    
                            
mysql_fetch_row(row"|"connection);
                            
explode(rowplayername"|");
                            for(
i=1i<numi++)
                            {
                                
mysql_fetch_row(playername[i], "playerName");    
                            }
                            
SendClientMessage(playeridCOLOR_WHITE"{00ffff}--------------------------------------------");
                            new 
msg[100];    
                            
format(msgsizeof(msg),"Player register with the ip:{B7B7B7}%s"playersIP);
                            
SendClientMessage(playeridCOLOR_WHITEmsg);        
                            for(new 
j=0j<numj++)
                            {
                                new 
report[100];
                                
format(reportsizeof(report), "%s"playername[j]);
                                
SendClientMessage(playeridCOLOR_WHITEreport);
                            }
                            
SendClientMessage(playeridCOLOR_WHITE,"{00ffff}--------------------------------------------");
                        }    
                        else
                        {
                            
SendClientMessage(playeridCOLOR_WHITE"{B7B7B7}[SERVER] {FFFFFF}That player doesn't exist.");
                        }
                        
mysql_free_result();
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_WHITE"{B7B7B7}[SERVER] {FFFFFF}That player doesn't logged in.");
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_WHITE"{B7B7B7}[SERVER] {FFFFFF}That player isn't connected.");
                }
            }
    
        }
        else
        {
             return 
0;
        }
    }
    return 
1;

Reply
#2

problem is here.
PHP код:
                        GetPlayerIp(otherIDplayersIPsizeof(playersIP)); 
                        
format(querysizeof(query), "SELECT playerName FROM playerdata  WHERE playerIP`='%s' ORDER BY `playerName asc"playersIP);     
                        
mysql_query(query); 
                        
mysql_store_result(); 
                        new 
i=0
                        new 
num=mysql_num_rows(); 
                        new 
row[20]; 
                        if(
mysql_num_rows()) 
and probably in here format(query, sizeof(query), "SELECT playerName FROM playerdata WHERE playerIP`='%s' ORDER BY `playerName asc", playersIP);
check the mysql logs, if there's no such kind of error/warning than use this function
format(query, sizeof(query), "SELECT playerName FROM playerdata WHERE `playerIP`= '%s' ORDER BY playerName asc", playersIP);
Reply
#3

Quote:
Originally Posted by Mugala
Посмотреть сообщение
problem is here.
PHP код:
                        GetPlayerIp(otherIDplayersIPsizeof(playersIP)); 
                        
format(querysizeof(query), "SELECT playerName FROM playerdata  WHERE playerIP`='%s' ORDER BY `playerName asc"playersIP);     
                        
mysql_query(query); 
                        
mysql_store_result(); 
                        new 
i=0
                        new 
num=mysql_num_rows(); 
                        new 
row[20]; 
                        if(
mysql_num_rows()) 
and probably in here format(query, sizeof(query), "SELECT playerName FROM playerdata WHERE playerIP`='%s' ORDER BY `playerName asc", playersIP);
check the mysql logs, if there's no such kind of error/warning than use this function
format(query, sizeof(query), "SELECT playerName FROM playerdata WHERE `playerIP`= '%s' ORDER BY playerName asc", playersIP);
Thanks appreciated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)