Store Killer `unique_id` in the SQL database

Fentus

Member
I am trying to find out how to tell my server to store who killed a player, by storing the killers `unique_id` something similar to this. I am using Dayz.st with server version 1.7.7.1

Code:
UPDATE `bliss_1234`.`survivor` SET `killer_unique_id`='killer_unique_id' WHERE `unique_id`='victim_unique_id';

Please only post if you can help me with this, thank you!
 
I am sure this little bit of code here could help. It only needs to be put in the datebase after this is installed. I have no idea how to connect to a database with the scripting engine and update a sql entry though.
http://opendayz.net/threads/pulling-data-from-sql-table-in-script.10052/
http://dayz.st/w/Kill_Messages
dayz.jpg

the image is just for clarification
 
Okay, so this is what I came up with... and I need some help.

Install this 1st: http://dayz.st/w/Kill_Messages

Right after this bit of code:
Code:
_loc_message = format["PKILL: %1 (%5) was killed by %2 (%6) with weapon %3 from %4m", _victimName, _killerName, _weapon, _distance, _playerID,        _killerPlayerID];

I put this in:
Code:
_key = format["CHILD:999:UPDATE `survivor` SET `killer_unique_id` = '%1' WHERE `id` = '%2'",_killerPlayerID,_characterID];
        _key call server_hiveWrite;

I cant get it to update correctly I have tried soooooooo many different things with the syntax and I still can't get it to work...

Thank you if you have the answer!
 
This was suggested by someone on another site.
Code:
_key = format["CHILD:999:UPDATE `survivor` SET `killer_unique_id` = '?' WHERE `id` = '?':[%1,%2]:",_killerPlayerID,_characterID];
_key call server_hiveReadWrite;

Still no luck :C What am I doing wrong?
 
I had some issues with getting the script to read variables put in the :[...]: part of the key on my lan server. The database apparently requires a value there, even if it's nothing. Try this (if you haven't already):

Code:
_key = format["CHILD:999:update `survivor` set `killer_unique_id` = '%1' where `id` = '%2':[0]:",_killerPlayerID,_characterID];

EDIT: Also, you may not need the ' ' around the _characterID variable (I don't remember why, it's just the way my scripts were set up... I'm sure I had a good reason for doing it that way)
 
I figured it out! It took a few more attempts after I got some much needed rest, Ill create a tutorial for you after I've done some more testing and added a few more features.

Code:
_key = format ["CHILD:999:UPDATE `survivor` SET `killer_unique_id` = '%1' WHERE `id` = '?':[%2]:", _killerPlayerID, _characterID];
        _key call server_hiveWrite;

If you need help add me on steam, my name is 'Fentus'.
 
Nice! No need to on my behalf, I've been running something like this for a while, but I'm sure a lot of modders would be grateful for a tutorial (if you meant me). With access to the database, there are very few limits on what you can add to the mod.
 
Step #1:
Follow this tut to to word: http://dayz.st/w/Kill_Messages

Step #2:
Connect to the database and alter the survivor table with this SQL Query.
Code:
ALTER TABLE `survivor` ADD `killer_unique_id` VARCHAR(128)

Step #3:
Open you're "server_playerDied.sqf" find this line of code:
Code:
_loc_message = format["PKILL: %1 (%5) was killed by %2 (%6) with weapon %3 from %4m", _victimName, _killerName, _weapon, _distance, _playerID,        _killerPlayerID];
and insert this right below that:
Code:
_key = format ["CHILD:999:UPDATE `survivor` SET `killer_unique_id` = '%1' WHERE `id` = '?':[%2]:", _killerPlayerID, _characterID];
_key call server_hiveWrite;

Step #4: Give me rep and come join us on our server:
192.31.185.216:3238



EDIT:
Works with 1.8 also!
 
Back
Top