Hallo Community,
ich habe gerade mein Autosystem "fertig" umgeschrieben und dabei ein Problem entdeckt. Ich kann mich in das Auto setzen und es zeigt mir auch den Dialog an, aber wenn ich auf Kaufen klicke passiert nichts. Im .log von der MySQL kommt auch kein Error, man sieht aber, dass er etwas abgefragt hat. Hier mal kurz der Abschnitt der File:
[10:56:04] CMySQLHandler::Query(SELECT * FROM pAutos WHERE aOwner='ChaoZz__' AND aCarkey='0') - Successfully executed.
[10:56:04] >> mysql_store_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::StoreResult() - Result was stored.
[10:56:04] >> mysql_num_rows( Connection handle: 1 )
[10:56:04] CMySQLHandler::NumRows() - Returned 0 row(s)
[10:56:04] >> mysql_free_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:56:04] >> mysql_query( Connection handle: 1 )
[10:56:04] CMySQLHandler::Query(SELECT * FROM pAutos WHERE aOwner='ChaoZz__' AND aCarkey='1') - Successfully executed.
[10:56:04] >> mysql_store_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::StoreResult() - Result was stored.
[10:56:04] >> mysql_num_rows( Connection handle: 1 )
[10:56:04] CMySQLHandler::NumRows() - Returned 0 row(s)
[10:56:04] >> mysql_free_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:56:04] >> mysql_query( Connection handle: 1 )
[10:56:04] CMySQLHandler::Query(SELECT * FROM pAutos WHERE aOwner='ChaoZz__' AND aCarkey='2') - Successfully executed.
[10:56:04] >> mysql_store_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::StoreResult() - Result was stored.
[10:56:04] >> mysql_num_rows( Connection handle: 1 )
[10:56:04] CMySQLHandler::NumRows() - Returned 0 row(s)
[10:56:04] >> mysql_free_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:56:04] >> mysql_query( Connection handle: 1 )
[10:56:04] CMySQLHandler::Query(SELECT * FROM pAutos WHERE aOwner='ChaoZz__' AND aCarkey='0') - Successfully executed.
[10:56:04] >> mysql_store_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::StoreResult() - Result was stored.
[10:56:04] >> mysql_num_rows( Connection handle: 1 )
[10:56:04] CMySQLHandler::NumRows() - Returned 0 row(s)
[10:56:04] >> mysql_free_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:56:04] >> mysql_query( Connection handle: 1 )
[10:56:04] CMySQLHandler::Query(SELECT * FROM pAutos WHERE aOwner='ChaoZz__' AND aCarkey='1') - Successfully executed.
[10:56:04] >> mysql_store_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::StoreResult() - Result was stored.
[10:56:04] >> mysql_num_rows( Connection handle: 1 )
[10:56:04] CMySQLHandler::NumRows() - Returned 0 row(s)
[10:56:04] >> mysql_free_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:56:04] >> mysql_query( Connection handle: 1 )
[10:56:04] CMySQLHandler::Query(SELECT * FROM pAutos WHERE aOwner='ChaoZz__' AND aCarkey='2') - Successfully executed.
[10:56:04] >> mysql_store_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::StoreResult() - Result was stored.
[10:56:04] >> mysql_num_rows( Connection handle: 1 )
[10:56:04] CMySQLHandler::NumRows() - Returned 0 row(s)
[10:56:04] >> mysql_free_result( Connection handle: 1 )
[10:56:04] CMySQLHandler::FreeResult() - Result was successfully free'd.
[10:56:07] >> mysql_real_escape_string( Connection handle: 1 )
[10:56:07] CMySQLHandler::EscapeString(ChaoZz__); - Escaped 8 characters to ChaoZz__.
[10:56:07] >> mysql_query( Connection handle: 1 )
Alles anzeigen
Man sieht, dass er die Abfrage 2 mal macht und bei mysql_num_rows 0 raus kommt. Hier mal der Code für die Abfrage:
stock mysql_CheckAuto(CName[],Slot)
{
new Query[128],count;
format(Query, sizeof(Query), "SELECT * FROM pAutos WHERE aOwner='%s' AND aCarkey='%i'", CName,Slot);
mysql_query(Query);
mysql_store_result();
count = mysql_num_rows();
mysql_free_result();
return count;
}
Aber wenn ich auf kaufen klicke passiert gar nichts. Der Code von "OnDialogResponse":
else if(dialogid == DIALOG_AUTOKAUF)
{
if(!response)return RemovePlayerFromVehicle(playerid);
if(response)
{
new vid = GetPlayerVehicleID(playerid);
for(new i = 0; i < sizeof Buycars; i++)
{
if(vid == kaufauto[i])
{
for(new a=0;a < MAX_CARS_PER_PLAYER;a++){
if(mysql_CheckAuto(PlayerName(playerid),a) == 0){
AutoKaufen(playerid,a,i);
RemovePlayerFromVehicle(playerid);
return 1;
}
else continue;
}
}
}
SendClientMessage(playerid,COLOR_GREY," Du besitzt schon die maximale Anzahl an Fahrzeugen!");
}
}
Ich frage mich was ich hier falsch mache Ich hatte schon mehrmals überprüft und nachgedacht, aber nichts gefunden. Es wäre super lieb von euch wenn ihr mir helfen könnten. Einen schönen Sonntag noch
Mit freundlichen Grüßen
Ch4oS