SA-MP Forums Archive
2 Command Problem [+REP] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 2 Command Problem [+REP] (/showthread.php?tid=574369)



2 Command Problem [+REP] - arlindi - 16.05.2015

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


Re: 2 Command Problem [+REP] - [FMJ]PowerSurge - 16.05.2015

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?


Re: 2 Command Problem [+REP] - arlindi - 16.05.2015

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


Re: 2 Command Problem [+REP] - Konstantinos - 16.05.2015

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

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


Re: 2 Command Problem [+REP] - arlindi - 16.05.2015

Soo how can i fix it ?


Re: 2 Command Problem [+REP] - Konstantinos - 16.05.2015

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.


Re: 2 Command Problem [+REP] - arlindi - 16.05.2015

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


Re: 2 Command Problem [+REP] - arlindi - 16.05.2015

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


Re: 2 Command Problem [+REP] - justice96 - 17.05.2015

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


Re: 2 Command Problem [+REP] - arlindi - 17.05.2015

I have try but i cant
Please help me