Jump to content

Rocu

Member
  • Posts

    337
  • Joined

  • Last visited

Posts posted by Rocu

  1. First one seems not to working, throws me out a "any" with dia_log _humanity

     

    So to get a bit more direct,

     

    I want to write a fix for the humanity duping with infistar 335, cause infistar seems not to send me the newest version i need to help my self :D

     

    In player_switchmodel i want to check for the humanity before its complete and get the humanity via the database and set it to the character after the humanity dupe happend.

     

    Mmm in that case yeah that might not work. I grabbed this snipped from a server side file.

  2. Should be pretty straight forward. For humanity I grabbed the first snipped I could find from the existing Epoch files and got something like this:

    _characterID = player getVariable ["CharacterID",0];
    _key = format["CHILD:102:%1:",_characterID];
    _primary = _key call server_hiveReadWrite;
    if (count _primary > 0) then {
    	if ((_primary select 0) == "ERROR") exitWith {
    		//Could not get data
    	};
    };
    _humanity =	_primary select 5;
    

    No idea if it works or not though, you're going to have to test it out. This particular call (102) also grabs data such as medical status, stats, state, worldspace etc. So I guess there's probably a more discrete way of doing this, but this should work just as fine.

     

    Though I don't see why you need to grab it straight from the database. Most basic info is available through variables:

    _humanity = player getVariable ["humanity",0];
    
  3. So you just chuck that in the query and it just continues as a event?

    I suck with the database stuff :P

     

    >.< As I said like 3 posts above, you need to actually make it to an event first. That code he provided is the code that is supposed to execute every X day. It isn't the code that makes the "execute every X day" thing happen. Capiche?

     

    If you don't know how to make an event, use this code instead:

    DROP EVENT IF EXISTS unlockUnusedVehicles;
    CREATE EVENT unlockUnusedVehicles
        ON SCHEDULE EVERY 4 HOUR
        COMMENT 'Unlocks any vehicle that has not been touched for 5 days'
        DO
    		UPDATE `object_data`
    		SET `CharacterID` = 0
    		WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 DAY)
    		AND `CharacterID` > 0
    		AND `Classname`
    		NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest';
    ;
    

    Now THIS is the code you can just chuck in the query and it starts looping itself every 5 days. (Haven't tested, but should work)

  4. Did you merge the files or overwrite them?

    If you merged, make sure you have this in your init.sqf:

    DZE_ConfigTrader = true;
    

    You don't need to match config file with the database. That's what that line above is for. It tells the mod to use traders from config files INSTEAD of database.

    You need to match trader ID's with the ones in config files. But first make sure you have that DZE_ConfigTrader thing.

    If you do, here's a quick guide to match up your TIDs: 

  5. As referenced here: 

     

    You have a little snippet in trade_metals that doesn't seem to belong there:

    _cid =	player getVariable ["CharacterID","0"];
    _headShotsZupa = player getVariable ["headShots",0];
    _key = format["CHILD:999:UPDATE `character_data` SET `HeadshotsZ` = %1 WHERE `CharacterID` = %2:[0]:",_headShotsZupa,_cid];
    _result = _key call server_hiveReadWrite;
    

    Just letting you know.

  6.  

    Mite be completely irrelevant but why does this look like it shouldn't be there? I mean if its CashMoney with Souls version shouldn't that say something different? its in the trade_metals file

    _cid =	player getVariable ["CharacterID","0"];
    _headShotsZupa = player getVariable ["headShots",0];
    _key = format["CHILD:999:UPDATE `character_data` SET `HeadshotsZ` = %1 WHERE `CharacterID` = %2:[0]:",_headShotsZupa,_cid];
    _result = _key call server_hiveReadWrite;
    

     

    If you're using Soul's DLL you shouldn't have that code there at all. So yeah, you're right, it shouldn't be there. This is a code from version 1.1. Seems like you've skipped some files when updating.

  7. will that always work or do I have to run the event every day ??

    shouldn't it be a drop event ?

    im asking since I still dont understand sql stuff too well 

    I just run that as a query and its there forever ?

     

    This is the execution code for event. If you run this code now it will just run once. You need to make an event separately for this to keep running.

     

    Edit// In other words, this should be the correct code for making it an actual event:

    DROP EVENT IF EXISTS unlockUnusedVehicles;
    CREATE EVENT unlockUnusedVehicles
        ON SCHEDULE EVERY 4 HOUR
        COMMENT 'Unlocks any vehicle that has not been touched for 5 days'
        DO
          UPDATE `object_data` SET CharacterID = 0 WHERE LastUpdated < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 DAY) AND CharacterID > 0 AND Classname NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage','Wooden_shed_DZ','GunRack_DZ','WoodCrate_DZ') AND Inventory <> '[]' AND Inventory IS NOT NULL;
    ;
    
    
  8. Im using the DLL's included in the download for SC ver 1 and 1.1, + the HiveExt from the link in the post. And i already tried the other guys 2.0 version. Can you tell me where to download this stuff because i tried absolutely every possible thing there is. So do i just download it from this post? And do i use the DLL's in this post? Or do i download the ones from the post's link? Just what dll's should i use? Thats the question.

     

    You download 1.1 files from this topic (Zupa's GitHub). For 2.0 you download them from Soul's GitHub. Are you sure the DLL's are in the correct place? Are you renting the server, home-hosting or just running a dev server on your local machine? Though it looks like Zupa's working on a new version at the moment so if you can't get this working you can wait for the new one.

  9. Can i ask permission to completely edit this script to work with config traders and single currency?

     

    i estimate the following:

     

    Changing arround 50% of the code.

    No more configuration on items needed.

    Supports all traders automaticly

     

    Damn you Zupa, you beat me to it :D . I literally asked the same thing from Csus not 1 week ago. And by the looks of your beta image it's very identical to the one I had in mind.

    Guess I won't bother with it then. Good luck :)

  10. acts like its working but I get no money...

    same thing with the smelting system I added..

    is there some way I need to link to database for money to get updated in database.

    i am new to this coin  system. I just added Zupa's  and thats it.

    what is Soul's &do=embed' frameborder='0' data-embedContent>  ?????  is this what I need to install to get  money to goto my bank ? or even wallet..

    I sold a car I get 10000 coins I deposite it just fine.

    but anything that I try to add more coins like this script or smelting I get nothing..

     

    As the OP states:

     

    What do I need for this addon?

    • Zupa's  + Soul's 

     

    Yes, calamity, that is something that you need to install for this to work. As it says in the requirements. 

    Confused what this is? Well worry no more friend, we have an explanation for you: 

     

    Scripts designed for v1.1 Single Currency only work on that version. Scripts designed for Soul's v2.0 Single Currency only work on that version. So before you install a script you have to actually make sure you have the right version. Scripts can be easily converted from v1.1 to v2.0 though so it's not a big deal. But they do NOT work if you mix up your versions.

  11. In addition, can it be realized to show those modified trader prices at the traders, when you querry the variable just when buying/selling or is it better to show the extra percentages somehow in the trader menu without displaying changed prices?

     

    Yes it can. I think it's better if you actually modify the price itself. Otherwise players probably wont notice the percentage and get pissed when they see they got charged more.

     

    It's an interesting concept you have here though. Might implement this on my server as well. Would be nice to actually have this working like a real economy though - price drops when people are selling in bulk, etc. But I think that's a little too ambitious and not very practical considering the coding behind this.

     

    At the moment I don't have the time to code this myself (maybe in a few days) but if you manage to get this done and are kind enough to share then definitely let me know.

  12. A while ago I asked Defent's permission to make a completely new version of his PHP killfeed script. He gave me the permission. I almost completed it but other important things got in the way and I haven't been able to come back to the script ever since. It is working perfectly as it should but it's lacking some features I was planning to make. So anyway, I'm releasing it pre-maturely in this topic instead of making it a new release (since it's not as complete as I would like it to be).

     

    Download files here!

     

    Installation is quite simple. Open up killfeed.php and at the top of the file there are configuration variables that you need to change. After you're done, save the file and place all files anywhere on your web server and access killfeed.php from your browser. Note! There is only 1 difficulty with this though. The PHP files and the RPT log file must be in the same server. So for people with rented hosting this might be difficult. 

     

    You can see the script running here: http://dayz.kriba.ee/ (scroll down, under shoutbox)

    For this particular example I have Overpoch and the PHP files running on the same server but the website (dayz.kriba.ee) is on a different server. So I installed WAMP on my Overpoch server and made killfeed.php publicly available via http. Then I added a simple iframe script on my website's server like so: 

    <iframe src="http://your_servers_ip/killfeed.php" style="border: 0px" width="940px" height="150"></iframe>
    

    So what is this script? It's just more-complex and much more easy to customize. It has more features and is more bulletproof. With Defent's original version I found that if you have a killfeed message like so:

     

    [time] Player1 killed Player2 with weapon DMR from distance 100 meters.

     

    And if, for example, Player2 would change his name to something like "with weapon DMR" all sorts of crap would go down. This is fixed now as long as the server doesn't allow quotation marks in player's name.

    Some other features include:

    • Fully customizable killfeed string: [%time] <b>%victim</b> was killed by <b>%killer</b> with weapon <b>%weapon</b> from distance <b>%distance</b> meters.
    • Limit the number of lines displayed
    • Hide/show suicides
    • Round up the distance number, so you don't get 100.3423432 meters
    • Switch time between AM/PM and 24-hour format
    • You can remove "seconds" from time
    • And last but not least - replaces all class names with real names (e.g Mk_48_DZ = Mk 48 mod 0) and yes, it does include Overwatch weapons

     

    One thing I should note though. The class name list doesn't have ALL weapons. There are probably some still missing. Some might not be 100% accurate as well. For example "M240_Scoped_DZ" might actually not be "M240 Scoped", instead just "M240". I grabbed as many weapons class name lists from the interwebs as I could.

     

    Adding new class names for replacement is very simple. Open up killfeed_weapon_classnames.php and killfeed_weapon_cleannames.php and just add a new variable at the bottom of the file (before PHP's closing brackets ?> of course). But make sure the line numbers match up from class names file and clean names file. Otherwise it replaces the weapon's name with something else. Also remember not to add any quotation marks (") in the clean names.

     

    killfeednames.jpg

     

    (Line numbers must match)

     

     

    Originally I had lots of plans for this script like replacing the gun names with actual images, showing how many bullets it took to kill the victim, generating statistics on who kills who the most, etc etc. I also wanted to include theballin7's DLL for this script instead of using the RPT log file but he never responed to my letters so I went with the log file.

     

     

    Edit// For all of you code-wizards out there who just want to see the code, here's the main file killfeed.php:

    <?php
    // Configuration
    // Note! Do not use actual quotation marks (") when writing values "true" or "false"
    // This is correct: $conf_time_pm = true;
    // This is not correct: $conf_time_pm = "true";
    $conf_rpt_location = "C:\Program Files (x86)\Steam\SteamApps\common\Arma 2 Operation Arrowhead\instance_11_Chernarus\arma2oaserver.RPT"; // Server's RPT log file location. Usually in the folder I have as an example
    $conf_max_lines = 30;					// Maximum amount of feed displayed. "False" - limitless
    $conf_distance_round = 2;				// Number of digits after distance's decimal point (e.g. $conf_distance_round = 2; would make the distance number look like: 530.62 meters)
    $conf_time_pm = false;					// Timestamp format. "True" = AM/PM format. "False" = 24-hour format
    $conf_time_seconds = true;				// Keep seconds in timestamp? "True" keeps seconds in timestamp. "False" = removes seconds from timestamp
    $conf_skip_suicides = true;				// Skip suicides? "True" = skips all suicides. "False" = doesn't skip suicides
    $conf_replace_classnames = true;		// Replace weapon class names with normal names? "True" = replaces class names. "False" = doesn't replace class names
    
    $conf_str_unknown = "unknown"; // Word for missing data. Ex: "Rocu was killed by unknown."
    
    $conf_str_kill = '[%time] <b>%victim</b> was killed by <b>%killer</b> with weapon <b>%weapon</b> from distance <b>%distance</b> meters.'; // Fully customizable kill string, edit/leave parts out if you wish
    		// %time 		- time, when the event happened
    		// %victim		- person, who got killed
    		// %killer 		- person, who killed the victim
    		// %weapon	- weapon, that the killer used
    		// %distance	- distance between killer and victim (meters)
    		
    $conf_str_suicide = '[%time] %victim killed himself.'; // Fully customizable suicide string
    		// %time 		- time, when the event happened
    		// %victim		- person, who died
    		
    // Configuration end, do not edit anything beyond this point
    ?>
    <html>
    <head>
    <title>DayZ Killfeed</title>
    <style>
    * {
    	font-family: Calibri;
    	font-size: 12px;
    }
    </style>
    </head>
    <body>
    
    <a href="javascript:location.reload(true)">Refresh killfeed</a><br />
    
    <?php
    if (!file_exists($conf_rpt_location)) {
    	exit("ERROR: Invalid RPT log file (doesn't exist)");
    }
    
    $input = array_reverse(file($conf_rpt_location),1);
    
    function sprintf2($str='', $vars=array(), $char='%')
    {
    	if (!$str) return '';
    	if (count($vars) > 0)
    	{
    		foreach ($vars as $k => $v)
    		{
    			$str = str_replace($char . $k, $v, $str);
    		}
    	}
    	return $str;
    }
    
    function cleanData($arr=array(), $data_type='suicide', $unknown_msg) {
    	foreach ($arr as $key => $value) {
    		if (is_int($key)) {
    			unset($arr[$key]); continue;
    		}
    		$arr[$key] = str_replace('"','',$value);
    	}
    	
    	$keycount=0;
    	$loopcount=0;
    	
    	if ($data_type == 'suicide') {
    		$data_keys = array('time','victim');
    	} elseif ($data_type == 'kill') {
    		$data_keys = array('time','victim','killer','weapon','distance');
    	} else {
    		return $arr;
    	}
    	
    	foreach ($arr as $key => $value) {
    		$loopcount++;
    		if (in_array($key, $data_keys)) {
    			foreach ($data_keys as $key_dk => $value_dk) {
    				if ($value_dk == $key) { 
    					unset($data_keys[$key_dk]); 
    					$keycount++; 
    					// If empty value, insert unknown string
    					if (empty(trim($value))) { $arr[$key] = $unknown_msg; }
    					break;
    				}
    			}
    		}
    		if ($keycount < 5 && $loopcount >= count($arr)) {
    			foreach ($data_keys as $value_dk) {
    				// If missing key, insert key with unknown key as value
    				$arr[$value_dk] = $unknown_msg;
    			}
    		}
    	}
    	
    	return $arr;
    }
    
    
    
    $i=0;
    foreach ($input as $line)
    {
    	if(strpos($line, "PKILL:") != false)
    	{
    		$line = str_replace(' ', '" "', trim($line));
    		// Fool-proof quote system to prevent abusers from trying to exploit the string-processing regular expression
    		
    		if (preg_match('/(?P<time>.*)" ""PKILL:" "(?P<victim>.*)" "killed" "(him|her)self"/', $line, $data)) 
    		{
    			// Player killed by zombies/suicide
    			if ($conf_skip_suicides === true) { $is_suicide = true; continue; }
    			
    			$line_type = 'suicide';
    			$data = cleanData($data,$line_type,$conf_str_unknown);
    			if (count($data) < 2) {continue;}
    			
    			$line_string = $conf_str_suicide;
    			$line_varlist = array(
    				'time' => $data['time'],
    				'victim' => $data['victim']
    			);
    		}
    		elseif (preg_match('/(?P<time>.*)" ""PKILL:" "(?P<victim>.*)" "was" "killed" "by" "(?P<killer>.*)" "with" "weapon" "(?P<weapon>.*)" "from" "(?P<distance>.*)m"/', $line, $data)) 
    		{
    			// Player killed by another player
    			
    			$line_type = 'kill';
    			$data = cleanData($data,$line_type,$conf_str_unknown);
    			if (count($data) < 5) {continue;}
    			
    			$line_string = $conf_str_kill;
    			$line_varlist = array(
    				'time' => $data['time'],
    				'victim' => $data['victim'],
    				'killer' => $data['killer'],
    				'weapon' => $data['weapon'],
    				'distance' => $data['distance']
    			);
    		} else {
    			continue;
    		}
    		
    		// Round to 1 decimal point
    		$line_varlist['distance'] = round($line_varlist['distance'], $conf_distance_round);
    		
    		// Add the missing 0 which the log doesn't seem to do
    		$line_varlist['time'] = str_pad($line_varlist['time'], 8, '0', STR_PAD_LEFT);
    		
    		if ($conf_time_pm === true) {
    			$line_varlist['time'] = date("h:i:s a", strtotime($line_varlist['time']));
    		}
    		
    		if ($conf_time_seconds === false) {
    			$line_varlist['time'] = substr_replace($line_varlist['time'], '', 5, 3);
    		}
    		
    		if ($conf_replace_classnames === true && $line_type == 'kill') {
    			include("killfeed_weapon_classnames.php");
    			include("killfeed_weapon_cleannames.php");
    			$swap_key = array_search($line_varlist['weapon'], $wcn);
    			if($swap_key != false) { $line_varlist['weapon'] = $wn[$swap_key]; }
    		}
    		
    		echo sprintf2($line_string, $line_varlist);
    		echo "<br />";
    		
    		$i++;
    		if ($conf_max_lines != false) {
    			if (is_numeric($conf_max_lines) && $i >= $conf_max_lines) {
    				break;
    			}
    		}
    	}
    }
    
    if ($i < 1) {
    	echo 'No killfeed available yet';
    }
    ?>
    
    <!-- Y u eyeballin my source? -->
    <!-- From Rocu with love :3 -->
    
    </body>
    </html> 

×
×
  • Create New...