SAMP virtual world adding 1 by 1
#11

There is no point in having an array with size 2 billion just to see which virtual world is taken.
An array of that size will occupy 8GB of RAM for this alone (2 billion indices in the array, each 4 bytes long as each index can hold a 32-bit integer value).
Also your amx-file will be that size.
Pretty overkill if you ask me.
I wonder how you're gonna save that array so it's contents are identical after a server-restart.
You would end up with a file of several GB's in size as well, just to hold a 1 or a 0 in each index of that array.

And looping through that array to find the next unused virtual world is also not needed.


If it always goes up by 1 everytime a player registers, just have one variable hold the highest used virtual world and save that in a file.

Next time a player registers, increase the variable by 1, use that value as virtual world for that player (also save it in his account-file) and save your highest-virtual-world-file again with this new value.
Also no need for a big loop that would run through 100000 indices to find the next unused virtual world (in case you have 100000 registered players).

Also load this file when your server starts, so it doesn't always start from 0 again and you're set.

Note that all players won't see eachother and can't interact with eachother, except for using chat.
They can't shoot eachother, drive together, ...
I don't see any use for this, except for when you're trying to re-create single-player in a multiplayer environment.
Reply


Messages In This Thread
SAMP virtual world adding 1 by 1 - by fuckingcruse - 26.01.2016, 04:33
Re: SAMP virtual world adding 1 by 1 - by SystemX - 26.01.2016, 05:01
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 26.01.2016, 05:10
Re: SAMP virtual world adding 1 by 1 - by Ballu Miaa - 26.01.2016, 05:32
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 26.01.2016, 05:33
Re: SAMP virtual world adding 1 by 1 - by -CaRRoT - 26.01.2016, 05:37
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 26.01.2016, 05:56
Re: SAMP virtual world adding 1 by 1 - by -CaRRoT - 26.01.2016, 06:07
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 26.01.2016, 06:12
Re: SAMP virtual world adding 1 by 1 - by Vince - 26.01.2016, 10:26
Re: SAMP virtual world adding 1 by 1 - by AmigaBlizzard - 26.01.2016, 11:06
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 26.01.2016, 11:10
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 26.01.2016, 11:12
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 27.01.2016, 14:15
Re: SAMP virtual world adding 1 by 1 - by -CaRRoT - 27.01.2016, 14:26
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 27.01.2016, 15:09
Re: SAMP virtual world adding 1 by 1 - by -CaRRoT - 27.01.2016, 15:31
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 27.01.2016, 15:38
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 30.01.2016, 14:38
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 31.01.2016, 06:28
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 31.01.2016, 13:27
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 01.02.2016, 15:26
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 06.02.2016, 11:33
Re: SAMP virtual world adding 1 by 1 - by Mencent - 06.02.2016, 11:36
Re: SAMP virtual world adding 1 by 1 - by fuckingcruse - 06.02.2016, 13:26

Forum Jump:


Users browsing this thread: 1 Guest(s)