Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,038 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Update a single element in a global array? #369144
05/02/11 05:23
05/02/11 05:23
Joined: Jun 2010
Posts: 21
Canada
G
GnR Offline OP
Newbie
GnR  Offline OP
Newbie
G

Joined: Jun 2010
Posts: 21
Canada
Does anyone know if it's possible to update a single element of an array on the server? This is using built-in multiplayer.

I sort of tried it and it didn't work using something like send_var(my_id[3]);

This would allow each client to be responsible for their own element. Or perhaps there is a better way to do this. The array would be nice for looping through the index.

Re: Update a single element in a global array? [Re: GnR] #369740
05/06/11 17:17
05/06/11 17:17
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
I had a similar problem.b I just sent a struck that had all the needed info.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: Update a single element in a global array? [Re: GnR] #369742
05/06/11 17:32
05/06/11 17:32
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: GnR
This would allow each client to be responsible for their own element. Or perhaps there is a better way to do this. The array would be nice for looping through the index.

Plus: Malicious code can easily alter other players or force the server to write outside of the arrays bounds...

I would highly discourage this, use the client ID to identifier clients, eg. you could create a hash table which uses the clients ID as key to get either the players data or the index of the players data in the array.
The latter one would be sort of a "meh" solution as you had to update the indicies when the array changes but its the only way to have an ordered list together with the hash table.

[shameless self plug]Lite Foundation has an easy to use hash table class (LFSet) which also allows fast enumeration of the hash table and such nice things, although its rendered useless by the fact that it uses the value as key =/ Oh well, time to implement another hash table class[/shameless self plug]


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com

Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1