Jump to content
  • 0

how to get player generation on login


hambeast

Question

I am looking at the player_login.sqf and I want to give a custom inventory to players with a generation higher or lower than x.  In this case, I want to give players who have been on the server for a while a backpack.

 

I can handle the logic of the inventory, I just need to know how to get the generation number of the player.

 

 

Thanks

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

I'm not sure why you'd want to use the sqf file. Epoch load outs works perfectly fine through the database, at least for me. 

 

Anyway, this seems quite easy in theory. You get a certain time, anything greater than, equal to or less than Xtime = the items. 

 

From what I gather, you can get Generation (The same that you speak of?) from the Character_DATA table under the Generation value. 
I believe the Generation value is actually how many times you've died, re spawned or w/e. 
But I know that there is a way to count how many days you've been alive, though I don't remember what table is is that does this (or value).

update Character_DATA SET Backpack='["DZ_Backpack_EP1",[[],[]],[[],[]]]' WHERE Generation => 1

This will most likely not work, however it's a general concept of how it's structured. This will however not become a load out, but you could create an even that does this every now and then.

It becomes a lot more complicated if you want check for x in one table and then set y in another table depending on x's value. I will have to check up on this, I'll report back if I find out how.

Link to comment
Share on other sites

  • 0

I'm not sure why you'd want to use the sqf file. Epoch load outs works perfectly fine through the database, at least for me. 

 

Anyway, this seems quite easy in theory. You get a certain time, anything greater than, equal to or less than Xtime = the items. 

 

From what I gather, you can get Generation (The same that you speak of?) from the Character_DATA table under the Generation value. 

update Character_DATA SET Backpack='["DZ_Backpack_EP1",[[],[]],[[],[]]]' WHERE Generation => 1

This will most likely not work, however it's a general concept of how it's structured. This will however not become a load out, but you could create an even that does this every now and then.

 

 

The reason I want to do this in the SQF is so that I can spawn the player in with that item vs having them log out and back in.  I know how to use SQL to do this but I want to do it thru arma2

Link to comment
Share on other sites

  • 0

The reason I want to do this in the SQF is so that I can spawn the player in with that item vs having them log out and back in.  I know how to use SQL to do this but I want to do it thru arma2

 

Fair enough. For this I think you could use the dayz_skilllevel (or (dayz_Survived)) function, I'm not 100% sure, but this is the function used when counting how long you've been alive in the debug monitor and tame dog function. I'm no master in sqf sadly. 

private ["_potatoe"];
_potatoe = (dayz_Survived => 4);
  if(!_potatoe) then { 

load out stuff here (function to loadout function inside server_playerlogin.sqf?) 
or perhaps server_hiveWrite with a child key format or W/e
}

Perhaps something in the lines of this?

Link to comment
Share on other sites

  • 0

Fair enough. For this I think you could use the dayz_skilllevel (or (dayz_Survived)) function, I'm not 100% sure, but this is the function used when counting how long you've been alive in the debug monitor and tame dog function. I'm no master in sqf sadly. 

private ["_potatoe"];
_potatoe = (dayz_Survived => 4);
  if(!_potatoe) then { 

load out stuff here (function to loadout function inside server_playerlogin.sqf?) 
or perhaps server_hiveWrite with a child key format or W/e
}

Perhaps something in the lines of this?

 

This looks promising.  I am looking for the number of deaths for this though, as this number resets on the next player spawn.

 

I think I can get the value from this but its a shot in the dark

 

_generation = (player getVariable['generation', 0]);

Link to comment
Share on other sites

  • 0

I took a look at the hive dll source and it looks like I need to call child:102.  If anyone has any other ideas how to do this from the server pbo let me know

 

edit:  Looking at the source code again, I'm seeing that the child:102 call returns everything but the generation...

Link to comment
Share on other sites

  • 0

you're correct.  I had to work around this issue by using a custom db dll so I can query the server.

That sucks, I think I have to do that too in my next script :/

Do you know where to find the original source of the HiveExt.dll epoch is using? The code is not in the GitHub repository but i am sure it had to be changed for epoch.. 

Link to comment
Share on other sites

  • 0

That sucks, I think I have to do that too in my next script :/

Do you know where to find the original source of the HiveExt.dll epoch is using? The code is not in the GitHub repository but i am sure it had to be changed for epoch.. 

 

I hired a developer to integrate a seperate mysql dll into arma2.  Was a bit of a pain to get set up but it works flawlessly and I don't have to use child calls.

 

Here is a branch I made of the hive dll source code for epoch:

https://github.com/deadfred666/DayZhiveEpoch

Link to comment
Share on other sites

  • 0

Ah thanks, I also found the original repository here https://github.com/vbawol/DayZhiveEpoch (I did not thought about a different repo and was just looking in the default Epoch one haha)

But why did you not just add some CHILD calls to the HiceExt that would be easier instead of a separate MySQL connection.. the HiveExt might not be perfect but it works and is quite secure, the "CHILD" calls are there for a reason..

Link to comment
Share on other sites

  • 0

Ah thanks, I also found the original repository here https://github.com/vbawol/DayZhiveEpoch (I did not thought about a different repo and was just looking in the default Epoch one haha)

But why did you not just add some CHILD calls to the HiceExt that would be easier instead of a separate MySQL connection.. the HiveExt might not be perfect but it works and is quite secure, the "CHILD" calls are there for a reason..

I don't have a copy of vs2010 and it was a quick $25 to get someone else to integrate it for me.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...