![]() |
serverr flag array trouble
Okay, so I'm making an Events System, and I have the events setup like this:
Theres 4 different event types, each has it's own multidimensional array with the event names and their data in it. What I'm stuck on is trying to make a list of each event in its category in serverr flags. Ex: serverr.events.contest=Musical Chairs, Emoticons Now, to spare you with all the for loops and such, here's essentially what I'm trying to do: PHP Code:
|
PHP Code:
I think you need to initialize the array first, for example with {} or new[1] |
Not releated to the script but to the whole thing. If you make an event system it would be more useful to use a database npc to store all the event informations. If you have many events or long texts it might be a problem.
Yesterday I updated the serverflags on GK Debug because I wanted to add a new tool type. But I was not able to add it, the limit of variables in the serverflags was reached. Think about it. |
First of all, let me just tell you that Bjorn is right. Use a DB instead of serverr. strings. Now to answer your question..
Quote:
serverr.flag = new[5]; serverr.flag[2] = "lol"; Just an example on how to do it before you set the data. |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
I believe Database NPCs are a bit unsafe for information thats not set in the script since if its in flags only it could be cleared on reset.
For things like that I use TStaticVars that save to file. By the way, there is a serveroption that limits you to only changing existing server flags rather than being able to create new ones, make sure thats not enabled? Quote:
PHP Code:
Quote:
|
I personally use database npcs that backup data to a file on update. This uses the least gserver usage (HD usage) in most cases where you don't need to update much.
About editing array members that do not yet exist, make your own function if you want that simply array.add()'s if the array.size() < the member you want to edit (or so). |
Chompy helped me make it work. Just used new[]...although, for whatever reason new[] didn't work for me before, in the same exact script.
|
Quote:
But Vash, I would suggest what Inver told ya to do: Quote:
|
new[i] is such where i is the count, not an index.
It's kind of like doing: var.count() = i; Of course the syntax for that is completely wrong and such a thing is impossible. |
try databases serverr flags dont use arrays anyway http://graalonline.biz/images/smilies/frown.gif
|
Quote:
|
Quote:
inteereestiiinggggg But I already knew arrays worked in serverr flags anyways, they have for as long as I can remember. |
serverr flags should not be used, at all, there are bugs in the communication of them from server -> client.
The server seems to randomly forget to send some clients the updated variable, or forgets to send the variable period, which leads to some massive problems. |
Quote:
|
If you're on a populated server and change a serverr string a lot, and then have each player echo what they read it as each time it's changed, some of the players will eventually start echo'ing what an old string was, since the server didn't send them the updated string properly.
|
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 04:15 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.