2 Command Problem [+REP]
#1

PHP Code:
CMD:unban(playeridparams[])
{
    if(
pInfo[playerid][pLogged] == 1)
    {
        if(
pInfo[playerid][pAdminLevel] >= 2)
        {
            new 
Query[256],bname[24],rowsfields;
            if (
sscanf(params,"s[24]",bname)) return SendClientMessage(playerid,-1,""chat" /unban [name]"); // use sscanf not strlen
            
mysql_format(mysql,Querysizeof(Query), "SELECT `Name` FROM `banlog` WHERE Name = '%e' AND pAccountLock = 1 LIMIT 1"bname);
            
mysql_tquery(mysqlQuery,"","");
            
cache_get_data(rowsfieldsmysql);
            if(!
rows)
            {
                new 
string[200];
                
format(stringsizeof(string), ""chat" Nobody under the name of %s is banned!"bname);
                return 
SendClientMessage(playerid,-1,string);
            }
            else
            {
                
mysql_format(mysql,Querysizeof(Query), "UPDATE `banlog` SET `pAccountLock` = 0 WHERE Name = '%s'"bname);
                
mysql_tquery(mysqlQuery,"","");
                new 
string[200];
                
format(stringsizeof(string), ""chat" %s has been unbanned!"bname);
                
SendClientMessage(playerid0x66FF33string);
            }
        }
    }
    return 
1;

This say everytime Nobody under the .....................................


PHP Code:
CMD:searchip(playeridparams[])
{
    if(
pInfo[playerid][pLogged] != 1) return 0;
    new 
ip[16],rowsfields;
    if(
sscanf(params"s[16]"ip)) return SendClientMessage(playerid, -1""chat" /searchip [IP]");
    new 
query[70], string[75];
    
mysql_format(mysql,querysizeof(query), "SELECT `Username` FROM `users` WHERE `pIP`='%s'"ip); // READ NOTE
    
mysql_tquery(mysqlquery);
    
cache_get_data(rowsfieldsmysql);
    if(!
rows)
    {
        
format(stringsizeof(string), ""chat" Nobody account founded with %s IP!"ip);
        
SendClientMessage(playerid, -1string);
        return 
1;
    }
    else
    {
        
format(stringsizeof(string), ""chat" Names found with %s IP. :"ip);
        
SendClientMessage(playerid, -1string);
        new 
count 1foundname[MAX_PLAYER_NAME];
        while(
cache_get_row_count())
        {
            
cache_get_field_content(0"Username",foundname);
            
strmid(foundnamequery0strlen(query)); // READ NOTE
            
format(stringsizeof(string), ""chat" %d: %s"countfoundname);
            
SendClientMessage(playerid, -1string);
            
count count 1;
        }
    }
    return 
1;

This say nobody account foundet with this ip


Thanks
Reply
#2

For the first one, you have
Code:
WHERE Name = '%e' AND pAccountLock
Not sure if the %e is intentional here.

Do you have any SQL logs?
Reply
#3

It got worked when the system was MySQL R5
After Change to R39
Didnt worked
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=337810

That's not how threaded queries work. Read the tutorial above and try updating the commands.
Reply
#5

Soo how can i fix it ?
Reply
#6

As I said, read the tutorial so you can understand how threaded queries work and then you'll be able to modify your commands and also do more stuff.

By ignoring it completely and waiting for a ready-code, you will not learn. Sure I can help you after trying and you still can't get it working but atleast give it a try.
Reply
#7

I tryed but i didnt understand PLease help mee
Tell me where is problem i am try to understand what is wrong
Reply
#8

Wait for someone to give mee the answer i cant fix it
Reply
#9

As what Konstantinos told you before, look at the above link for tutorial. Try to recreate both commands. also I learned cache & orm from here: https://sampforum.blast.hk/showthread.php?tid=337810
Reply
#10

I have try but i cant
Please help me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)