16.04.2012, 18:45
I don't understand what exactly your system is trying to do. It will get the "hwid" of all resulting players, but only uses the last one of them? If I understand you correctly and it looks like you only use ONE field, not any others, you can optimize and simplify your querying process a lot.
There's no need to use the player's hwid array. But I just didn't because I don't know if you have that created as a proper array. I hope this helps you at least a little.
pawn Код:
format(hquery, sizeof(hquery), "SELECT hwid FROM hwuser WHERE name = '%s'", PNAME);
mysql_query(hquery);
mysql_store_result();
// If you're not 100% sure about results, also include a mysql_num_rows check
new hw_id[15]; // change to a higher value if the ids are longer in some case
mysql_fetch_row(hw_id);
mysql_free_result();
// now REUSE the previous hquery string, no need for a new one!
format(hquery, sizeof(hquery), "INSERT INTO hwbans(name, hwid, IP) VALUES('%s', '%s', '%s')", PNAME, hw_id, PlayerIP);
mysql_query(hquery);
Kick(playerid);