Get Data from MySQL in pawn for #define
#5

You can't load the messages to put in a define.
#define is a precompiler instruction and is used to replace text in the script upon compiling.
This happens before your script is even executed, and at that point, there is no connection to any database yet.

After compiling, the #define isn't in the amx file.

But you can do it as Gammix told you: use arrays.

Why would you even use defines to hold messages?
A define is static and cannot be changed during runtime.

Using arrays, you can allow the messages to be added/edited/removed from the database and script during runtime.
They're just more flexible and can be expanded easily.
In Gammix's code, you simply need to modify the MAX_MESSAGES define to allow more messages to be held in memory by your script/server.
Reply


Messages In This Thread
Get Data from MySQL in pawn for #define - by GospodinX - 09.05.2018, 19:47
Re: Get Data from MySQL in pawn for #define - by Gammix - 09.05.2018, 20:05
Re: Get Data from MySQL in pawn for #define - by GospodinX - 09.05.2018, 21:08
Re: Get Data from MySQL in pawn for #define - by Banditul18 - 09.05.2018, 21:42
Re: Get Data from MySQL in pawn for #define - by AmigaBlizzard - 09.05.2018, 21:52
Re: Get Data from MySQL in pawn for #define - by GTLS - 10.05.2018, 04:49
Re: Get Data from MySQL in pawn for #define - by GospodinX - 10.05.2018, 08:39
Re: Get Data from MySQL in pawn for #define - by Dayrion - 10.05.2018, 08:58
Re: Get Data from MySQL in pawn for #define - by Sew_Sumi - 10.05.2018, 09:42

Forum Jump:


Users browsing this thread: 1 Guest(s)