Zonet
Web Developer
I made this script, shows ** players that have killed ** monsters. You can add more monsters, and also choose how many players that should be shown.
This is just a example pic, I took storage from db, just test
PHP script:
Website config.php
Creaturescript.xml
login.lua
count.lua
Any errors or any question, wouldn't mind answering them
This is just a example pic, I took storage from db, just test
PHP script:
PHP:
<?php
/* Scrip by zonet */
$kills = $config['site']['creatureKills'];
$limit = $config['site']['creatureKillShowLimit'];
$main_content .= '<table border="0px" cellspacing="1px" cellpadding="4px" width="100%">
<tr bgcolor="#505050" style="color: white;"><th width="10%">Creature</th><th>Creature name</th><th>Most Killer ( '.$limit.' )</th></tr>';
$row = 1;
foreach($kills as $name => $storage) {
$qa = $SQL->query('SELECT `player_storage`.`player_id`, `player_storage`.`key`, `player_storage`.`value` AS `value`, `players`.`id`, `players`.`name` AS `name` FROM `player_storage` LEFT JOIN `players` ON `player_storage`.`player_id` = `players`.`id` WHERE `player_storage`.`key` = '.$storage.' ORDER BY ABS(value) DESC LIMIT '.$limit)->fetchAll();
$color = ( $row % 2 ? $config['site']['darkborder'] : $config['site']['lightborder']);
$row++;
$main_content .= '<tr bgcolor="'.$color.'"><td><img src="/monsters/'.(str_replace(" ", "" , $name)).'.gif"></td><td width="20%" style="font-size: 13pt; font-weight: bold; color: darkorange;"><center>'.(ucfirst($name)).'</center></td><td>';
$a = 0;
foreach( $qa as $q )
{
$a++;
if($a == 1)
$main_content .= '<font color="green">';
if($a == $limit)
$main_content .= '<font color="red">';
if($a == $limit/2)
$main_content .= '<font color="darkorange">';
$main_content .= '<b>'.$a.'. Name:</b> <a href="?subtopic=characters&name='.urlencode($q['name']).'">'.$q['name'].'</a> (Kills: '.$q['value'].') </font></font></font><br />';
}
}
$main_content .= '</td></table>';
?>
Website config.php
PHP:
$config['site']['creatureKillShowLimit'] = 6;
$config['site']['creatureKills'] = array('dragon' => 9541, 'dragon lord' => 9542, 'frost dragon' => 9543, 'wyrm' => 9544, 'demon' => 9545);
Creaturescript.xml
Code:
<event type="kill" name="countKill" event="script" value="count.lua"/>
login.lua
Code:
registerCreatureEvent(cid, "countKill")
count.lua
Lua:
--[[ Script by slawkens, modified by Zonet]]--
local monsters = {
["dragon"] = 9541,
["dragon lord"] = 9542,
["frost dragon"] = 9543,
["wyrm"] = 9544,
["demon"] = 9545,
}
function onKill(cid, target)
if(isPlayer(target) ~= true and isPlayer(cid)) then
local name = getCreatureName(target)
local monster = monsters[string.lower(name)]
if(monster) then
local killedMonsters = getPlayerStorageValue(cid, monster)
if(killedMonsters < 0) then
killedMonsters = 1
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. killedMonsters .. " " .. name .. "'s.")
setPlayerStorageValue(cid, monster, killedMonsters + 1)
end
end
return true
end
Any errors or any question, wouldn't mind answering them
Last edited: