13.05.2013, 19:00
(
Последний раз редактировалось jordy.kiesebrink; 15.05.2013 в 12:02.
)
Dear Dan...
I'm working on a server with your SQL plugin but I have a problem with getting rows from the database.
It always return 0 rows but there are rows in the databse for sure. I updates them with a command and used the QUERY_THREADED function for it.
Could you help me solving my bug?, This is my current function which is checking if a player is muted.
then on my function I created to check if a player is loaded succesfully I call the function to check if the player is muted
So in the database the value from user_muted is setted to 1 with the command :mute and the pMuted also to 1. then onplayertext it is checking if the pMuted status is 1 and then it rejects the ability to talk:
so when a player quits his pMute will be resetted so the playerid wont be stored to prevent bugs with a new player who is using that id:
but his user_muted is still on 1 so now when he is loaded it needs to call the function checkmuted and thats working fine but it wont get any rows as confirmed in my log
![](http://www.plaatjesdump.nl/upload/e8bd87a568c122de270c754ff7c1a93a.png)
so.. Could u help me fixing my problem with getting rows from my database. becouse this is offcurse not the only function what it getting rows..![Cheesy](images/smilies/biggrin.png)
Thanks in Advance
Kind regarts, Jordy
I'm working on a server with your SQL plugin but I have a problem with getting rows from the database.
It always return 0 rows but there are rows in the databse for sure. I updates them with a command and used the QUERY_THREADED function for it.
Could you help me solving my bug?, This is my current function which is checking if a player is muted.
pawn Код:
forward CheckMuted(playerid);
public CheckMuted(playerid) {
new query[250];
format(query, sizeof(query), "SELECT user_name FROM users WHERE user_id = '%d' AND user_muted = '1'", playersInfo[playerid][pID]);
new Result:Muted = mysql_query(mysql, query, QUERY_THREADED);
new rows = mysql_num_rows(Muted);
printf("[mysql] Mute Query %d %s %d.", playersInfo[playerid][pID], playersInfo[playerid][pUsername], rows);
if(rows == 1) {
playersInfo[playerid][pMute] = 1;
return 1;
} else {
return 0;
}
}
pawn Код:
CheckMuted(playerid);
pawn Код:
public OnPlayerText(playerid, text[]) {
if(playersInfo[playerid][pMute] != 1) {
new string[2000];
format(string, sizeof(string), "{FFFFFF}(%i) %s", playerid, text); /* with player ID in chat */
SendPlayerMessageToAll(playerid, string);
} else {
SendClientMessage(playerid, COLOR_RED, "(Error!) You are muted, You are not allowed to talk");
}
return 0;
}
pawn Код:
playersInfo[playerid][pMute] = 0;
Код:
[13/05/2013 18:45:15] [mysql] Mute Query 5 Jordy2 0.
![](http://www.plaatjesdump.nl/upload/e8bd87a568c122de270c754ff7c1a93a.png)
so.. Could u help me fixing my problem with getting rows from my database. becouse this is offcurse not the only function what it getting rows..
![Cheesy](images/smilies/biggrin.png)
Thanks in Advance
Kind regarts, Jordy