#define SQL_HOST \"localhost\"#define SQL_USER \"root\"#define SQL_PASS \"\"#define SQL_DB \"rpg\"//MySQL//forward ConnectMySQL();public ConnectMySQL(){if(mysql_connect(SQL_HOST,SQL_USER,SQL_DB,SQL_PASS)){printf(\"[MYSQL]: Conectare la `%s` a avut succes!\",SQL_DB);}else{ printf(\"[MYSQL]: [ERROR]: Conectare la `%s` a esuat!\",SQL_DB);}return 1;} //és a regisztárcio//public MySQLCreateAccount(newplayersname[], newpassword[], playerid){new query[182];new sqlplyname[182];new sqlpassword[182];mysql_real_escape_string(newplayersname, sqlplyname);mysql_real_escape_string(newpassword, sqlpassword);format(query, sizeof(query), \"INSERT INTO players (Name, Password) VALUES (\'%s\', \'%s\')\", sqlplyname, sqlpassword);mysql_query(query);Registerr[playerid] = 2;print(\"[MySQL]: Un nou cont a fost creat in baza de date!(..)01\");mysql_free_result();print(\"[MySQL]: Un nou cont a fost creat in baza de date!(..)02\");//mysql_free_result();new newplayersid = MySQLCheckAccount(newplayersname);if (newplayersid != 0){return newplayersid;}return 0;}
forward ConnectMySQL();public ConnectMySQL(){ if(mysql_connect(SQL_HOST,SQL_USER,SQL_DB,SQL_PASS)) { printf(\"[MYSQL]: Conectare la `%s` a avut succes!\",SQL_DB); } else { printf(\"[MYSQL]: [ERROR]: Conectare la `%s` a esuat!\",SQL_DB); } return 1;}
forward ConnectMySQL();public ConnectMySQL() {mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);if(mysql_ping()) printf(\"[MYSQL]: Conectare la `%s` a avut succes!\",SQL_DB); else printf(\"[MYSQL]: [ERROR]: Conectare la `%s` a esuat!\",SQL_DB); return 1;}
----------Loaded log file: \"server_log.txt\".----------SA-MP Dedicated Server----------------------v0.3z, (C)2005-2014 SA-MP Team[14:58:34] filterscripts = \"\" (string)[14:58:34] [14:58:34] Server Plugins[14:58:34] --------------[14:58:34] Loading plugin: mysql[14:58:35] > MySQL plugin R5 successfully loaded.[14:58:35] Loaded.[14:58:35] Loading plugin: sscanf[14:58:35] [14:58:35] ===============================[14:58:35] sscanf plugin loaded. [14:58:35] (c) 2009 Alex \"Y_Less\" Cole[14:58:35] 0.3d-R2 500 Players \"dnee\"[14:58:35] ===============================[14:58:35] Loaded.[14:58:35] Loading plugin: streamer[14:58:35] *** Streamer Plugin v2.6.1 by Incognito loaded ***[14:58:35] Loaded.[14:58:35] Loading plugin: Whirlpool[14:58:35] [14:58:35] ==================[14:58:35] [14:58:35] Whirlpool loaded[14:58:35] [14:58:35] ==================[14:58:35] [14:58:35] Loaded.[14:58:35] Loaded 4 plugins.[14:58:35] [14:58:35] Filterscripts[14:58:35] ---------------[14:58:35] Loaded 0 filterscripts.[14:58:35] [MYSQL]: Conectare la `rpg` a avut succes![14:58:36] * Case citite: 0[14:58:36] * Canale IRC citite: 10[14:58:36] * Character killuri citite: 10[14:58:36] * Ziare citite: 10[14:58:36] * Bizzuri citite: 0[14:58:36] * SBizzuri citite: 0[14:58:36] * Teritorii citite: 0[14:58:36] * Seifuri citite: 0[14:58:36] * Masini personale citite: 0[14:58:36] * DealerShips citite: 4[14:58:36] * ID = 0 | Factiune = 0 | Alianta = 0[14:58:36] * ID = 0 | Factiune = 0 | Alianta = 0[14:58:36] * ID = 0 | Factiune = 0 | Alianta = 0[14:58:36] * ID = 0 | Factiune = 0 | Alianta = 0[14:58:36] * ID = 0 | Factiune = 0 | Alianta = 0[14:58:36] * ID = 0 | Factiune = 0 | Alianta = 0[14:58:36] * Pickup-uri citite: 45[14:58:36] [14:58:36] -------------------------------[14:58:36] BLoWn RPG [14:58:36] -------------------------------[14:58:36] GameMode creator: George12 [14:58:36] 17/1/2014[14:58:36] Number of vehicle models: 113[14:58:44] --- Server Shutting Down.----------Loaded log file: \"server_log.txt\".----------SA-MP Dedicated Server----------------------v0.3z, (C)2005-2014 SA-MP Team[14:59:03] filterscripts = \"\" (string)[14:59:03] [14:59:03] Server Plugins[14:59:03] --------------[14:59:03] Loading plugin: mysql[14:59:03] > MySQL plugin R5 successfully loaded.[14:59:03] Loaded.[14:59:03] Loading plugin: sscanf[14:59:03] [14:59:03] ===============================[14:59:03] sscanf plugin loaded. [14:59:03] (c) 2009 Alex \"Y_Less\" Cole[14:59:03] 0.3d-R2 500 Players \"dnee\"[14:59:03] ===============================[14:59:03] Loaded.[14:59:03] Loading plugin: streamer[14:59:03] *** Streamer Plugin v2.6.1 by Incognito loaded ***[14:59:03] Loaded.[14:59:03] Loading plugin: Whirlpool[14:59:03] [14:59:03] ==================[14:59:03] [14:59:03] Whirlpool loaded[14:59:03] [14:59:03] ==================[14:59:03] [14:59:03] Loaded.[14:59:03] Loaded 4 plugins.[14:59:03] [14:59:03] Filterscripts[14:59:03] ---------------[14:59:03] Loaded 0 filterscripts.[14:59:03] [MYSQL]: Conectare la `rpg` a avut succes![14:59:03] * Case citite: 0[14:59:03] * Canale IRC citite: 10[14:59:03] * Character killuri citite: 10[14:59:03] * Ziare citite: 10[14:59:03] * Bizzuri citite: 0[14:59:03] * SBizzuri citite: 0[14:59:03] * Teritorii citite: 0[14:59:03] * Seifuri citite: 0[14:59:03] * Masini personale citite: 0[14:59:03] * DealerShips citite: 4[14:59:03] * ID = 0 | Factiune = 0 | Alianta = 0[14:59:03] * ID = 0 | Factiune = 0 | Alianta = 0[14:59:03] * ID = 0 | Factiune = 0 | Alianta = 0[14:59:03] * ID = 0 | Factiune = 0 | Alianta = 0[14:59:03] * ID = 0 | Factiune = 0 | Alianta = 0[14:59:03] * ID = 0 | Factiune = 0 | Alianta = 0[14:59:03] * Pickup-uri citite: 45[14:59:03] [14:59:03] -------------------------------[14:59:03] BLoWn RPG [14:59:03] -------------------------------[14:59:03] GameMode creator: George12 [14:59:03] 17/1/2014[14:59:03] Number of vehicle models: 113[14:59:34] Incoming connection: 127.0.0.1:2462[14:59:34] [join] Stewe_Capleone has joined the server (0:127.0.0.1)[14:59:46] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[14:59:46] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[14:59:48] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[14:59:48] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[14:59:49] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[14:59:49] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[14:59:51] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[14:59:51] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[14:59:52] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[14:59:52] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[15:00:01] The weather is changed. [15:00:01][15:00:12] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[15:00:12] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[15:00:13] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[15:00:13] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[15:00:14] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[15:00:14] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[15:00:16] [part] Stewe_Capleone has left the server (0:2)[15:08:25] --- Server Shutting Down.----------Loaded log file: \"server_log.txt\".----------SA-MP Dedicated Server----------------------v0.3z, (C)2005-2014 SA-MP Team[16:29:09] filterscripts = \"\" (string)[16:29:09] [16:29:09] Server Plugins[16:29:09] --------------[16:29:09] Loading plugin: mysql[16:29:09] > MySQL plugin R5 successfully loaded.[16:29:09] Loaded.[16:29:09] Loading plugin: sscanf[16:29:09] [16:29:09] ===============================[16:29:09] sscanf plugin loaded. [16:29:09] (c) 2009 Alex \"Y_Less\" Cole[16:29:09] 0.3d-R2 500 Players \"dnee\"[16:29:09] ===============================[16:29:09] Loaded.[16:29:09] Loading plugin: streamer[16:29:09] *** Streamer Plugin v2.6.1 by Incognito loaded ***[16:29:09] Loaded.[16:29:09] Loading plugin: Whirlpool[16:29:09] [16:29:09] ==================[16:29:09] [16:29:09] Whirlpool loaded[16:29:09] [16:29:09] ==================[16:29:09] [16:29:09] Loaded.[16:29:09] Loaded 4 plugins.[16:29:09] [16:29:09] Filterscripts[16:29:09] ---------------[16:29:09] Loaded 0 filterscripts.[16:29:10] [MYSQL]: Conectare la `rpg` a avut succes![16:29:10] * Case citite: 0[16:29:10] * Canale IRC citite: 10[16:29:10] * Character killuri citite: 10[16:29:10] * Ziare citite: 10[16:29:10] * Bizzuri citite: 0[16:29:10] * SBizzuri citite: 0[16:29:11] * Teritorii citite: 0[16:29:11] * Seifuri citite: 0[16:29:11] * Masini personale citite: 0[16:29:11] * DealerShips citite: 4[16:29:11] * ID = 0 | Factiune = 0 | Alianta = 0[16:29:11] * ID = 0 | Factiune = 0 | Alianta = 0[16:29:11] * ID = 0 | Factiune = 0 | Alianta = 0[16:29:11] * ID = 0 | Factiune = 0 | Alianta = 0[16:29:11] * ID = 0 | Factiune = 0 | Alianta = 0[16:29:11] * ID = 0 | Factiune = 0 | Alianta = 0[16:29:11] * Pickup-uri citite: 45[16:29:11] [16:29:11] -------------------------------[16:29:11] BLoWn RPG [16:29:11] -------------------------------[16:29:11] GameMode creator: George12 [16:29:11] 17/1/2014[16:29:11] Number of vehicle models: 112[16:29:55] Incoming connection: 127.0.0.1:4926[16:29:55] [join] Stewe_Capleone has joined the server (0:127.0.0.1)[16:30:04] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[16:30:04] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[16:30:09] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[16:30:09] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[16:30:10] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[16:30:10] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[16:35:39] [part] Stewe_Capleone has left the server (0:2)[16:59:31] --- Server Shutting Down.----------Loaded log file: \"server_log.txt\".----------SA-MP Dedicated Server----------------------v0.3z, (C)2005-2014 SA-MP Team[17:06:59] filterscripts = \"\" (string)[17:06:59] [17:06:59] Server Plugins[17:06:59] --------------[17:06:59] Loading plugin: mysql[17:06:59] > MySQL plugin R5 successfully loaded.[17:06:59] Loaded.[17:06:59] Loading plugin: sscanf[17:06:59] [17:06:59] ===============================[17:06:59] sscanf plugin loaded. [17:06:59] (c) 2009 Alex \"Y_Less\" Cole[17:06:59] 0.3d-R2 500 Players \"dnee\"[17:06:59] ===============================[17:06:59] Loaded.[17:06:59] Loading plugin: streamer[17:06:59] *** Streamer Plugin v2.6.1 by Incognito loaded ***[17:06:59] Loaded.[17:06:59] Loading plugin: Whirlpool[17:06:59] [17:06:59] ==================[17:06:59] [17:06:59] Whirlpool loaded[17:06:59] [17:06:59] ==================[17:06:59] [17:06:59] Loaded.[17:06:59] Loaded 4 plugins.[17:06:59] [17:06:59] Filterscripts[17:06:59] ---------------[17:06:59] Loaded 0 filterscripts.[17:07:00] [MYSQL]: Conectare la `rpg` a avut succes![17:07:00] * Case citite: 0[17:07:00] * Canale IRC citite: 10[17:07:00] * Character killuri citite: 10[17:07:00] * Ziare citite: 10[17:07:00] * Bizzuri citite: 0[17:07:00] * SBizzuri citite: 0[17:07:00] * Teritorii citite: 0[17:07:00] * Seifuri citite: 0[17:07:00] * Masini personale citite: 0[17:07:00] * DealerShips citite: 4[17:07:00] * ID = 0 | Factiune = 0 | Alianta = 0[17:07:00] * ID = 0 | Factiune = 0 | Alianta = 0[17:07:00] * ID = 0 | Factiune = 0 | Alianta = 0[17:07:00] * ID = 0 | Factiune = 0 | Alianta = 0[17:07:00] * ID = 0 | Factiune = 0 | Alianta = 0[17:07:00] * ID = 0 | Factiune = 0 | Alianta = 0[17:07:00] * Pickup-uri citite: 45[17:07:00] [17:07:00] -------------------------------[17:07:00] BLoWn RPG [17:07:00] -------------------------------[17:07:00] GameMode creator: George12 [17:07:00] 17/1/2014[17:07:00] Number of vehicle models: 113[17:07:50] Incoming connection: 127.0.0.1:1886[17:07:50] [join] Stewe_Capleone has joined the server (0:127.0.0.1)[17:08:00] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[17:08:00] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[17:08:02] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[17:08:02] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[17:08:03] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[17:08:03] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[17:08:04] [MySQL]: Un nou cont a fost creat in baza de date!(..)01[17:08:04] [MySQL]: Un nou cont a fost creat in baza de date!(..)02[17:08:06] [part] Stewe_Capleone has left the server (0:2)[17:08:32] --- Server Shutting Down.
EroareComanda SQL:---- Salvarea datelor din tabel `adminmoneylog`--INSERT INTO `adminmoneylog` ( `id` , `text` ) VALUES ( 1, \'[WARNING]: George12 i-a dat $100000000 la George12, Motiv: . . (1-18-2014)\' ) ; MySQL zice: Documentație#1062 - Duplicate entry \'1\' for key \'PRIMARY\'
EroareComanda SQL:---- Salvarea datelor din tabel `adminmoneylog`--INSERT INTO `adminmoneylog` ( `id` , `text` ) VALUES ( 1, \'[WARNING]: George12 i-a dat $100000000 la George12, Motiv: . . (1-18-2014)\' ) ; MySQL zice: Documentație#1062 - Duplicate entry \'1\' for key \'PRIMARY\' [/quote]Az a hiba, hogy az id elsõdleges kulcs, ami miatt az id értékének minden sorban különbözõnek kell lennie. Ez nem is baj, viszont az a hiba, hogy a amikor megpróbáltad beszúr i az adott sort, nem tudtad, ugyanis már létezett egy sor, mely id oszlopának 1 volt az értéke. De minek neked ez a sor? Hiszen ez csak egy felesleges adat lenne, mely a publikálók által lett elkészítve, valószínûleg használat során.Viszont fogadd meg a fenti tanácsomat és hagyd a fenébe a mysql-os módokat, ameddig meg nem tanultál programozni, na meg magát a mysqlt kezelni és használni.