How should I declare array for this
#1

Hey guys, right now I wonder, because I would like to declare array, which would fit my needs.

I'm currently using this:
PHP код:
enum E_MDC
{
    
//stuff
    
E_MDC_RECORD_ENTRY_ID[MAX_RECORDS],
    
E_MDC_RECORD_ISSUER[MAX_RECORDS][MAX_PLAYER_NAME 1]
}
static 
MDC_g_sPlayer[MAX_PLAYERS][E_MDC]; 
So yeah, for each specific record I want to save it's issuer name. But I don't know how I will do that.
Reply
#2

MDC_g_sPlayer[playerid][E_MDC_RECORD_ENTRY_ID][0] = 10;
MDC_g_sPlayer[playerid][E_MDC_RECORD_ISSUER][0] = "Hi";
Reply
#3

This type of system is much better done with the MySQL plugin, where you can create tables, use auto generating IDs and easily look up, change, remove and add data. The only difference is that you're querying the data, which is relatively quick if you're using good optimization.
Reply
#4

Yeah, that's the method which I will use, if I don't find anything. Anyways, it would be fastest if I could access data from memory instead of firing select query.
Reply
#5

Quote:
Originally Posted by Riwerry
Посмотреть сообщение
Yeah, that's the method which I will use, if I don't find anything. Anyways, it would be fastest if I could access data from memory instead of firing select query.
The MySQL plugin is widely used by SA-MP servers and is optimized for performance, speed shouldn't be an issue if you're using optimized queries along with an optimized database. On top of that, the plugin provides threaded queries which allows queries to go through a different thread apart from the server itself (which eliminates the server having to wait between calls). It also allows you to store a cache of the queries results for further use outside of the returned callback.
Reply
#6

I'm interested that if I store cache and some of the values in database get updated, and I use proviously stored cache again, will it load new values also, or it'll keep it's provious database state?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)