What is the best way for manipulate arrays? (Svars, Global etc..)
#1

I have lots of code piece like that;

enum myarray_init{SQLID,mystring[50],myint,myint2,myarint[10],myarint2[50],...}
new myarray[10000][myarray_init],myarraycount;

Im getting datas from sql and set it to myarray.
But i dont set everything on init. im adding new datas if system needs it.
Its something like; set when player connects and remove when player disconnetcs. But its not player based. So the limits in this example 10000 different array data. And maybe more....

So right now im doing this;

loaditbecausesystemneeds(){
//get data from db
//set data to myarray[myarraycount]
//increase myarraycount (+1)
}

searchdata(something){ //This function makes lots of load on server.
//search an SQLID,myint,myarint etc.
//return myarray KEY
}

somefunc(){
//test=searchdata(something);
//do what you want with data as myarray[test][someotherthing];
}

i have myarraycount because of performance issues.
But i have 10-15 different code piece like that. they are so similar to this.

Is that method correct? Or how can make better one? (With svars maybe. idk.)

Actually i was searching an option like streamers;
streamer_SetArrayData and streamer_GetArrayData functions. (And a search method on it too)
(something like that maybe; https://sampforum.blast.hk/showthread.php?tid=238844 I didnt use that because there is no developer on that work right now.)

Sorry for my poor english. thank you for reading.
Reply
#2

If the limit is as big as 10000 you obviously need to use DB directly, as with SQL you'd get the search result in matter of milliseconds.
Reply
#3

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
If the limit is as big as 10000 you obviously need to use DB directly, as with SQL you'd get the search result in matter of milliseconds.
This is a cache structure in a way. I dont want to use mysql because manipulated data's count is couple of millions at least. I want use my ram smarty. Ofcourse i know we can use mysql and how good it is. But if streamer plugin doesnt use than i shouldnt too. Because that datas are so important and so much actions occuring with those datas on game. I made such a thing like that instead of dynamic array manipulation. Im trying to minimize load of searchs with myarraycount. The logic of structure quite same with incognito streamer plugin's data manipulations. New samp versions have lots of new futures. And i thinked, maybe there are some functions or methods to handle that structure.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)