MySQL ban system, not working. -
ben4uka - 21.07.2011
Код:
if(mysql_num_rows() > 0)
{
SendClientMessage(playerid, red, " • ~ _ ~ SAMP-IL Stunts ~ _ ~ •");
SendClientMessage(playerid, yellow, "You are banned from this server.");
format(query, 1024, "SELECT `BannedBy` FROM `users` WHERE `Nick` = '%s'", GetName(playerid));
mysql_query(query);
new string2[256], string3[256];
new buffer[60];
mysql_fetch_field_row(buffer, "BannedBy");
format(string3,256,"%s",buffer);
new buffer2[60];
mysql_fetch_field_row(buffer2, "BannedBy");
format(string2,256,"%s",buffer2);
format(string, 256, "Admin Name: %s. Reason: %s", buffer, buffer2);
SendClientMessage(playerid, red, string);
SendClientMessage(playerid, red, " • ~ _ ~ SAMP-IL Stunts ~ _ ~ •");
Kick(playerid);
}
if banned = 1 it isn't giving me kick..
help?
Re: MySQL ban system, not working. -
MadeMan - 21.07.2011
Show more code.
Re: MySQL ban system, not working. -
ben4uka - 21.07.2011
full code:
Код:
format(query, 1024, "SELECT `Banned` FROM `users` WHERE `Nick` = '%s' OR `Ip` = '%s'", GetName(playerid), GetIPAddress(playerid));
mysql_query(query);
if(mysql_num_rows() > 0)
{
SendClientMessage(playerid, red, " • ~ _ ~ SAMP-IL Stunts ~ _ ~ •");
SendClientMessage(playerid, yellow, "You are banned from this server.");
format(query, 1024, "SELECT `BannedBy` FROM `users` WHERE `Nick` = '%s'", GetName(playerid));
mysql_query(query);
new string2[256], string3[256];
new buffer[60];
mysql_fetch_field_row(buffer, "BannedBy");
format(string3,256,"%s",buffer);
new buffer2[60];
mysql_fetch_field_row(buffer2, "BannedBy");
format(string2,256,"%s",buffer2);
format(string, 256, "Admin Name: %s. Reason: %s", buffer, buffer2);
SendClientMessage(playerid, red, string);
SendClientMessage(playerid, red, " • ~ _ ~ SAMP-IL Stunts ~ _ ~ •");
Kick(playerid);
}
Re: MySQL ban system, not working. -
MadeMan - 21.07.2011
Add mysql_store_result and mysql_free_result
pawn Код:
format(query, 1024, "SELECT `Banned` FROM `users` WHERE `Nick` = '%s' OR `Ip` = '%s'", GetName(playerid), GetIPAddress(playerid));
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() > 0)
{
SendClientMessage(playerid, red, " • ~ _ ~ SAMP-IL Stunts ~ _ ~ •");
SendClientMessage(playerid, yellow, "You are banned from this server.");
mysql_free_result();
format(query, 1024, "SELECT `BannedBy` FROM `users` WHERE `Nick` = '%s'", GetName(playerid));
mysql_query(query);
mysql_store_result();
new string2[256], string3[256];
new buffer[60];
mysql_fetch_field_row(buffer, "BannedBy");
format(string3,256,"%s",buffer);
new buffer2[60];
mysql_fetch_field_row(buffer2, "BannedBy");
format(string2,256,"%s",buffer2);
format(string, 256, "Admin Name: %s. Reason: %s", buffer, buffer2);
SendClientMessage(playerid, red, string);
SendClientMessage(playerid, red, " • ~ _ ~ SAMP-IL Stunts ~ _ ~ •");
Kick(playerid);
mysql_free_result();
}
Re: MySQL ban system, not working. -
ben4uka - 21.07.2011
working, but now if banned = 0 it's still kicking me.
Re: MySQL ban system, not working. -
MadeMan - 22.07.2011
Change this
to
pawn Код:
if(mysql_fetch_int() == 1)
Re: MySQL ban system, not working. -
ben4uka - 22.07.2011
thanks but alredy done with this xD