[HLF]Southclaw
Unregistered
Constants are generally preferred over definitions: `const something = 5;`. They provide an actual name for the value so any warnings or errors will provide more information at compile time. `#define` is effectively search-and-replace at compile-time which can lead to some non-obvious issues.
Posts: 1,506
Threads: 13
Joined: Jun 2015
Hi,
I've a few questions related to MySQL.
- What's the BEST way to store player records (IP, admins, bans, etc)
- And, what's the best way to store configuration data in the database? Such as:
PHP Code:
CREATE TABLE IF NOT EXISTS "#TABLE_SERVER_CFG" (\
`weather` INTEGER, \
`time` INTEGER, \
`double_score` INTEGER, \
`motd` VARCHAR(100), \
`amotd` VARCHAR(100)\
)
I don't think it's a good use of MySQL to store such information and I should use INI or CFG files. But, I wish to keep everything all-together in one database. And the data is supposed to be updated on server shutdown or during the runtime.
Posts: 15,941
Threads: 0
Joined: Jun 2008
You're right, SQL is not good for that. But if you are to, do one item per row, not column. So just a few generic `key` and `value` columns, then each config option separately. Similar for player records. An `admins` table with one per row; a `bans` table etc.
Posts: 8
Threads: 1
Joined: Jan 2019
Reputation:
0
Hello,
I've been adding vehicles to my samp server by using the samp debug however i've discovered there was an easier way to add cars and objects to my server and that is from fusez's map editor.
Now, if i add objects and cars to my map using fusez's map editor and when i save it how would i add the objects and cars used from that filterscript into my main server? Also would it completely erase the vehicles i've added by using the samp debug?
Posts: 15,941
Threads: 0
Joined: Jun 2008
Posts: 249
Threads: 26
Joined: Jan 2011
Reputation:
0
Is there any json_decode function? Need to store a json array to an Array in pawn.
Posts: 249
Threads: 26
Joined: Jan 2011
Reputation:
0
I've just found another problem with the HTTP function.
I'm sending two HTTP requests (Those two functions have a different callback where the response has to go to) in one function, the problem is that it will only react to the first callback that gets a response first, the other one wont be called after. Is this behavior normal or could it be something else?
Posts: 15,941
Threads: 0
Joined: Jun 2008
Just don't use the built-in HTTP function at all. There are better plugins, such as "requests".
Posts: 28
Threads: 6
Joined: Feb 2018
Reputation:
0
Thank you for your answer, in which case it will be as it is.
Posts: 15,941
Threads: 0
Joined: Jun 2008
Quote:
Originally Posted by ComDuck
Although, I was thinking of an idea where you can compress each XYZ coordinates into a single line and separate the X, Y and Z float values with a separator character (-, /, etc), but why do all that extra work for your case? I don't even think it's a good idea anyways. What if you only want to modify a single coordinate value only?
|
That isn't a compression. That isn't good in any way. SQL can store floats as numbers internally. Your method would convert it to a string first, losing all the optimizations available. What's more, storing bits of data together is exactly what SQL is already designed to do very very well. So you are badly replicating part of the features of a database in the database, instead of just using the native functionality.
Posts: 26
Threads: 6
Joined: Feb 2019
Reputation:
0
in which way do we make commands with multiple functions?
for example: /giveplayer [id] [money/health/armor] [value]
thanks
Posts: 100
Threads: 11
Joined: Dec 2018
Quote:
Originally Posted by v4yne1
in which way do we make commands with multiple functions?
for example: /giveplayer [id] [money/health/armor] [value]
thanks
|
HERE is a well-written tutorial about the whole thing. Good luck.