2 Command Problem [+REP] -
arlindi - 16.05.2015
PHP Code:
CMD:unban(playerid, params[])
{
if(pInfo[playerid][pLogged] == 1)
{
if(pInfo[playerid][pAdminLevel] >= 2)
{
new Query[256],bname[24],rows, fields;
if (sscanf(params,"s[24]",bname)) return SendClientMessage(playerid,-1,""chat" /unban [name]"); // use sscanf not strlen
mysql_format(mysql,Query, sizeof(Query), "SELECT `Name` FROM `banlog` WHERE Name = '%e' AND pAccountLock = 1 LIMIT 1", bname);
mysql_tquery(mysql, Query,"","");
cache_get_data(rows, fields, mysql);
if(!rows)
{
new string[200];
format(string, sizeof(string), ""chat" Nobody under the name of %s is banned!", bname);
return SendClientMessage(playerid,-1,string);
}
else
{
mysql_format(mysql,Query, sizeof(Query), "UPDATE `banlog` SET `pAccountLock` = 0 WHERE Name = '%s'", bname);
mysql_tquery(mysql, Query,"","");
new string[200];
format(string, sizeof(string), ""chat" %s has been unbanned!", bname);
SendClientMessage(playerid, 0x66FF33, string);
}
}
}
return 1;
}
This say everytime Nobody under the .....................................
PHP Code:
CMD:searchip(playerid, params[])
{
if(pInfo[playerid][pLogged] != 1) return 0;
new ip[16],rows, fields;
if(sscanf(params, "s[16]", ip)) return SendClientMessage(playerid, -1, ""chat" /searchip [IP]");
new query[70], string[75];
mysql_format(mysql,query, sizeof(query), "SELECT `Username` FROM `users` WHERE `pIP`='%s'", ip); // READ NOTE
mysql_tquery(mysql, query);
cache_get_data(rows, fields, mysql);
if(!rows)
{
format(string, sizeof(string), ""chat" Nobody account founded with %s IP!", ip);
SendClientMessage(playerid, -1, string);
return 1;
}
else
{
format(string, sizeof(string), ""chat" Names found with %s IP. :", ip);
SendClientMessage(playerid, -1, string);
new count = 1, foundname[MAX_PLAYER_NAME];
while(cache_get_row_count())
{
cache_get_field_content(0, "Username",foundname);
strmid(foundname, query, 0, strlen(query)); // READ NOTE
format(string, sizeof(string), ""chat" %d: %s", count, foundname);
SendClientMessage(playerid, -1, string);
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