Home   Help Search Login Register  

Author Topic: How do servers save players info for games like Sahrani life and evolution?  (Read 10219 times)

0 Members and 2 Guests are viewing this topic.

Offline ModestNovice

  • Members
  • *
Yes, but you motivated me to make my own Spooner, and all though I am not the best, I fell in love with creating my own mission/scripts. I thank all of you, especially Spooner and Myke, for helping me so much, and giving me the confidence to actually start this stuff myself. I appreciate you guys not tossing me in the dirt, and telling me to keep at it! Cuz it truly does pay-off :)

Thank you guys.


And Mr.Peanut, can ya send me a version of it? Thats all I am looking to do, I just want to keep what happened in the mission as it is playing, a restart is a chance for the admin to clear out the chaos.
But really, I don't think every transfer is required. Its more of, with my transfers it adds to ur inventory array, so basically, maybe as you disconnect, or maybe a trigger to save ur stats, so ya hit it just before you leave and it stores you vehicles (an array), your money (two variables) and items are not to important as they are cheap and available everywhere, but I think the most important thing to everyone is keeping your money because it takes so long to build it up ;)


Thanks a bunch for your work on this Mr.Peanut :)
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Took an hour to install the ArmA server on my laptop today. So many damn patches...  :blink:
Anyhow, tried testing what I had(I forgot how much it sucks to MP test.. yuk....) and it did not work very well. I had read on the 6th sense MP wiki that onPlayerDisconnected fires(on the server) for each player in turn at the very start of the mission. This does not seem to be the case in my tests today. Back to the drawing board!
« Last Edit: 09 Sep 2008, 14:49:14 by Mr.Peanut »
urp!

Offline ModestNovice

  • Members
  • *
ugh, thts wierd.


Well, how bout scrap the onPlayerDisconnected and just have it saves stats every 5 mins or user generated (ie the trigger)?
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Well, I am really losing my mind. I have attached a demo. Everything seems like it should be so straight forward...  :blink:

What is happening is that the players are not being assigned the default values when they connect SMB_PDSL_fOnPlayerConnected.  Shortly after each player joins or leaves, a hint pops up and shows the player data being saved is "[string]", so whatever I am doing wrong is assigning a null string to the player data array. In the demo there are 3 player slots,and each player's data should be stored in arrays SMB_PDSL_DATA_x where x is 0,1, or 2, depending on the slot.  There are three radio triggers each of which should display the master name list(which they do) and the data array for a slot. This does not work either.

Any help would be appreciated. I am missing something fundamental ...

« Last Edit: 10 Sep 2008, 02:51:32 by Mr.Peanut »
urp!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
In the init file, you do:
Code: [Select]
if (not isNull player) then
But although this is true in SP and hosted MP at the start of the mission, it is false in dedicated clients until they have properly synced (it is actually also initially false on hosted MP if you are running from an addon, so bear that in mind). You probably want to do something like this:
Code: [Select]
[] spawn
{
    if (not server) then { waitUntil { alive player } }; // If not the server, you must be dedicated client, so wait for sync.
    if (not isNull player) then
    { ... }
};

Doing things like this:
Code: [Select]
call compile SMB_PDSL_PREFIX + str(SMB_PDSL_playerIndex) + " = SMB_PDSL_DEFAULTS;";
Will actually be parsed as if it were:
Code: [Select]
(call (compile SMB_PDSL_PREFIX)) + (str SMB_PDSL_playerIndex) + " = SMB_PDSL_DEFAULTS;";
So make use of brackets to make it clear to the interpreter what you actually mean ("str(SMB_PDSL_playerIndex)", "str SMB_PDSL_playerIndex" and "(str SMB_PDSL_playerIndex)" are all exactly equivalent, since commands bind very high, so use the one you like best):
Code: [Select]
call compile (SMB_PDSL_PREFIX + str SMB_PDSL_playerIndex + " = SMB_PDSL_DEFAULTS;");

Anyway, some food for thought for you to be getting on with...As far as I looked (just in the init file).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Thanks. I will test those suggestions. One of the things that drives me crazy about the BI interpreter is that its parsing rules for left to right or right to left are not clear. Not clear or consistent to me anyways. When I first started with OFP I used excessive parenthesis so I would not have to worry about it, but that can also lead to ugly illegible code, so I have been trying to pare down.
urp!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
It is not the right-to-left-ness that is at issue. It is that all commands have a very high precedence, higher than operators like +, etc. Maybe I should compile a proper precedence list to make things clearer, though unless you understand the concept of operator precedence, which most people don't, I can't see it being too helpful.

I think this precedence issue this is one reason most people prefer format over + for concatenating strings ;P
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Quote
It is not the right-to-left-ness that is at issue. It is that all commands have a very high precedence
Ah you computer science types and your fancy talk! Just wait, some day you will be trying to do work in physical oceanography and I will have the last laugh!

Code: [Select]
0.5 + _myArrayofScalars select 0
Code: [Select]
_myArrayofScalars select 0 + 0.5
urp!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
OK, select has a lower precedence than +, so not all commands have higher precedence than mathematical operators (this whole argument is off-topic ;P).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Not an argument(is there a pun in there somewhere), a discussion.

Thanks for sorting me with the call compile and concatenation. I would otherwise have lost interest in continuing. Also thanks for the isNull player warning. I miss the days when JIP was but a misspelling of a slang verb arisen from bigotry and racism.
urp!