|
![]() |
|
Thread Tools | Display Modes |
![]() |
#21 | |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Nov 2010
Location: Belgium
Posts: 1,734
Reputation: 238
|
![]() Quote:
Would you feel fine if a downloaded gamemode needs 10 tables, where every table has more than 10 columns, to create them by hand? Should the author of the gamemode write a manual about how the tables should be named, which column has which name, content-type (int, float, text, byte, ...), instead of adding a line of code which will be used only once, as you said? I'd rather have the gamemode create them in such a case, even if that code is executed only once. Then everyone is certain they have the proper table-name and table-structure and don't have to fiddle around trying to get all tables created manually and testing if the script works using your manually created table. I created a table with 35 columns a few days ago and it took a while to set it up. Nice tutorial btw, I'll be using this. |
|
![]() |
![]() |
![]() |
#22 | |
Spam Machine
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Dec 2011
Posts: 11,846
Reputation: 1399
|
![]() Quote:
|
|
![]() |
![]() |
![]() |
#23 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Nov 2010
Location: Belgium
Posts: 1,734
Reputation: 238
|
![]()
And if you have multiple tables which should have data in them already, let's say 1000 records per table?
Suppose I would convert all my files into SQL-tables. Those files hold all: - mission vehicles - cargo-types - locations - route-data - police stations - gas stations - vehicle-info (max-fuel, fuel-consumption, refuel times per vehicle etc) They would have to copy/paste several thousand pre-defined queries from the txt file. It would be nicer if the script itself creates the tables and inserts all data when starting the server for the first time. Or perhaps make a .bat file to execute them. |
![]() |
![]() |
![]() |
#24 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Nov 2011
Location: Turkey
Posts: 1,103
Reputation: 172
|
![]()
Hi guys, I got R33 and compiled it without editing the code on the tutorial, when I try to load the plugin, I get this error:
[13:36:48] Could not connect to database! [13:36:48] Script[gamemodes/mysqlbase.amx]: Run time error 20: "Invalid index parameter (bad entry point)" I'm about the go mad, because I couldn't get this fixed in a week. I am really bored of trying. |
![]() |
![]() |
![]() |
#25 | |
Spam Machine
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Dec 2011
Posts: 11,846
Reputation: 1399
|
![]() Quote:
pawn Code:
Just googling the run time error or using the search button, you'd have found the solution in 10 seconds rather than waiting for a week to find out what's the problem. @PowerPC603: We're talking about creating tables within the script only, not records. Even if that, would you insert those stuff again and again after a server start/restart? That'd be pointless. You can insert many records by executing only once by separating them with a semicolon (;). |
|
![]() |
![]() |
![]() |
#26 | |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Nov 2011
Location: Turkey
Posts: 1,103
Reputation: 172
|
![]() Quote:
Last edited by Tamer; 28/01/2014 at 01:03 PM. |
|
![]() |
![]() |
![]() |
#27 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Nov 2011
Location: Turkey
Posts: 1,103
Reputation: 172
|
![]()
I found a bug. When you register and quit, your stats are not saved. To re-produce the bug follow these steps:
Copy the whole tutorial code, Add this command to the script: pawn Code:
compile it, open the server, make sure all MySQL databases are running and it connected. Register to the server and execute the /statson command, then quit the server. Check your MySQL databases, the info's will not be updated. However, the user will be registered. Then, re-join to the server (make sure you are registered) you will have a login window, which is normal. Now execute the /statson command and quit. Now your stats will be saved. This is pretty annoying. Stats should save as soon as the player registers. It should not wait for the player to re-connect. |
![]() |
![]() |
![]() |
#28 |
Little Clucker
![]() Join Date: Aug 2011
Posts: 40
Reputation: 8
|
![]()
can you explain how to add some extra variables when the table already exist?
|
![]() |
![]() |
![]() |
#29 | |
Banned
![]() Join Date: Aug 2011
Location: Croatia, Knin
Posts: 635
Reputation: 115
|
![]() Quote:
|
|
![]() |
![]() |
![]() |
#30 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Nov 2010
Location: Belgium
Posts: 1,734
Reputation: 238
|
![]() pawn Code:
BUT the tutorial doesn't have the ID of the player in the database. Only the player's name, password and IP are inserted. The table auto-creates the ID in MySQL, but it's not loaded and stays 0 in the script. When exiting the game, OnPlayerDisconnect tries to update data for ID 0, which doesn't exist. When the player logs back in (using the code from the tutorial), ALL data is read properly, including the ID. Therefore it can be saved properly during OnPlayerDisconnect because now the script holds the proper ID of the player to update the data. The code above should become (adjusted the query here): pawn Code:
Then use code like this: pawn Code:
Of course, adjust database names, variablenames and mysql-connectionhandle to the proper values in your script, as this was literally taken out of my script. |
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Baffled - mySQL Vehicle Loading (threaded queries) | Moglizorz. | Server Support | 0 | 18/05/2013 02:14 AM |
Comparing password [MySQL Threaded queries] | emokidx | Scripting Help | 3 | 02/04/2013 01:07 PM |
MySQL Threaded Queries | CONTROLA | Scripting Help | 4 | 25/11/2012 04:02 PM |
Threaded Queries - BlueG's MYSQL Plugin R7 | Ballu Miaa | Scripting Help | 3 | 05/11/2012 06:36 PM |
[Help] BlueG's MySQL Plugin R7 - Threaded Queries | Maxips2 | Scripting Help | 4 | 19/10/2012 10:35 AM |