Jump to content
  • 0

Sending the changed value of humanity to the database when a player dies.


kenguru74

Question

Greetings surviving!

Please help me figure out - during what moment and in what form should be sent the values ​​of humanity reduced to the database when a player dies?

A few months trying to do it all to no avail.

I tried to make it through the client and on the server side, the level of humanity is reduced, but not saved. Tried several hundreds of options, but my ignorance scripting leads to the same result - the database changed values ​​are not entered. Now suppose that all the records in the database are terminated when a player dies.

Help properly query the database if the player alive in sync player on the server (in the file "server_playerSync.sqf" ?) and write the new value to humanity if the player was not alive.

My last attempt to send data to humanity in the file "server_playerDied.sqf" looks like this:

 

if (_characterID != "0") then {

_key = format["CHILD:202:%1:%2:%3:",_characterID,_minutes,_infected];
#ifdef DZE_SERVER_DEBUG_HIVE
diag_log ("HIVE: WRITE: "+ str(_key));
#endif
_key call server_hiveWrite;
 
_previoushumanity = ["humanity",_victim] call server_getDiff2;
_humanity = (_previoushumanity - 500);
_key = format["CHILD:102:%1:",_humanity];
_key call server_hiveWrite;
} else {
deleteVehicle _newObject;
};

Will be eternally grateful for any help! Thanks in advance!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

It's something i want to do on my server but have not looked into yet. If you manage to sort it out I'll be intrested

If I succeed - necessarily share experiences. I do not mind, unlike many..  ;)

 

Sorry, no scripting help here, but a comment:

 

On our servers players are typically going bandit and value their negative humanity a lot, so in order to punish dying you perhaps should increase humanity if <0 and decrease if >0.

Thanks for the comment, but on my servers bandits only bots. The player with the negative level of humanity is an outcast and has no capacity to trade.
Maybe later I will stimulate PvP component of the game, increasing the humanity for the killing of the enemy. Maybe. But now in the priority punishment for clumsy game.
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...