Weil ich mein Script auch versuchen möchte mit ein UCP zu verbinden aber kp wie ich da alle daten in die Tabelle einfügen muss
Beiträge von Markuslobicher
-
-
Guten Tag
Meine Frage ist:
Das Register/Login-System wenn es über mysql geschrieben ist wie kann man es machen das 2Tabellen genutzt werden?
Ich meine das z.B. so:Username und Passwort
Dann die Andere Tabelle
Userstats von den Spielern.Level,Adminlevel und so
-
-
@m4a_X wenn du bitte mal ordentlich lesen würdest wüsstest du alles
-
Guten Morgen
@Jeffry (wenn du zeit hast)
Ich bin grade am überlegen soll ich den Personalausweis per Dialog machen lassen das die Spieler ihre Daten da eintragen können oder wie bei allen anderen Server,
man geht in die Stadthalle und kauft sich ein Personalausweis und alle Daten stehen dann im Chat/Textdreaw.Ich würde es gerne so machen das man den Personalausweis über mehre Dialoge hinweg seine Daten Eintragen muss.
Desweiteren wenn man den Perso auf ruft das man es in ein Textdreaw ist oder Dialog (was wäre hier am Sinnvollsten?Da ich mit Textdreaws noch nicht gearbeitet habe wird es glaube ich mir schwerfallen.
Bin für gute antworten sehr dankbar.
PS:
Wer jetzt meinen zu müssen und sagen zu wollen "Geh mal auf Google.de der kann direkt sich aus den Beitrag raushalten. -
Ich möchte es ja so haben das die Passworter verschlüsselt sind
So habe ich es jetzt:
Pawncode:Code: Login/Register
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort='%s'",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '%s', '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
MYSQL-Log beim Registerieren:
SQL: Mysql-Log Registrieren
Alles anzeigen[00:22:14] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [00:22:14] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [00:22:14] [DEBUG] CMySQLConnection::Connect - connection was successful [00:22:14] [DEBUG] CMySQLConnection::Connect - connection was successful [00:22:14] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [00:22:14] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [00:22:14] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [00:22:14] [DEBUG] CMySQLConnection::Connect - connection was successful [00:22:14] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [00:23:14] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='Testspieler' ", callback: "OnUserCheck", format: "i" [00:23:14] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [00:23:14] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.291 milliseconds [00:23:14] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:23:14] [DEBUG] Calling callback "OnUserCheck".. [00:23:14] [DEBUG] cache_get_data - connection: 1 [00:23:14] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [00:23:24] [DEBUG] mysql_escape_string - source: "spieler", connection: 1, max_len: 35 [00:23:24] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO user (username, passwort, level) VALUES ('Testspiele", callback: "(null)", format: "d" [00:23:24] [DEBUG] CMySQLQuery::Execute[] - starting query execution [00:23:24] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 4.213 milliseconds [00:23:24] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [00:23:28] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [00:23:28] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [00:23:28] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.72 milliseconds [00:23:28] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:23:28] [DEBUG] Calling callback "OnPlayerCarsLoad".. [00:23:28] [DEBUG] cache_get_data - connection: 1 [00:23:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [00:23:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [00:23:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [00:23:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [00:23:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [00:23:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [00:23:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [00:23:28] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
Neuer einlogg:
Code: Neuer einlogg
Alles anzeigen[00:26:03] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='Testspieler' ", callback: "OnUserCheck", format: "i" [00:26:03] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [00:26:03] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.278 milliseconds [00:26:03] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:26:03] [DEBUG] Calling callback "OnUserCheck".. [00:26:03] [DEBUG] cache_get_data - connection: 1 [00:26:03] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [00:26:10] [DEBUG] mysql_escape_string - source: "spieler", connection: 1, max_len: 35 [00:26:10] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM user WHERE username='Testspieler' AND passwort='sp", callback: "OnPasswordResponse", format: "i" [00:26:10] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - starting query execution [00:26:10] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - query was successfully executed within 0.317 milliseconds [00:26:10] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:26:10] [DEBUG] Calling callback "OnPasswordResponse".. [00:26:10] [DEBUG] cache_get_data - connection: 1 [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "52" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "level", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "level", data: "1" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "money", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "money", data: "0" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "alevel", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "alevel", data: "7" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "fraktion", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "fraktion", data: "0" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "rang", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "rang", data: "0" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "spawnchange", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "spawnchange", data: "0" [00:26:10] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='52'", callback: "OnPlayerCarsLoad", format: "i" [00:26:10] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [00:26:10] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [00:26:10] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.460 milliseconds [00:26:10] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:26:10] [DEBUG] Calling callback "OnPlayerCarsLoad".. [00:26:10] [DEBUG] cache_get_data - connection: 1 [00:26:10] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [00:26:27] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO autos(besitzer,model,x,y,z,r) VALUES('52','411','346", callback: "carSavedToDB", format: "i" [00:26:27] [DEBUG] CMySQLQuery::Execute[carSavedToDB] - starting query execution [00:26:27] [DEBUG] CMySQLQuery::Execute[carSavedToDB] - query was successfully executed within 1.806 milliseconds [00:26:27] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:26:27] [DEBUG] Calling callback "carSavedToDB".. [00:26:27] [DEBUG] cache_insert_id - connection: 1 [00:26:27] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
-
So habe es nun so gemacht wie du @Jeffry
So sieht alles nun aus:
Dennoch kann ich mich nicht einloggen mit dem Passwort
Login/Register:
Code
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort=MD5('%s')",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '%s', '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
Mysql-log:(Beim Registrieren):
Code
Alles anzeigen[22:43:02] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:43:02] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:43:02] [DEBUG] CMySQLConnection::Connect - connection was successful [22:43:02] [DEBUG] CMySQLConnection::Connect - connection was successful [22:43:02] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:43:02] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:43:02] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:43:02] [DEBUG] CMySQLConnection::Connect - connection was successful [22:43:02] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:44:40] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:44:40] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:44:40] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.259 milliseconds [22:44:40] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:44:40] [DEBUG] Calling callback "OnUserCheck".. [22:44:40] [DEBUG] cache_get_data - connection: 1 [22:44:40] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:44:48] [DEBUG] mysql_escape_string - source: "test123", connection: 1, max_len: 35 [22:44:48] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO user (username, passwort, level) VALUES ('test', 'te", callback: "(null)", format: "d" [22:44:48] [DEBUG] CMySQLQuery::Execute[] - starting query execution [22:44:48] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.721 milliseconds [22:44:48] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [22:44:54] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [22:44:54] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [22:44:54] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.65 milliseconds [22:44:54] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:44:54] [DEBUG] Calling callback "OnPlayerCarsLoad".. [22:44:54] [DEBUG] cache_get_data - connection: 1 [22:44:54] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [22:44:54] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [22:44:54] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [22:44:54] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [22:44:54] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [22:44:54] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [22:44:54] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [22:44:54] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
Beim erneuten Login:Code
Alles anzeigen[22:46:22] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:46:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:46:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.318 milliseconds [22:46:22] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:46:22] [DEBUG] Calling callback "OnUserCheck".. [22:46:22] [DEBUG] cache_get_data - connection: 1 [22:46:22] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:46:32] [DEBUG] mysql_escape_string - source: "test123", connection: 1, max_len: 35 [22:46:32] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM user WHERE username='test' AND passwort=MD5('test1", callback: "OnPasswordResponse", format: "i" [22:46:32] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - starting query execution [22:46:32] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - query was successfully executed within 0.278 milliseconds [22:46:32] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:46:32] [DEBUG] Calling callback "OnPasswordResponse".. [22:46:32] [DEBUG] cache_get_data - connection: 1 [22:46:32] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
-
So habe es so gemacht wie du es gesagt hast @Jeffry
Passwort wird nicht in der MySqL Tabelle abgespeichert Password. Nach dem man sich Registriert hat.
Mysql-Log:
SQL
Alles anzeigen[22:21:51] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:21:51] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:21:51] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:21:51] [DEBUG] CMySQLConnection::Connect - connection was successful [22:21:51] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:21:51] [DEBUG] CMySQLConnection::Connect - connection was successful [22:21:51] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:21:51] [DEBUG] CMySQLConnection::Connect - connection was successful [22:21:51] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:22:22] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:22:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:22:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.540 milliseconds [22:22:22] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:22:22] [DEBUG] Calling callback "OnUserCheck".. [22:22:22] [DEBUG] cache_get_data - connection: 1 [22:22:22] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:22:30] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO user (username, passwort, level) VALUES ('test', '',", callback: "(null)", format: "d" [22:22:30] [DEBUG] CMySQLQuery::Execute[] - starting query execution [22:22:30] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 1.181 milliseconds [22:22:30] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [22:22:37] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [22:22:37] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [22:22:37] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.68 milliseconds [22:22:37] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:22:37] [DEBUG] Calling callback "OnPlayerCarsLoad".. [22:22:37] [DEBUG] cache_get_data - connection: 1 [22:22:37] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [22:22:37] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [22:22:37] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [22:22:37] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [22:22:37] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [22:22:37] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [22:22:37] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [22:22:37] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:23:22] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:23:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:23:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.373 milliseconds [22:23:22] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:23:22] [DEBUG] Calling callback "OnUserCheck".. [22:23:22] [DEBUG] cache_get_data - connection: 1 [22:23:22] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:23:28] [DEBUG] mysql_escape_string - source: "tst123", connection: 1, max_len: 35 [22:23:28] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM user WHERE username='test' AND passwort=MD5('tst12", callback: "OnPasswordResponse", format: "i" [22:23:28] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - starting query execution [22:23:28] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - query was successfully executed within 0.681 milliseconds [22:23:28] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:23:28] [DEBUG] Calling callback "OnPasswordResponse".. [22:23:28] [DEBUG] cache_get_data - connection: 1 [22:23:28] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:23:30] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE user SET level='1',money='0',alevel='0',fraktion='0',rang", callback: "(null)", format: "(null)" [22:23:30] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [22:23:30] [DEBUG] CMySQLQuery::Execute[] - starting query execution [22:23:30] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.378 milliseconds [22:23:30] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [22:23:30] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [22:23:30] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.62 milliseconds [22:23:30] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:23:30] [DEBUG] Calling callback "OnPlayerCarsLoad".. [22:23:30] [DEBUG] cache_get_data - connection: 1 [22:23:30] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [22:23:30] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [22:23:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [22:23:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [22:23:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [22:23:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [22:23:30] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [22:23:30] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
Login/Register:
Code
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort=MD5('%s')",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '%s', '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
-
@Jeffry
So sieht mein Code AusLogin/Register:
Code
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response && strlen(inputtext) > 0) { new name[MAX_PLAYER_NAME],query[256],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort='%s'",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', MD5('%s'), '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
MYSQL-Log beim Registrieren:Code
Alles anzeigen[22:04:41] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:04:41] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:04:41] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:04:41] [DEBUG] CMySQLConnection::Connect - connection was successful [22:04:41] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:04:41] [DEBUG] CMySQLConnection::Connect - connection was successful [22:04:41] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:04:41] [DEBUG] CMySQLConnection::Connect - connection was successful [22:04:41] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:05:13] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:05:13] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:05:13] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.319 milliseconds [22:05:13] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:05:13] [DEBUG] Calling callback "OnUserCheck".. [22:05:13] [DEBUG] cache_get_data - connection: 1 [22:05:13] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:05:20] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO user (username, passwort, level) VALUES ('test', MD5", callback: "(null)", format: "d" [22:05:20] [DEBUG] CMySQLQuery::Execute[] - starting query execution [22:05:20] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.704 milliseconds [22:05:20] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [22:05:28] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [22:05:28] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [22:05:28] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.85 milliseconds [22:05:28] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:05:28] [DEBUG] Calling callback "OnPlayerCarsLoad".. [22:05:28] [DEBUG] cache_get_data - connection: 1 [22:05:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [22:05:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [22:05:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [22:05:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [22:05:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [22:05:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [22:05:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [22:05:28] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
Loginprozess nach dem erneuten verbiden:
SQL
Alles anzeigen[22:07:54] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:07:54] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:07:54] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.226 milliseconds [22:07:54] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:07:54] [DEBUG] Calling callback "OnUserCheck".. [22:07:54] [DEBUG] cache_get_data - connection: 1 [22:07:54] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:08:01] [DEBUG] mysql_escape_string - source: "test123", connection: 1, max_len: 35 [22:08:01] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM user WHERE username='test' AND passwort='test123'", callback: "OnPasswordResponse", format: "i" [22:08:01] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - starting query execution [22:08:01] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - query was successfully executed within 0.626 milliseconds [22:08:01] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:08:01] [DEBUG] Calling callback "OnPasswordResponse".. [22:08:01] [DEBUG] cache_get_data - connection: 1 [22:08:01] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:08:12] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE user SET level='1',money='0',alevel='0',fraktion='0',rang", callback: "(null)", format: "(null)" [22:08:12] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [22:08:12] [DEBUG] CMySQLQuery::Execute[] - starting query execution [22:08:12] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.206 milliseconds [22:08:12] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [22:08:12] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [22:08:12] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.36 milliseconds [22:08:12] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:08:12] [DEBUG] Calling callback "OnPlayerCarsLoad".. [22:08:12] [DEBUG] cache_get_data - connection: 1 [22:08:12] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [22:08:12] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [22:08:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [22:08:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [22:08:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [22:08:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [22:08:12] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [22:08:12] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
-
Um Objecte mit Texturen zu versehen musst du wie folgt vor gehen.
Tutorial extra nur für dich:
Du startest dein SAMP-Map-Construckton (Sry für mein Englisch)
Dann drückst du auf Lode Colison dann auf die Fläche in der Mitte.Danach gehst du zu den Ort wo du es haben willst hin.
Rechts hast du ein Menü mit Views , Objecte, Movement
Drücke da nun auf Objecte damit du eine Liste aller Skins/Objekte und Autos von GTA San Andreas bekommst.
Wenn du dich für ein Objekt entschieden hast fügst zu de deiner liste hinzu.Das Object steht jetzt auf dem Flugplatz von Area52
Du fügst nun das Objekt unter OnGameModeInit ein mit:
CreateObject(19429, 314.76596, 1870.47668, 18.55236, 0.00000, 0.00000, 0.00000);Oder damit es Dynamisch ist:
CreateDynamicObject(19429, 314.76596, 1870.47668, 18.55236, 0.00000, 0.00000, 0.00000);Damit wäre nun ein Objekt erstellt worden.
Damit das Objekt nun eine Textur bekommt gehst du auf
https://textures.xyin.ws/?page=textures
Da suchst du deine Textur aus und fügst folgendes ebenfalls unter OnGameModeInit:
SetObjectMaterial(CreateObject(19429, 314.76596, 1870.47668, 18.55236, 0.00000, 0.00000, 0.00000), 0, 8419, "vgsbldng1", "black32", 0xFFFFFFFF);
So mit hast du das erstellte Objekt mit einer Schwarzen Textur versehen.
Wenn du RemoveBuildingForPlayer hast musst du es unter OnPlayerConnect packen so das es für alle Spieler die auf dein Server Kommen verschwunden ist
-
Habe es jetzt so:
Code
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response && strlen(inputtext) > 0) { new name[MAX_PLAYER_NAME],query[256],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '%s', '1')",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
-
@Jeffry und @German_ScripterHD
So oder?
Code
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response && strlen(inputtext) > 0) { new name[MAX_PLAYER_NAME],query[256],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES '%s'",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) '%s'",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
-
Guten Abend
Ich gebe nun mal hier meine Bewertung ab.
Folgendes:
Script: 0/10 Weil es ein GF-Edit ist
Forum: 1/10 Nur wegen das Design
TS3: 0/10 Weil die Rechte nicht mal eingestellt sind.InfoText:
Der Server ist nicht mal in der Lage mit Kritik um zu gehen,
Serverleiter Techno will einfach nicht die Wahrheit ein sehen das der Server nichts wird
Die haben kein richtigen Scripter
Bannen Leute nur wegen ihre Meinung.Daher sage ich nicht drauf gehen
-
Code
Alles anzeigenif(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', MD5('%s'), '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
was genau muss ich vom Register weg machen?
-
Sieht bis jetzt so alles aus:
Datenbank:
MYSQL-LOGdatei: Da ist auch von Autos mit drin
SQL
Alles anzeigen[09:11:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [09:11:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [09:11:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [09:11:31] [DEBUG] CMySQLConnection::Connect - connection was successful [09:11:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [09:11:31] [DEBUG] CMySQLConnection::Connect - connection was successful [09:11:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [09:11:31] [DEBUG] CMySQLConnection::Connect - connection was successful [09:11:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [09:12:02] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='X_CROXX_X' ", callback: "OnUserCheck", format: "i" [09:12:02] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [09:12:02] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.424 milliseconds [09:12:02] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [09:12:02] [DEBUG] Calling callback "OnUserCheck".. [09:12:02] [DEBUG] cache_get_data - connection: 1 [09:12:02] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [09:12:14] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO user (username, passwort, level) VALUES ('X_CROXX_X'", callback: "(null)", format: "d" [09:12:14] [DEBUG] CMySQLQuery::Execute[] - starting query execution [09:12:14] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.789 milliseconds [09:12:14] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [09:12:19] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [09:12:19] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [09:12:19] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.245 milliseconds [09:12:19] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [09:12:19] [DEBUG] Calling callback "OnPlayerCarsLoad".. [09:12:19] [DEBUG] cache_get_data - connection: 1 [09:12:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [09:12:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [09:12:19] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [09:12:19] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [09:12:19] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [09:12:19] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [09:12:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [09:12:19] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [09:13:08] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='X_CROXX_X' ", callback: "OnUserCheck", format: "i" [09:13:08] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [09:13:08] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.234 milliseconds [09:13:08] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [09:13:08] [DEBUG] Calling callback "OnUserCheck".. [09:13:08] [DEBUG] cache_get_data - connection: 1 [09:13:08] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [09:13:16] [DEBUG] mysql_escape_string - source: "klom19pom", connection: 1, max_len: 35 [09:13:16] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM user WHERE username='X_CROXX_X' AND passwort=MD5('", callback: "OnPasswordResponse", format: "i" [09:13:16] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - starting query execution [09:13:16] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - query was successfully executed within 0.812 milliseconds [09:13:16] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [09:13:16] [DEBUG] Calling callback "OnPasswordResponse".. [09:13:16] [DEBUG] cache_get_data - connection: 1 [09:13:16] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [09:13:27] [DEBUG] mysql_close - connection: 1 [09:13:27] [DEBUG] CMySQLConnection::Disconnect - connection was closed [09:13:27] [DEBUG] CMySQLConnection::Disconnect - connection was closed [09:13:27] [DEBUG] CMySQLConnection::Disconnect - connection was closed [09:13:27] [WARNING] CMySQLConnection::Disconnect - no connection available [09:13:27] [DEBUG] CMySQLConnection::Disconnect - connection was closed [09:13:27] [DEBUG] CMySQLHandle::~CMySQLHandle - deconstructor called [16:23:26] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [16:23:26] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [16:23:26] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [16:23:26] [DEBUG] CMySQLConnection::Connect - connection was successful [16:23:26] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [16:23:26] [DEBUG] CMySQLConnection::Connect - connection was successful [16:23:26] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [16:23:26] [DEBUG] CMySQLConnection::Connect - connection was successful [16:23:26] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [16:24:25] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='Test' ", callback: "OnUserCheck", format: "i" [16:24:25] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [16:24:25] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.364 milliseconds [16:24:25] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [16:24:25] [DEBUG] Calling callback "OnUserCheck".. [16:24:25] [DEBUG] cache_get_data - connection: 1 [16:24:25] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [16:24:40] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO user (username, passwort, level) VALUES ('Test', MD5", callback: "(null)", format: "d" [16:24:40] [DEBUG] CMySQLQuery::Execute[] - starting query execution [16:24:40] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.808 milliseconds [16:24:40] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [16:24:50] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [16:24:50] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [16:24:50] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.95 milliseconds [16:24:50] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [16:24:50] [DEBUG] Calling callback "OnPlayerCarsLoad".. [16:24:50] [DEBUG] cache_get_data - connection: 1 [16:24:50] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [16:24:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [16:24:50] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [16:24:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [16:24:50] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [16:24:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [16:24:50] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [16:24:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [16:24:50] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [16:24:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [16:24:50] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [16:24:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [16:24:50] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [16:24:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [16:24:50] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [16:33:30] [DEBUG] mysql_close - connection: 1 [16:33:30] [DEBUG] CMySQLConnection::Disconnect - connection was closed [16:33:30] [DEBUG] CMySQLConnection::Disconnect - connection was closed [16:33:30] [DEBUG] CMySQLConnection::Disconnect - connection was closed [16:33:30] [DEBUG] CMySQLConnection::Disconnect - connection was closed [16:33:30] [WARNING] CMySQLConnection::Disconnect - no connection available [16:33:30] [DEBUG] CMySQLHandle::~CMySQLHandle - deconstructor called
Nach dem Neueinloggen:MYSQL-Log nach dem Neueinloggen:
SQL
Alles anzeigen[16:35:57] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='Test' ", callback: "OnUserCheck", format: "i" [16:35:57] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [16:35:57] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.334 milliseconds [16:35:57] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [16:35:57] [DEBUG] Calling callback "OnUserCheck".. [16:35:57] [DEBUG] cache_get_data - connection: 1 [16:35:57] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [16:36:05] [DEBUG] mysql_escape_string - source: "test123", connection: 1, max_len: 35 [16:36:05] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM user WHERE username='Test' AND passwort=MD5('test1", callback: "OnPasswordResponse", format: "i" [16:36:05] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - starting query execution [16:36:05] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - query was successfully executed within 0.238 milliseconds [16:36:05] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [16:36:05] [DEBUG] Calling callback "OnPasswordResponse".. [16:36:05] [DEBUG] cache_get_data - connection: 1 [16:36:05] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [16:36:12] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [16:36:12] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [16:36:12] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.72 milliseconds [16:36:12] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [16:36:12] [DEBUG] Calling callback "OnPlayerCarsLoad".. [16:36:12] [DEBUG] cache_get_data - connection: 1 [16:36:12] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [16:36:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [16:36:12] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [16:36:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [16:36:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [16:36:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [16:36:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [16:36:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [16:36:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [16:36:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [16:36:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [16:36:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [16:36:12] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [16:36:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [16:36:12] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
-
@Jeffry hast du den fehler wegen Login und laden der Spieler gefunden?
Weil ich habe den fehler immer noch nicht gefunden. Aus der MYSQL log werde ich zurzeit auch nicht schlau -
So wollte mir den Server anschauen aber werde im Tutorial immer gebannt
-
@Jeffry Habe ein neuen Fehler/Warung bekommen im Script
Und zwar wird mir die Funktion die ich mir gemacht habe mit SetPlayerMoney als warnung ausgebeben.
Scriptcode:
Forwoard:
Codeforward OnUserCheck(playerid); forward OnPasswordResponse(playerid); forward OnPlayerRegister(playerid);
Register/Login Dialog definiert:
Enum:
Codeenum playerInfo{ eingeloggt, level, db_id, alevel, fraktion, rang, spawnchange } new sInfo[MAX_PLAYERS][playerInfo];
MYSQL:Code//mysql: #define db_host "localhost" #define db_user "Root" #define db_pass "" #define db_db "MEINE DB" new dbhandle;
OnGameModeInit:Code//mysql verbindung: dbhandle = mysql_connect(db_host,db_user,db_db,db_pass); print("Mysql wurde verbunden!"); mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
OnGameModeExit: Der Timmer ist für was anderes!
OnUserCheck:
Code
Alles anzeigenpublic OnUserCheck(playerid) { new num_rows,num_fields; cache_get_data(num_rows,num_fields,dbhandle); if(num_rows==0) { //Register ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Registrieren","Abbrechen"); } else { //Login ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Anmelden","Gebe bitte dein Passwort ein.","Anmleden","Abbrechen"); } return 1; }
OnPlayerRegister:
OnPlayerConnect Mit Spieler Speichern und Spieler Laden:
Code
Alles anzeigenpublic OnPlayerConnect(playerid) { if(IsPlayerNPC(playerid)) return 1; new nachricht[128]; format(nachricht,sizeof(nachricht),"Du bist mit der ID %i verbunden.",playerid); SendClientMessage(playerid,rot,nachricht); //Login/Register: new name[MAX_PLAYER_NAME],query[128]; GetPlayerName(playerid,name,sizeof(name)); format(query,sizeof(query),"SELECT id FROM user WHERE username='%s' ",name); mysql_function_query(dbhandle,query,true,"OnUserCheck","i",playerid); SendClientMessage(playerid,grün,"Willkommen auf Reallife Version 0.4! Wir wünschen euch ein angenehmen Spiel spaß bei uns!"); //textdraws anzeigen: TextDrawShowForPlayer(playerid,Text:uhrzeitLabel); TextDrawShowForAll(Jahr); SetPlayerColor(playerid,weiß); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); return 1; } savePlayer(playerid) { if(sInfo[playerid][eingeloggt]==0)return 1; //Speichern level,money new query[256]; format(query,sizeof(query),"UPDATE user SET level='%i',money='%i',alevel='%i',fraktion='%i',rang='%i',spawnchange='%i' WHERE id='%i'",sInfo[playerid][level],GetPlayerMoney(playerid),sInfo[playerid][alevel],sInfo[playerid][fraktion],sInfo[playerid][rang],sInfo[playerid][spawnchange],sInfo[playerid][db_id]); mysql_function_query(dbhandle,query,false,"",""); return 1; } resetPlayer(playerid) { for(new i=0; i<sizeof(sInfo[]); i++) { sInfo[playerid][playerInfo:i]=0; } return 1; }
OnPlayerDisconnect:
Code
Alles anzeigenpublic OnPlayerDisconnect(playerid, reason) { for(new i=0; i<sizeof(aInfo); i++) { if(aInfo[i][id_x]==0)continue; if(aInfo[i][besitzer]!=sInfo[playerid][db_id])continue; GetVehiclePos(aInfo[i][id_x],aInfo[i][c_x],aInfo[i][c_y],aInfo[i][c_z]); GetVehicleZAngle(aInfo[i][id_x],aInfo[i][c_r]); new query[156]; format(query,sizeof(query),"UPDATE user SET level='%i',money='%i',alevel='%i',fraktion='%i',rang='%i' WHERE id='%i'",sInfo[playerid][level], GetPlayerMoney(playerid),sInfo[playerid][alevel],sInfo[playerid][fraktion],sInfo[playerid][rang],sInfo,sInfo[playerid][db_id]); mysql_function_query(dbhandle,query,false,"",""); DestroyVehicle(aInfo[i][id_x]); aInfo[i][id_x]=0; break; } savePlayer(playerid); resetPlayer(playerid); loadPlayerCars(playerid); return 1; }
getPlayerName: [Ich weiß es nicht ob es dazu gehört]:
CodegetPlayerName(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); return name; }
OnPasswordResponse:
Code
Alles anzeigenpublic OnPasswordResponse(playerid) { new num_rows,num_fields; cache_get_data(num_rows,num_fields,dbhandle); if(num_rows > 0) { //passwort Richtig sInfo[playerid][eingeloggt] = 1; sInfo[playerid][db_id] = cache_get_field_content_int(0,"id",dbhandle); sInfo[playerid][level] = cache_get_field_content_int(0,"level",dbhandle); SetPlayerScore(playerid,sInfo[playerid][level]); GivePlayerMoney(playerid,cache_get_field_content_int(0,"money",dbhandle)); sInfo[playerid][alevel] = cache_get_field_content_int(0,"alevel",dbhandle); sInfo[playerid][fraktion] = cache_get_field_content_int(0,"fraktion",dbhandle); sInfo[playerid][rang] = cache_get_field_content_int(0,"rang",dbhandle); sInfo[playerid][spawnchange] = cache_get_field_content_int(0,"spawnchange",dbhandle); loadPlayerCars(playerid); } else { //Passwort Falsch SendClientMessage(playerid,grün,"Du hast dein Passwort falsch eingetippt. Versuche es nochmal!"); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } return 1; }
OnDialogResponse: [Es sind alle Dialoge von mir drin]
Code
Alles anzeigenpublic OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid==DIALOG_AUTOHAUS) { if(response) { //Autoverkauf new id=GetPVarInt(playerid,"buyCarID"); if(GetPlayerMoney(playerid)<ahCars[id][c_preis]) { SendClientMessage(playerid,gelb,"Du besitzt nicht das benötige Geld für das Fahrzeug"); RemovePlayerFromVehicle(playerid); } GivePlayerMoney(playerid,-ahCars[id][c_preis]); createPlayerCar(playerid,ahCars[id][model],ahInfo[ahCars[id][ah_id]][v_x],ahInfo[ahCars[id][ah_id]][v_y],ahInfo[ahCars[id][ah_id]][v_z],ahInfo[ahCars[id][ah_id]][v_r]); SendClientMessage(playerid,grün,"Sie haben sich erfolgreich ein Fahrzeug gekauft."); RemovePlayerFromVehicle(playerid); } else { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,türkis,"Du hast den Kaufvorgang abgebrochen."); } return 1; } if(dialogid==DIALOG_LOGIN) { if(response && strlen(inputtext) > 0) { new name[MAX_PLAYER_NAME],query[256],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort=MD5('%s')",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', MD5('%s'), '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_TELEPORT) { if(response) { if(listitem==0) { //Autohaus SetPlayerPos(playerid,2502.1106,1706.7172,10.8203); SetPlayerFacingAngle(playerid,95.2747); } if(listitem==1) { //Busstation SetPlayerPos(playerid,1106.0049,-1704.5876,13.2741); SetPlayerFacingAngle(playerid,93.3103); } if(listitem==2) { //Newsstand SetPlayerPos(playerid,1495.5072,-1724.6783,13.5469); SetPlayerFacingAngle(playerid,166.0998); } if(listitem==3) { //LSHBF SetPlayerPos(playerid,1770.9800,-1939.0044,13.5608); SetPlayerFacingAngle(playerid,190.7019); } } else { SendClientMessage(playerid,rot,"Vorgang abgebrochen."); } } if(dialogid== DIALOG_Autosystem) { if(response) { if(listitem==0) { if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,rot,"Sie sind nicht im Fahrzeug"); //motorfunktion if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER) { SendClientMessage(playerid,blau,"Sie sind nicht der Fahrer dieses Fahrzeuges"); } new vID=GetPlayerVehicleID(playerid), motor, licht, alarm, tueren, bonnet, boot, objective; //Motor an/ausschalten: GetVehicleParamsEx(vID,motor,licht,alarm,tueren,bonnet,boot,objective); if(motor==1) motor = 0; else motor = 1; SetVehicleParamsEx(vID,motor,licht,alarm,tueren,bonnet,boot,objective); SendClientMessage(playerid,blau,"Sie haben den Motor Ihres Fahrzeuges angeschlaten/ausgeschalten!"); } } if(listitem==1) { if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,rot,"Sie sind nicht im Fahrzeug"); if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER) return SendClientMessage(playerid,blau,"Sie befinden sich nicht in Ihr Fahrzeug"); new vID=GetPlayerVehicleID(playerid), motor, licht, alarm, tueren, bonnet, boot, objective; //licht an/ausschalten: GetVehicleParamsEx(vID,motor,licht,alarm,tueren,bonnet,boot,objective); if(licht==1){ licht = 0; } else { licht = 1; } SetVehicleParamsEx(vID,motor,licht,alarm,tueren,bonnet,boot,objective); SendClientMessage(playerid,blau,"Du hast das Licht an eingeschalten/ausgeschalten"); } if(listitem==2) { new motor, licht, alarm, tueren, bonnet, boot, objective; new vID = INVALID_VEHICLE_ID; if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { new Float:Pos[3]; for(new i=0;i<MAX_VEHICLES; i++) { GetVehiclePos(i, Pos[0], Pos[1], Pos[2]); if(IsPlayerInRangeOfPoint(playerid, 5.0, Pos[0], Pos[1], Pos[2])) { vID = i; break; } } } else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { vID = GetPlayerVehicleID(playerid); } if(vID == INVALID_VEHICLE_ID) { SendClientMessage(playerid, 0xFF0000FF, "Error: Nicht nahe oder in einem Fahrzeug."); } //abschliessen: GetVehicleParamsEx(vID,motor,licht,alarm,tueren,bonnet,boot,objective); if(tueren==1) { tueren = 0; } else { tueren = 1; } SetVehicleParamsEx(vID,motor,licht,alarm,tueren,bonnet,boot,objective); SendClientMessage(playerid,blau,"Sie haben die Türen Ihres Fahrzeuges abgeschlossen/aufgeschlossen!"); } if(listitem==3) { new vID = GetPlayerVehicleID(playerid); if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, hellgrün, "Du bist in kein Auto!"); for (new i = 0; i < sizeof(aInfo); i++) { if(vID == aInfo[i] [id_x]) { if(aInfo[i][besitzer] == sInfo[playerid][db_id]) { new query[256]; GetVehiclePos(vID, aInfo[i][c_x],aInfo[i][c_y],aInfo[i][c_z]); GetVehicleZAngle(vID,aInfo[i][c_r]); format(query, sizeof(query), "UPDATE Autos SET x='%f',y='%f',z='%f',r='%f' WHERE id='%i'",aInfo[i] [c_x],aInfo[i] [c_y],aInfo[i] [c_z],aInfo[i] [c_r],aInfo[i] [db_id]); mysql_function_query(dbhandle,query,false," "," "); SendClientMessage(playerid, hellgrün, "Du hast dein Auto geparkt."); return 1; } break; } } return SendClientMessage(playerid, hellgrün, "Sie sitzen nicht in Ihr Fahrze!"); } } return 1; }
SpielerName:
Codestock SpielerName(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,MAX_PLAYER_NAME); return name; }
Dann sagt er mir auch das folgende Funktion die ich gemacht habe nicht gibt:
CodeSetPlayerMoney(playerid,money) { ResetPlayerMoney(playerid); GivePlayerMoney(playerid,money); return 1; } samplernen.p(1570) : warning 203: symbol is never used: "SetPlayerMoney"
MYSQL_Log:
SQL
Alles anzeigen[09:11:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [09:11:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [09:11:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [09:11:31] [DEBUG] CMySQLConnection::Connect - connection was successful [09:11:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [09:11:31] [DEBUG] CMySQLConnection::Connect - connection was successful [09:11:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [09:11:31] [DEBUG] CMySQLConnection::Connect - connection was successful [09:11:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [09:12:02] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='X_CROXX_X' ", callback: "OnUserCheck", format: "i" [09:12:02] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [09:12:02] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.424 milliseconds [09:12:02] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [09:12:02] [DEBUG] Calling callback "OnUserCheck".. [09:12:02] [DEBUG] cache_get_data - connection: 1 [09:12:02] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [09:12:14] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO user (username, passwort, level) VALUES ('X_CROXX_X'", callback: "(null)", format: "d" [09:12:14] [DEBUG] CMySQLQuery::Execute[] - starting query execution [09:12:14] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.789 milliseconds [09:12:14] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [09:12:19] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [09:12:19] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [09:12:19] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.245 milliseconds [09:12:19] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [09:12:19] [DEBUG] Calling callback "OnPlayerCarsLoad".. [09:12:19] [DEBUG] cache_get_data - connection: 1 [09:12:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [09:12:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [09:12:19] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [09:12:19] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [09:12:19] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [09:12:19] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [09:12:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [09:12:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [09:12:19] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [09:13:08] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='X_CROXX_X' ", callback: "OnUserCheck", format: "i" [09:13:08] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [09:13:08] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.234 milliseconds [09:13:08] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [09:13:08] [DEBUG] Calling callback "OnUserCheck".. [09:13:08] [DEBUG] cache_get_data - connection: 1 [09:13:08] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [09:13:16] [DEBUG] mysql_escape_string - source: "klom19pom", connection: 1, max_len: 35 [09:13:16] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM user WHERE username='X_CROXX_X' AND passwort=MD5('", callback: "OnPasswordResponse", format: "i" [09:13:16] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - starting query execution [09:13:16] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - query was successfully executed within 0.812 milliseconds [09:13:16] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [09:13:16] [DEBUG] Calling callback "OnPasswordResponse".. [09:13:16] [DEBUG] cache_get_data - connection: 1 [09:13:16] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [09:13:27] [DEBUG] mysql_close - connection: 1 [09:13:27] [DEBUG] CMySQLConnection::Disconnect - connection was closed [09:13:27] [DEBUG] CMySQLConnection::Disconnect - connection was closed [09:13:27] [DEBUG] CMySQLConnection::Disconnect - connection was closed [09:13:27] [WARNING] CMySQLConnection::Disconnect - no connection available [09:13:27] [DEBUG] CMySQLConnection::Disconnect - connection was closed [09:13:27] [DEBUG] CMySQLHandle::~CMySQLHandle - deconstructor called
-
@Jeffry Ich kann mich nun nicht mal mehr einloggen. Es ging vorher alles nur das problem was einfach war das die Accounts nach dem man sich eingeloggt hat "Nicht aus der Datenbank gelsen hat. Das heißt es gab kein Admin"
-
@Jeffry
Nach dem ich das alles so gemacht habe kann man keine Admin-Befehle mehr ausführen selbst wenn man adminrechte hat.Ich weiß einfach nicht was nun der Fehler sein soll:
Ob es jetzt an OnPlayerRegister liegt weiß ich nicht.
Aber ich weiß´nur das unter OnUserCheck geprüft wird ob Spieler registriert ist oder login gehen muss:Forward:
Codeforward OnUserCheck(playerid); forward OnPasswordResponse(playerid); forward OnUserCheck(playerid)
Login/Register:
enum playerinfo:
//mysql:Code#define db_host "localhost" #define db_user "benutzername" #define db_pass "" #define db_db "samp5608_samp" new dbhandle;
OnGameModeInit:
Code//mysql verbindung: dbhandle = mysql_connect(db_host,db_user,db_db,db_pass); print("Mysql wurde verbunden!"); mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
OnGameModExit:Code
Alles anzeigenpublic OnUserCheck(playerid) { new num_rows,num_fields; cache_get_data(num_rows,num_fields,dbhandle); if(num_rows==0) { //Register ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Registrieren","Abbrechen"); } else { //Login ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Anmelden","Gebe bitte dein Passwort ein.","Anmleden","Abbrechen"); } return 1; } public OnPlayerRegister(playerid) { sInfo[playerid][db_id] = cache_insert_id(); return 1; }
Code
Alles anzeigenpublic OnPlayerConnect(playerid) { if(IsPlayerNPC(playerid)) return 1; new nachricht[128]; format(nachricht,sizeof(nachricht),"Du bist mit der ID %i verbunden.",playerid); SendClientMessage(playerid,rot,nachricht); //Login/Register: new name[MAX_PLAYER_NAME],query[128]; GetPlayerName(playerid,name,sizeof(name)); format(query,sizeof(query),"SELECT id FROM user WHERE username='%s' ",name); mysql_function_query(dbhandle,query,true,"OnUserCheck","i",playerid); SendClientMessage(playerid,grün,"Willkommen auf Reallife Version 0.1.4! Wir wünschen euch ein angenehmen Spiel spaß bei uns!"); //textdraws anzeigen: TextDrawShowForPlayer(playerid,Text:uhrzeitLabel); TextDrawShowForAll(Jahr); SetPlayerColor(playerid,weiß); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); return 1; } savePlayer(playerid) { if(sInfo[playerid][eingeloggt]==0)return 1; //Speichern level,money new query[256]; format(query,sizeof(query),"UPDATE user SET level='%i',money='%i',alevel='%i',fraktion='%i',rang='%i',spawnchange='%i' WHERE id='%i'",sInfo[playerid][level],GetPlayerMoney(playerid),sInfo[playerid][alevel],sInfo[playerid][fraktion],sInfo[playerid][rang],sInfo[playerid][spawnchange],sInfo[playerid][db_id]); mysql_function_query(dbhandle,query,false,"",""); return 1; } resetPlayer(playerid) { for(new i=0; i<sizeof(sInfo[]); i++) { sInfo[playerid][playerInfo:i]=0; } return 1; }
Code
Alles anzeigenpublic OnPlayerDisconnect(playerid, reason) { for(new i=0; i<sizeof(aInfo); i++) { if(aInfo[i][id_x]==0)continue; if(aInfo[i][besitzer]!=sInfo[playerid][db_id])continue; GetVehiclePos(aInfo[i][id_x],aInfo[i][c_x],aInfo[i][c_y],aInfo[i][c_z]); GetVehicleZAngle(aInfo[i][id_x],aInfo[i][c_r]); new query[156]; format(query,sizeof(query),"UPDATE user SET level='%i',money='%i',alevel='%i',fraktion='%i',rang='%i' WHERE id='%i'",sInfo[playerid][level], GetPlayerMoney(playerid),sInfo[playerid][alevel],sInfo[playerid][fraktion],sInfo[playerid][rang],sInfo,sInfo[playerid][db_id]); mysql_function_query(dbhandle,query,false,"",""); DestroyVehicle(aInfo[i][id_x]); aInfo[i][id_x]=0; break; } savePlayer(playerid); resetPlayer(playerid); loadPlayerCars(playerid); return 1; }
Ka ob es dazu gehört:CodegetPlayerName(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); return name; }
Code
Alles anzeigenpublic OnPasswordResponse(playerid) { new num_rows,num_fields; cache_get_data(num_rows,num_fields,dbhandle); if(num_rows==1) { //passwort Richtig sInfo[playerid][eingeloggt] = 1; sInfo[playerid][level] = cache_get_field_content_int(0,"level",dbhandle); SetPlayerScore(playerid,sInfo[playerid][level]); sInfo[playerid][db_id] = cache_get_field_content_int(0,"id",dbhandle); SetPlayerMoney(playerid,cache_get_field_content_int(0,"money",dbhandle)); sInfo[playerid][alevel] = cache_get_field_content_int(0,"alevel",dbhandle); sInfo[playerid][fraktion] = cache_get_field_content_int(0,"fraktion",dbhandle); sInfo[playerid][rang] = cache_get_field_content_int(0,"rang",dbhandle); sInfo[playerid][spawnchange] = cache_get_field_content_int(0,"spawnchange",dbhandle); SetPlayerScore(playerid,sInfo[playerid][level]); loadPlayerCars(playerid); } else { //Passwort Falsch SendClientMessage(playerid,grün,"Du hast dein Passwort falsch eingetippt. Versuche es nochmal!"); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } return 1; }
Code
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"INSERT SELECT user (username, passwort, level) VALUES ('%s', MD5('%s'), '1')",name,passwort); mysql_function_query(dbhandle,query,true,"OnUserCheck","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', MD5('%s'), '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }