Cerber0s simple reason why I have a [/url] in mine is because I'm idiot and did not notice the typo
It should be "uploadpage": "h**p://fps101.com/stats/receive/deathmessages.php",
Death Messages [Abandoned]
Discussion in 'Plugin Support' started by Reneb, Oct 22, 2014.
-
I had a player who had an '%' in their name and it caused the 'Invalid use of % in replacement string' error because, of course '%' is an escape character in Lua. I tried changing the BuildDeathMessage function, but I'm not sure if this will do the trick.
I'm not sure exactly where the error was thrown, so I'm attempting to gsub it after the string is built in the hopes that the error was thrown when it attempts to print or broadcast the message. If it was thrown in the for loop, then this wouldn't work of course.
Code:function PLUGIN:BuildDeathMessage(tags, str) if(not str) then print("Error while making Death message for " .. tags.killer) return end local customMessage = str for k, v in pairs(tags) do customMessage = string.gsub(customMessage, "@{".. k .. "-}", v ) end customMessage = customMessage:gsub("%%", "%%%%") print(customMessage) if(self.Config.Settings.mysql) then self:SendToMysql(tags) end global.ConsoleSystem.Broadcast("chat.add \"" .. self.Config.ChatName .. "\" \"" .. customMessage .. "\"") end
-
Code:for k, v in pairs(tags) do v:gsub("%%", "%%%%") customMessage = string.gsub(customMessage, "@{".. k .. "-}", v ) end
-
-
-
Code:for k, v in pairs(tags) do v:gsub("%%", "%%%%") :gsub("\\", "\\\\") customMessage = string.gsub(customMessage, "@{".. k .. "-}", v ) end
OH! I also just remembered I had an issue with quotes in character names too. So to go even further...
Code:for k, v in pairs(tags) do v:gsub("%%", "%%%%") :gsub("\\", "\\\\") :gsub("\"", "\\\"") customMessage = string.gsub(customMessage, "@{".. k .. "-}", v ) end
-
-
-
-
-
-
Hey guys, is someone able to help with this. For the life of me i cant get the messages to appear on my site.
So this is what i have:
The points etc lay out is there but no player info etc shows up
<?php
$db_name = 'rust_deathmessages';
$db_user = 'rust_*******';
$db_pass = '*********';
$db_host = 'localhost';
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/datatable.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/datatable.min.css">
<style type="text/css">
(CSS Below)
<?php
$db_name = 'rust_deathmessages';
$db_user = 'rust_*******';
$db_pass = '*********';
$db_host = 'localhost';
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/datatable.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/datatable.min.css">
<style type="text/css">
(CSS Below)
<meta http-equiv="Content-Type" content="text/html; charset=UTF- 8">
<?php
$db_name = 'rust_deathmessages';
$db_user = 'rust_*******';
$db_pass = '*********';
$db_host = 'localhost';
$key = "******";
try
{
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$bdd = new PDO("mysql:host=".$db_host.";dbname=".$db_name,$db_user,$db_pass, $pdo_options);
}
catch (Exception $e)
{
echo 'Error : ' . $e->getMessage();
return;
}
if(isset($_GET['key']) && $_GET['key'] == $key)
{
$type = $_GET['type'];
$bodypart = (isset($_GET['bodypart'])?$_GET['bodypart']:"");
$killer = (isset($_GET['killer'])?Secure($_GET['killer']):"");
$killer_id = (isset($_GET['killerid'])?$_GET['killerid']:"");
$killed = (isset($_GET['killed'])?Secure($_GET['killed']):"");
$killed_id = (isset($_GET['killedid'])?$_GET['killedid']:"");
$weapon = (isset($_GET['weapon'])?$_GET['weapon']:"");
$distance = (isset($_GET['distance'])?$_GET['distance']:"");
$date = date("H:i:s d.m.Y");
$bdd->exec("INSERT INTO `deathmessages` (`killer`, `killed`, `weapon`, `distance`, `time`,`bodypart`,`killer-id`,`killed-id`,`type`) VALUES ( '{$killer}', '{$killed}', '{$weapon}', '{$distance}', '{$date}','{$bodypart}', '{$killer_id}', '{$killed_id}', '{$type}')");
return;
}
function Secure($input)
{
$input = stripslashes($input);
$input = str_replace("#","",$input);
return $input;
}
?>
{
"playerDeathMessage": "@{killer} killed @{killed} (@{weapon}) with a hit to their @{bodypart} at @{distance}m",
"Settings": {
"animalkills": true,
"animaldeaths": true,
"players": true,
"mysql": true
},
"SuicideDeaths": true,
"deathByEntityWhileSleepingMessage": "@{killed} was eaten alive while sleeping by a @{killer}",
"Mysql": {
"uploadpage": "http://www.ausnzrust.com/stats/stats.php",
"key": "*******",
"naturalcauses": true,
"pve": true,
"pvp": true
},
"ChatName": "Death",
"wildlifeDeathMessage": "@{killer} killed a @{killed} (@{weapon}) with a hit to their @{bodypart} at @{distance}m",
"SuicideDeathsMessage": "@{killed} commited suicide",
"naturalcausesdeathmessages": {
"Radiation": "@{killed} got irradiated.",
"Poison": "@{killed} was poisoned.",
"Bleeding": "@{killed} bled to death.",
"Heat": "@{killed} became a dead human torch.",
"Generic": "@{killed} just died.",
"Thirst": "@{killed} was too thirsty and died.",
"Bite": "@{killed} was bitten to death.",
"Fall": "@{killed} fell and died.",
"Cold": "@{killed} froze to death.",
"BluntTrauma": "@{killed} died from a blunt trauma.",
"Slash": "@{killed} got slashed.",
"Bullet": "@{killed} died from a bullet.",
"Suicide": "@{killed} committed suicide.",
"Hunger": "@{killed} died from hunger.",
"Drowned": "@{killed} thought he could breathe under water."
},
"naturalcausesdeath": true,
"deathByEntityMessage": "@{killed} has died by a @{killer}",
"playerDeathWhileSleepingMessage": "@{killer} murdered @{killed} while sleeping with a @{weapon} at @{distance}m"
}
Database setup
Last edited by a moderator: Dec 30, 2014 -
-
I just changed upload to "http://ausnzrust.com/stats/receive/deathmessages.php" but it still doesnt seem to be showing anything.
Ive had the plugin installed for awhile but have only just decided to setup the website side.
To make changes I'm only doing oxide.reload, does this require a full server restart? even if ive had the plugin installed for awhile? -
-
hmm it seemed to work back on legacy when i had a chat being sent to the site. Weird.
Do you know of any other webrequest plugins off the top of your head?
[DOUBLEPOST=1419930320][/DOUBLEPOST]is there a way to post a console message if webrequest is sending? -
-
[DOUBLEPOST=1419931300][/DOUBLEPOST]
Looks like webrequest could be the issue! -
Webrequests are rfucked, nothing much can be done until they are fixed
-
only way I could get it to start was restarting the server. sometimes it stops working out of the blue and requires a reboot also
some reason animal kills doesn't work. must be bugged cause pve is set to true...