Posts: 528
Threads: 70
Joined: Nov 2014
Reputation:
0
Hey, see like 1 player registers he spawns at virtual world 1.. next time anytime he logs in he must spawn there only. For the next player when registers he must be spawned in virtual world 2. and it must be saved in the logs ( Scriptfiles ). I am using YSI system for saving. Can you give me a idea of how to do it?
Posts: 528
Threads: 70
Joined: Nov 2014
Reputation:
0
I am asking for an example lol.. I don't know how to do it.
Posts: 1,849
Threads: 96
Joined: Apr 2010
Reputation:
0
Just save the location of the player into the .ini files system. You will need to add another var in the player's array to hold the value of its position. Once they disconnect, write the ini file with the current position and other stats.
Posts: 528
Threads: 70
Joined: Nov 2014
Reputation:
0
Dude i know the point you said, but how can i set the players virtual world? Like mine is 1. The next player registers must have the virtual world 2. The next player must have virtual world 3. so on.
Posts: 528
Threads: 70
Joined: Nov 2014
Reputation:
0
I understand what you are saying but (VirtualWorldTaken) is a function that is not globalized and i dont think that VirtualWorldTaken is any function.
Posts: 528
Threads: 70
Joined: Nov 2014
Reputation:
0
Ok i got it if i have any other query i will let you know. Thanks.
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
I don't know where you're heading with this (it seems pretty pointless to isolate players in a multiplayer game), but remember that 'playerid' is also a unique property. If you set a player's virtual world to 'playerid' then no other player can connect to that world until the current player disconnects and another player assumes the playerid.
Posts: 319
Threads: 7
Joined: Jul 2012
Reputation:
0
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.
Posts: 528
Threads: 70
Joined: Nov 2014
Reputation:
0
You will know it soon. Anyway I have that much sense I used only 2k.. And better give an example through codes? Its better you know. Thank you.
Posts: 528
Threads: 70
Joined: Nov 2014
Reputation:
0
Vince I dont want that I want like if its taken by x player then it must belong to him forever. That virtual world must not be taken by anyone else.
Posts: 528
Threads: 70
Joined: Nov 2014
Reputation:
0
So, may i continue with what codes where said in this topic or are they wrong? If they are wrong then can someone show me correct example?
Posts: 528
Threads: 70
Joined: Nov 2014
Reputation:
0
Yup it worked. Even i want to ask a last little doubt. If i create an OBJECT to only 1 player. How can i save it and load it on the next login only for him as he creates the object to himself.
Posts: 528
Threads: 70
Joined: Nov 2014
Reputation:
0
BUMB i repeat the problem. The saving of virtual world starts from 1999, and continues to 2000. and then always 2000. Anyone can fixit?