Carsystem MySQL

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • besitzer = 0 in der Datenbank sieht irgendwie falsch aus, meinst du nicht? :D


    Da ist wohl beim Speichern oder der ID Zuweisung was schief gelaufen...

    ast2ufdyxkb1.png


    Leute, lernt scripten und versucht mal lieber etwas selber zu schreiben, als es aus einem GF zu kopieren. :S

  • Da musst du den Fehler suchen.


    Entweder bei der Zuweisung oder bei der Speicherung...printe es halt mal oder zeig uns mal deinen MySQL Log.


    (Den aktivierst du indem du unter OnGameModeInit mysql_log(ALL); eingibst)

    ast2ufdyxkb1.png


    Leute, lernt scripten und versucht mal lieber etwas selber zu schreiben, als es aus einem GF zu kopieren. :S

  • Ich weiß nicht ob das dass richtige ist der mysql log:


    [23:02:57] [DEBUG] mysql_close(1)

    [23:02:57] [DEBUG] CHandleManager::Destroy(this=0x72b280, handle=0x739f68)

    [23:02:57] [DEBUG] CHandle::~CHandle(this=0x739f68)

    [23:02:57] [DEBUG] CConnection::~CConnection(this=0x72c208, connection=0x701130)

    [23:02:57] [DEBUG] CThreadedConnection::~CThreadedConnection(this=0xa19020, connection=0xa19020)

    [23:02:57] [DEBUG] CThreadedConnection::WorkerFunc(this=0xa19020, connection=0xa19020) - shutting down

    [23:02:57] [DEBUG] CConnection::~CConnection(this=0xa19020, connection=0x7644b0)

    [23:02:57] [DEBUG] CConnectionPool::~CConnectionPool(this=0x72c5c8)

    [23:02:57] [DEBUG] CThreadedConnection::~CThreadedConnection(this=0x382f020, connection=0x382f020)

    [23:02:57] [DEBUG] CThreadedConnection::WorkerFunc(this=0x382f020, connection=0x382f020) - shutting down

    [23:02:57] [DEBUG] CConnection::~CConnection(this=0x382f020, connection=0x740ca0)

    [23:02:57] [DEBUG] CThreadedConnection::~CThreadedConnection(this=0x39c2020, connection=0x39c2020)

    [23:02:57] [DEBUG] CThreadedConnection::WorkerFunc(this=0x39c2020, connection=0x39c2020) - shutting down

    [23:02:57] [DEBUG] CConnection::~CConnection(this=0x39c2020, connection=0x74d518)

    [23:02:57] [DEBUG] mysql_close: return value: '1'

    [23:03:09] [INFO] changed log level from 'debug, info, warning, error' to 'debug, info, warning, error'

    [23:03:09] [DEBUG] mysql_connect("127.0.0.1", "root", "*****", "samp_db", 0)

    [23:03:09] [DEBUG] CHandleManager::Create(this=0x72b280, host='127.0.0.1', user='root', pass='****', db='samp_db', options=0x7203a8)

    [23:03:09] [INFO] Creating new connection handle...

    [23:03:09] [WARNING] mysql_connect: no password specified

    [23:03:09] [DEBUG] CConnection::CConnection(this=0x72c488, host='127.0.0.1', user='root', passw='****', db='samp_db', options=0x7203a8)

    [23:03:09] [DEBUG] CConnection::CConnection - new connection = 0x74e0d0

    [23:03:09] [DEBUG] CConnection::CConnection(this=0xa12020, host='127.0.0.1', user='root', passw='****', db='samp_db', options=0x7203a8)

    [23:03:09] [DEBUG] CConnection::CConnection - new connection = 0x74c578

    [23:03:09] [DEBUG] CThreadedConnection::WorkerFunc(this=0xa12020, connection=0xa12020)

    [23:03:09] [DEBUG] CThreadedConnection::CThreadedConnection(this=0xa12020, connection=0xa12020)

    [23:03:09] [DEBUG] CConnectionPool::CConnectionPool(size=2, this=0x72bf08)

    [23:03:09] [DEBUG] CConnection::CConnection(this=0x382e020, host='127.0.0.1', user='root', passw='****', db='samp_db', options=0x7203a8)

    [23:03:09] [DEBUG] CConnection::CConnection - new connection = 0x74c960

    [23:03:09] [DEBUG] CThreadedConnection::WorkerFunc(this=0x382e020, connection=0x382e020)

    [23:03:09] [DEBUG] CThreadedConnection::CThreadedConnection(this=0x382e020, connection=0x382e020)

    [23:03:09] [DEBUG] CConnection::CConnection(this=0x39b2020, host='127.0.0.1', user='root', passw='****', db='samp_db', options=0x7203a8)

    [23:03:09] [DEBUG] CConnection::CConnection - new connection = 0x74d130

    [23:03:09] [DEBUG] CThreadedConnection::WorkerFunc(this=0x39b2020, connection=0x39b2020)

    [23:03:09] [DEBUG] CThreadedConnection::CThreadedConnection(this=0x39b2020, connection=0x39b2020)

    [23:03:09] [INFO] Connection handle with id '1' successfully created.

    [23:03:09] [DEBUG] CHandleManager::Create - new handle = 0x739da8

    [23:03:09] [DEBUG] mysql_connect: return value: '1'

    [23:03:09] [DEBUG] mysql_errno(1)

    [23:03:09] [DEBUG] CHandle::GetErrorId(this=0x739da8)

    [23:03:09] [DEBUG] CConnection::GetError(this=0x72c488, connection=0x74e0d0)

    [23:03:09] [DEBUG] CHandle::GetErrorId - return value: true, error id: '0', error msg: ''

    [23:03:09] [DEBUG] mysql_errno: return value: '0'

    [23:03:09] [DEBUG] mysql_format(1, 0x02B8E654, 128, "SELECT id FROM users WHERE name = '%e'")

    [23:03:09] [DEBUG] CHandle::EscapeString(this=0x739da8, src='Dustin_West')

    [23:03:09] [DEBUG] CConnection::EscapeString(src='Dustin_West', this=0x72c488, connection=0x74e0d0)

    [23:03:09] [DEBUG] CHandle::EscapeString - return value: true, escaped string: 'Dustin_West'

    [23:03:09] [DEBUG] mysql_format: return value: '47'

    [23:03:09] [DEBUG] mysql_pquery(1, "SELECT id FROM users WHERE name = 'Dustin_West'", "OnUserCheck", "d")

    [23:03:09] [DEBUG] CCallback::Create(amx=0x29ba860, name='OnUserCheck', format='d', params=0x2b8e63c, param_offset=5)

    [23:03:09] [DEBUG] CCallback::Create - callback index for 'OnUserCheck': 33

    [23:03:09] [DEBUG] processing specifier 'd' with parameter index 0

    [23:03:09] [DEBUG] retrieved and pushed value '0'

    [23:03:09] [INFO] Callback 'OnUserCheck' set up for delayed execution.

    [23:03:09] [DEBUG] created delayed callback with 1 parameter

    [23:03:09] [DEBUG] CHandle::Execute(this=0x739da8, type=2, query=0x739a58)

    [23:03:09] [DEBUG] CConnectionPool::Queue(query=0x739a58, this=0x72bf08)

    [23:03:09] [DEBUG] CHandle::Execute - return value: true

    [23:03:09] [DEBUG] mysql_pquery: return value: '1'

    [23:03:09] [DEBUG] CConnection::Execute(query=0x739a58, this=0x382e020, connection=0x74c960)

    [23:03:09] [DEBUG] CQuery::Execute(this=0x739a58, connection=0x74c960)

    [23:03:09] [INFO] query "SELECT id FROM users WHERE name = 'Dustin_West'" successfully executed within 0.385 milliseconds

    [23:03:09] [DEBUG] CResultSet::Create(connection=0x74c960, query_str='SELECT id FROM users WHERE name = 'Dustin_West'')

    [23:03:09] [DEBUG] created new resultset '0x7405c8'

    [23:03:09] [DEBUG] fetched MySQL result '0x7014a0'

    [23:03:09] [DEBUG] allocated 20 bytes for PAWN result

    [23:03:09] [DEBUG] CCallback::Execute(amx=0x29ba860, index=33, num_params=1)

    [23:03:09] [INFO] Executing callback 'OnUserCheck' with 1 parameter...

    [23:03:09] [DEBUG] processing internal specifier 'c'

    [23:03:09] [DEBUG] pushed value '0' onto AMX stack

    [23:03:09] [DEBUG] executing AMX callback with index '33'

    [23:03:09] [DEBUG] cache_get_row_count(0x02B8E854)

    [23:03:09] [DEBUG] cache_get_row_count: return value: '1'

    [23:03:09] [DEBUG] AMX callback executed with error '0'

    [23:03:09] [INFO] Callback successfully executed.

    [23:03:11] [DEBUG] mysql_format(1, 0x02B8E448, 256, "SELECT * FROM users WHERE name = '%e' AND password = MD5('%e')")

    [23:03:11] [DEBUG] CHandle::EscapeString(this=0x739da8, src='Dustin_West')

    [23:03:11] [DEBUG] CConnection::EscapeString(src='Dustin_West', this=0x72c488, connection=0x74e0d0)

    [23:03:11] [DEBUG] CHandle::EscapeString - return value: true, escaped string: 'Dustin_West'

    [23:03:11] [DEBUG] CHandle::EscapeString(this=0x739da8, src='Dustin')

    [23:03:11] [DEBUG] CConnection::EscapeString(src='Dustin', this=0x72c488, connection=0x74e0d0)

    [23:03:11] [DEBUG] CHandle::EscapeString - return value: true, escaped string: 'Dustin'

    [23:03:11] [DEBUG] mysql_format: return value: '75'

    [23:03:11] [DEBUG] mysql_pquery(1, "SELECT * FROM users WHERE name = 'Dustin_West' AND password = MD5('Dustin')", "OnUserLogin", "d")

    [23:03:11] [DEBUG] CCallback::Create(amx=0x29ba860, name='OnUserLogin', format='d', params=0x2b8e430, param_offset=5)

    [23:03:11] [DEBUG] CCallback::Create - callback index for 'OnUserLogin': 34

    [23:03:11] [DEBUG] processing specifier 'd' with parameter index 0

    [23:03:11] [DEBUG] retrieved and pushed value '0'

    [23:03:11] [INFO] Callback 'OnUserLogin' set up for delayed execution.

    [23:03:11] [DEBUG] created delayed callback with 1 parameter

    [23:03:11] [DEBUG] CHandle::Execute(this=0x739da8, type=2, query=0x738d48)

    [23:03:11] [DEBUG] CConnectionPool::Queue(query=0x738d48, this=0x72bf08)

    [23:03:11] [DEBUG] CHandle::Execute - return value: true

    [23:03:11] [DEBUG] mysql_pquery: return value: '1'

    [23:03:11] [DEBUG] CConnection::Execute(query=0x738d48, this=0x39b2020, connection=0x74d130)

    [23:03:11] [DEBUG] CQuery::Execute(this=0x738d48, connection=0x74d130)

    [23:03:11] [INFO] query "SELECT * FROM users WHERE name = 'Dustin_West' AND password = MD5('Dustin')" successfully executed within 0.313 milliseconds

    [23:03:11] [DEBUG] CResultSet::Create(connection=0x74d130, query_str='SELECT * FROM users WHERE name = 'Dustin_West' AND password = MD5('Dustin')')

    [23:03:11] [DEBUG] created new resultset '0x7354e0'

    [23:03:11] [DEBUG] fetched MySQL result '0x7333b8'

    [23:03:11] [DEBUG] allocated 124 bytes for PAWN result

    [23:03:11] [DEBUG] CCallback::Execute(amx=0x29ba860, index=34, num_params=1)

    [23:03:11] [INFO] Executing callback 'OnUserLogin' with 1 parameter...

    [23:03:11] [DEBUG] processing internal specifier 'c'

    [23:03:11] [DEBUG] pushed value '0' onto AMX stack

    [23:03:11] [DEBUG] executing AMX callback with index '34'

    [23:03:11] [DEBUG] cache_get_row_count(0x02B8E854)

    [23:03:11] [DEBUG] cache_get_row_count: return value: '1'

    [23:03:11] [DEBUG] cache_get_value_name_int(0, "id", 0x02B4C410)

    [23:03:11] [DEBUG] cache_get_value_name_int: assigned value: '1'

    [23:03:11] [DEBUG] cache_get_value_name_int: return value: '1'

    [23:03:11] [DEBUG] cache_get_value_name_int(0, "level", 0x02B4C478)

    [23:03:11] [DEBUG] cache_get_value_name_int: assigned value: '20'

    [23:03:11] [DEBUG] cache_get_value_name_int: return value: '1'

    [23:03:11] [DEBUG] cache_get_value_name_int(0, "money", 0x02B4C48C)

    [23:03:11] [DEBUG] cache_get_value_name_int: assigned value: '30000'

    [23:03:11] [DEBUG] cache_get_value_name_int: return value: '1'

    [23:03:11] [DEBUG] cache_get_value_name_int(0, "kills", 0x02B4C490)

    [23:03:11] [DEBUG] cache_get_value_name_int: assigned value: '0'

    [23:03:11] [DEBUG] cache_get_value_name_int: return value: '1'

    [23:03:11] [DEBUG] cache_get_value_name_int(0, "deaths", 0x02B4C498)

    [23:03:11] [DEBUG] cache_get_value_name_int: assigned value: '0'

    [23:03:11] [DEBUG] cache_get_value_name_int: return value: '1'

    [23:03:11] [DEBUG] cache_get_value_name_int(0, "adminlevel", 0x02B4C47C)

    [23:03:11] [DEBUG] cache_get_value_name_int: assigned value: '3'

    [23:03:11] [DEBUG] cache_get_value_name_int: return value: '1'

    [23:03:11] [DEBUG] cache_get_value_name_int(0, "fraktion", 0x02B4C480)

    [23:03:11] [DEBUG] cache_get_value_name_int: assigned value: '0'

    [23:03:11] [DEBUG] cache_get_value_name_int: return value: '1'

    [23:03:11] [DEBUG] cache_get_value_name_int(0, "rang", 0x02B4C484)

    [23:03:11] [DEBUG] cache_get_value_name_int: assigned value: '6'

    [23:03:11] [DEBUG] cache_get_value_name_int: return value: '1'

    [23:03:11] [DEBUG] cache_get_value_name_int(0, "spawnchange", 0x02B4C488)

    [23:03:11] [DEBUG] cache_get_value_name_int: assigned value: '0'

    [23:03:11] [DEBUG] cache_get_value_name_int: return value: '1'

    [23:03:11] [DEBUG] mysql_format(1, 0x02B8E524, 200, "SELECT * FROM autos WHERE besitzer=%d")

    [23:03:11] [DEBUG] mysql_format: return value: '36'

    [23:03:11] [DEBUG] mysql_tquery(1, "SELECT * FROM autos WHERE besitzer=1", "OnPlayerCarsLoad", "i")

    [23:03:11] [DEBUG] CCallback::Create(amx=0x29ba860, name='OnPlayerCarsLoad', format='i', params=0x2b8e50c, param_offset=5)

    [23:03:11] [DEBUG] CCallback::Create - callback index for 'OnPlayerCarsLoad': 5

    [23:03:11] [DEBUG] processing specifier 'i' with parameter index 0

    [23:03:11] [DEBUG] retrieved and pushed value '0'

    [23:03:11] [INFO] Callback 'OnPlayerCarsLoad' set up for delayed execution.

    [23:03:11] [DEBUG] created delayed callback with 1 parameter

    [23:03:11] [DEBUG] CHandle::Execute(this=0x739da8, type=1, query=0x739338)

    [23:03:11] [DEBUG] CHandle::Execute - return value: true

    [23:03:11] [DEBUG] mysql_tquery: return value: '1'

    [23:03:11] [DEBUG] CConnection::Execute(query=0x739338, this=0xa12020, connection=0x74c578)

    [23:03:11] [DEBUG] CQuery::Execute(this=0x739338, connection=0x74c578)

    [23:03:11] [DEBUG] AMX callback executed with error '0'

    [23:03:11] [INFO] Callback successfully executed.

    [23:03:11] [INFO] query "SELECT * FROM autos WHERE besitzer=1" successfully executed within 0.274 milliseconds

    [23:03:11] [DEBUG] CResultSet::Create(connection=0x74c578, query_str='SELECT * FROM autos WHERE besitzer=1')

    [23:03:11] [DEBUG] created new resultset '0x74c1d8'

    [23:03:11] [DEBUG] fetched MySQL result '0x7180e0'

    [23:03:11] [DEBUG] allocated 0 bytes for PAWN result

    [23:03:11] [DEBUG] CCallback::Execute(amx=0x29ba860, index=5, num_params=1)

    [23:03:11] [INFO] Executing callback 'OnPlayerCarsLoad' with 1 parameter...

    [23:03:11] [DEBUG] processing internal specifier 'c'

    [23:03:11] [DEBUG] pushed value '0' onto AMX stack

    [23:03:11] [DEBUG] executing AMX callback with index '5'

    [23:03:11] [DEBUG] cache_get_row_count(0x02B8E854)

    [23:03:11] [DEBUG] cache_get_row_count: return value: '1'

    [23:03:11] [DEBUG] AMX callback executed with error '0'

    [23:03:11] [INFO] Callback successfully executed.

    1. Bitte nutze kein MD5 beim Passwort, da kannst du es eig schon gleich bleiben lassen...Zudem steht dein Passwort jetzt hier in Klartext...(Hash Verfahren genauer erklärt)
    2. Das Select query ist nun richtig, aber ich sehe kein Insert query. Lösche nochmal die Sachen aus der Tabelle und mache das von Neu.
    3. Lösche jetzt die Log Datei, damit sie gleich frisch erstellt wird.


    Zeige dann nochmal den Log.

    ast2ufdyxkb1.png


    Leute, lernt scripten und versucht mal lieber etwas selber zu schreiben, als es aus einem GF zu kopieren. :S

  • Kaliber


    Was soll ich den als Verschlüsselung nutzen hab das halt von Jeffry genommen :D und wie würde ich das denn jetzt noch ändern (ist es einfach und fix oder recht schwer)?



    Zitat

    Das Select query ist nun richtig, aber ich sehe kein Insert query. Lösche nochmal die Sachen aus der Tabelle und mache das von Neu.

    Was genau soll ich jetzt in der Tabelle aus der DB löschen (die beiden Fahrzeuge)?

  • https://forum.sa-mp.com/showthread.php?t=453544

    Du willst mich kennenlernen? Kauf mein Buch, Bia*ch!


  • Was soll ich den als Verschlüsselung nutzen hab das halt von Jeffry genommen :D und wie würde ich das denn jetzt noch ändern (ist es einfach und fix oder recht schwer)?

    1. Ist das keine Verschlüsselung, lies dir meinen Beitrag (den ich doch eben verlinkt habe) dazu mal durch.


    2. Jeffry solltest das Tutorial mal in dieser Hinsicht updaten, das wirklich keine gute Idee, das so zu gestalten.


    Was genau soll ich jetzt in der Tabelle aus der DB löschen (die beiden Fahrzeuge)?

    Exakt.

    ast2ufdyxkb1.png


    Leute, lernt scripten und versucht mal lieber etwas selber zu schreiben, als es aus einem GF zu kopieren. :S

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Habe beide Fahrzeuge aus der Datenbank gelöscht, Habe den MySQL log gecleart, habe den Server gestartet habe den Befehl /createcar [playerid] [vID] eingegeben daraufhin habe ich mich ausgeloggt erneut eingeloggt Fahrzeug stand dort, habe einen gmx gemacht Fahrzeug weg :(



    Einmal editiert, zuletzt von seegras () aus folgendem Grund: Logfile in code-Tag gesetzt

  • Ja, weil besitzer immernoch auf 0 ist.


    Da wird der falsche Wert genommen.


    Wie setzt du denn von PlayerInfo die db_id?


    Beim laden dieser id machst du irgendwas falsch...

    ast2ufdyxkb1.png


    Leute, lernt scripten und versucht mal lieber etwas selber zu schreiben, als es aus einem GF zu kopieren. :S

  • Kann es sein das du das meinst?



    Einmal editiert, zuletzt von seegras () aus folgendem Grund: PAWN Highlighting aktiviert

  • Naja, da scheint ja alles richtig zu sein, da ist der Wert ja auf 1.


    Wie rufst du denn saveCar auf?


    Das wäre mal interessant, in welchem Kontext die Funktion aufgerufen wird.

    ast2ufdyxkb1.png


    Leute, lernt scripten und versucht mal lieber etwas selber zu schreiben, als es aus einem GF zu kopieren. :S

  • Kaliber

    Einmal editiert, zuletzt von seegras () aus folgendem Grund: PAWN Highlighting aktiviert

  • Hab ne Vermutung was die db_id betrifft:


    Wird hier geladen


    Aber nicht hier.


  • Aber nicht hier.

    loadPlayerCars ruft OnPlayerCarsLoad auf.


    RaPTiiC ersetzt mal das durch deine loadPlayerCars funktion.


    Code
    loadPlayerCars(playerid)
    {
        new query[128];    
        mysql_format(handle, query, sizeof(query), "SELECT * FROM autos WHERE besitzer = '%i'", PlayerInfo[playerid][p_id]);
        mysql_pquery(handle, query, "OnPlayerCarsLoad", "i", playerid);
        return 1;
    }

    Du willst mich kennenlernen? Kauf mein Buch, Bia*ch!