Jump to content
  • 0

server_swapObject.sqf is acting funny


Sandbird

Question

Since the SteamID update i had to resolve to Arma2Net and redo all server_publish, and server_swapObject functions with it...in order to save the playerUID in the CharacterID cell instead of the characterID one. Why ? cause the hiveext.dll doesnt support bigint(24) values for CharacterID.

Anyways...I've been rewriting the server_swapObject.sqf and i noticed something REALLY WEIRD.

My hivewrite:

vgserver_hiveWrite = {
    private["_mykey","_mydata"];
    _mykey = _this;
    _mydata = format["Arma2NETMySQLCommand ['dayz',""%1""]",_mykey];
    SQL_RESULT = "Arma2Net.Unmanaged" callExtension _mydata;
};

While the sql in the server_publishObject.sqf works fine:

_keyobj = format["insert into object_data (ObjectUID, Instance, Classname, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Damage, Datestamp) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9', CURRENT_TIMESTAMP)",_uid,dayZ_instance,_class,_charID,_worldspace,_inventory,_hitpoints,_fuel,'0'];
//diag_log ("HIVE: WRITE: >>> Player Build <<<"+ str(_keyobj));
_keyobj call vgserver_hiveWrite;

The same SQL in server_swapObject.sqf,

_keyvg= format["insert into object_data (ObjectUID, Instance, Classname, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Damage, Datestamp) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9',CURRENT_TIMESTAMP)",_uid,dayZ_instance,_class,_characterID,_worldspace,_inventory,_hitpoints,_fuel,_damage];
diag_log ("HIVE: WRITE: >>>>>>>>> Player UPGRADED/DOWNGRADE <<<<<<<<<<<"+ str(_keyvg));
_keyvg call vgserver_hiveWrite;

although there is a proper mysql entry in arma2net log, it DOESNT get executed (or it does but epoch deletes the entry...i cant figure this out) and instead just the 1st object in the database gets deleted (as it should be since its deleting it and then creates and publishes the upgraded object).

 

No matter what i do, no matter how i tweak the SQL query, i cant get a 100% successful result.

Sometimes it upgrades the object and writes it in the db and sometimes it doesnt.

 

IF the object doesnt have a lock, then it will 90% work. If it does then i get about 50% chance the sql will get executed (like i said, not sure if it gets deleted by epoch after insertion....no logs no nadda).

 

I found a guy here: http://forums.dayzgame.com/index.php?/topic/163482-issue-with-door-locks-on-my-server/

That had the same problem....and he was also pointing to the same file....

Also i say that Plot for Life people experience the same difficulties ( i dont have that mod ).

 

Whats going on here ? Anyone knows ?

 

To test this i build a CinderWallDoor_DZ and change it to a CinderWallDoorLocked_DZ with a Lock....upgrading / downgrading it all the time and checking the db and logs to catch the error.

 

 

Is epoch (like server_monitor or something else) checking/deleting stuff and not post anything in the logs ?

Or simple for some FREAKING WEIRD reason arma2net is not getting executed ?

 

In the logs all looks fine :

10/17/2014 17:05:02 function: Arma2NETMySQLCommand ['dayz',"insert into object_data (ObjectUID, Instance, Classname, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Damage, Datestamp) values ('6035813732696','13','CinderWallDoorLocked_DZ','634','[96.4591,[6035.77,1373.21,-0.0568657]]','[]','[]','0','0',CURRENT_TIMESTAMP)"]
10/17/2014 17:05:02 maxResultSize: 10239
10/17/2014 17:05:02 Result size: 4
10/17/2014 17:05:02 Result: [[]]

but the object does not exist in the db....and if i manually execute this SQL it inserts fine.

 

ps: Same thing for downgrading objects.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

No, they are correct :P I am using same structure as the .dll

"INSERT INTO `"+_objTableName+"` (`ObjectUID`, `Instance`, `Classname`, `Damage`, `CharacterID`, `Worldspace`, `Inventory`, `Hitpoints`, `Fuel`, `Datestamp`) "
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)");

 

Notice the CURRENT_TIMESTAMP ? That's been sent instead of a value...so the db cell gets the current time.

So it should send 10 values but 9 of them are real arma values.

 

I kinda solved it with a hack....i am beta testing now and get 100% correct results.

I noticed in the past (dont remember in which function though), epoch was doing it also in an select query,.....they had a query run inside a for loop 8 times....I guess to make sure it gets the results.

So i did this:

- In the objects_data table i set the ObjectUID to UNIQUE

- And inside a loop i ran this sql:

_i = 0;
for "_i" from 0 to 5 do {
    "Arma2Net.Unmanaged" callExtension format["Arma2NETMySQLCommand ['dayz','INSERT INTO object_data (ObjectUID, Instance, Classname, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Damage, Datestamp) VALUES ('%1','%2','%3','%4','%5','%6','%7','%8','%9',CURRENT_TIMESTAMP)']",_uid,dayZ_instance,_class,_characterID,_worldspace,_inventory,_array,_fuel,_damage];
    sleep 0.1;
};

It works 100%....

 

I think this whole file 'breaks' due to the server_deleteObj function above the new insert.

It probably takes its sweet time to delete the object from the db, so when my sql query comes...it finds an object there...and doesnt execute.

I guess i could change the insert to update to test it better...but its 20:31 and i've been on this since 12:00...

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
  • Advertisement
  • Discord

×
×
  • Create New...