dev

textPage 34 of 208
50 messages on this page
Tuesday, August 10, 2021
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
So weird
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
and I see the same that youre saying
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
I'm looking at allocs code
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Yeh
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
but could be changed
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
still cant imagine that happening so often
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
its an upload of the players ttp file basically
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
that /used/ to run a lot slower
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
O damn that GIF is laggy lol
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
bwoah
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
So there's a few blocks diff but that's cause there's a few s diff between both calls
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
top pos is getplayersonline, bottom is getplayerlist
Peek_2021-08-10_12-01.gif

Peek_2021-08-10_12-01.gif

GIF β€’ 20.0 MB

Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
public void SavePlayerData (ClientInfo _cInfo, PlayerDataFile _playerDataFile) {
try {
PersistentContainer.Instance.Players [_cInfo.playerId, true].Update (_playerDataFile);
} catch (Exception e) {
Log.Out ("Error in GM_SavePlayerData: " + e);
}
}
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
and the persistent data update is tied to the saveplayerdata api
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
ingame online players dict
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
foreach (KeyValuePair<int, EntityPlayer> current in w.Players.dict) {
ClientInfo ci = ConnectionManager.Instance.Clients.ForEntityId (current.Key);
Player player = PersistentContainer.Instance.Players [ci.playerId, false];
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
getplayeronline=
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
allocs data
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
foreach (KeyValuePair<string, Player> kvp in playersList.Dict) {
Player p = kvp.Value;
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
Players playersList = PersistentContainer.Instance.Players;
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
playerlist=
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
*imagine
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
i cant image thats in sync all the time
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
I was just flying around, not dying
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Not even
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
would be great
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
maybe a death triggers a sync
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
on every playerdatafile sync
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Ahh somethings weird then
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Cause in the little test script I did, both calls did the same position
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
prox every 30 secs
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
When does allocs persistent data get updated?
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
getplayersonline uses the current online players so is realtime
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
so not realtime data
Avatar for a506fee3140c1a9cb5f83c4671951bd488e90ca6dc0482bf1cbc5478a2f8fa6e
User a506fe
playerlist uses allocs persistent data
Avatar for eca9c03b387d8b34a7734a15cfcbf357a8717a0281f3b50a255a3b48877fbb50
User eca9c0
That would be fun on a drop on death server πŸ˜‚
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Lmao XD
Avatar for e5e1a1e030d906e6b0758aa714298a47ac1eb96bd571c5acc968a191bb9574fb
User e5e1a1
/bag as in tea
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
I died a LOT of times and this seems to work as expected ^^
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
And accompanying custom command ofcourse:
unknown.png

unknown.png

PNG β€’ 21.2 KB

Avatar for e5e1a1e030d906e6b0758aa714298a47ac1eb96bd571c5acc968a191bb9574fb
User e5e1a1
πŸ˜‚
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
πŸ˜„
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
No content
unknown.png

unknown.png

PNG β€’ 13.2 KB

Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
No content
unknown.png

unknown.png

PNG β€’ 10.3 KB

Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
If I'm not missing something big here, this makes my life easier as I can reuse the old logic πŸ˜„
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
With 1-2 blocks difference but that's probably cause I'm flying and there's some delay between both calls
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
/tmp cat test.sh     
#!/bin/bash

curl -L 'https://7d2d.csmm.app/api/getplayersonline?adminuser=csmm&admintoken=aaa' | jq .[].position
curl -L 'https://7d2d.csmm.app/api/getplayerlist?adminuser=csmm&admintoken=aaa' | jq .players[].position
Tested like this, seems like both calls get the same location data back
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Whatever is triggering it
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
I think the persistent data is updating in time
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Hey @User 36612002 what was the diff between getplayersonline and getplayerlist again?
I remember I was supposed to use getplayersonline to make sure the latest position is recorded but I'm doing both requests at the same time and both return correct locations