15.04.2012, 20:44
Hello!
So, today I decided to do the hardware ban system! Anyways, have done everything, but it seems that tinniest and easist part of MySQL/script f*** me up! If you know whats the problem here, please help me!
Here is the code:
And now look at the debug when I use HWBan:
Can somebody help me??
So, today I decided to do the hardware ban system! Anyways, have done everything, but it seems that tinniest and easist part of MySQL/script f*** me up! If you know whats the problem here, please help me!
Here is the code:
pawn Код:
stock HWBan(playerid)
{
new PNAME[MAX_PLAYER_NAME];
GetPlayerName(playerid,PNAME,sizeof(PNAME));
new PlayerIP[20];
new phwid[MAX_PLAYERS];
GetPlayerIp(playerid,PlayerIP,sizeof(PlayerIP));
new hquery[100];
format(hquery, sizeof(hquery), "SELECT * FROM hwuser WHERE name = '%s'", PNAME);
mysql_query(hquery);
mysql_store_result();
while(mysql_fetch_row_format(hquery,"|"))
{
new hwstring[100];
mysql_fetch_field_row(hwstring,"hwid"); phwid[playerid] = strval(hwstring);
}
mysql_free_result();
new hquery2[200];
format(hquery2, sizeof(hquery2), "INSERT INTO hwbans(name, hwid, IP) VALUES('%s', '%s', '%s')", PNAME, phwid[playerid], PlayerIP);
mysql_query(hquery2);
Kick(playerid);
return 1;
}
Код:
[22:44:44] CMySQLHandler::Query(SELECT * FROM hwuser WHERE name = 'fiki574_CRO') - Successfully executed. [22:44:44] >> mysql_store_result( Connection handle: 1 ) [22:44:44] CMySQLHandler::StoreResult() - Result was stored. [22:44:44] >> mysql_fetch_row_format( Connection handle: 1 ) [22:44:44] CMySQLHandler::FetchRow() - Return: fiki574_CRO|00x01054716159|127.0.0.1 [22:44:44] >> mysql_fetch_field_row( Connection handle: 1 ) [22:44:44] CMySQLHandler::FetchField("hwid") - 00x01054716159 //this is number that I need, it is fetched here, but now look down [22:44:44] >> mysql_fetch_row_format( Connection handle: 1 ) [22:44:44] >> mysql_free_result( Connection handle: 1 ) [22:44:44] CMySQLHandler::FreeResult() - Result was successfully free'd. [22:44:44] >> mysql_query( Connection handle: 1 ) [22:44:45] CMySQLHandler::Query(INSERT INTO hwbans(name, hwid, IP) VALUES('fiki574_CRO', 'HWID HERE', '127.0.0.1')) - Successfully executed. //previous number (00x01054716159) should be instead of "HWID HERE" at "VALUES"