• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Gesior ACC] Top Hunters (monster killers).

Potar

SocialWorld
Senator
Joined
Mar 1, 2009
Messages
1,664
Reaction score
125
Location
Warsaw, Poland
Hello i present my a new simple "Top Hunters" system, good for RPG servers.

This is very simple but is very easy to make any changes like me for my OT (prizes for killing monsters etc.)


Our Data:


data/creaturescripts/hunter.lua

Lua:
local kills = 29998 -- storage of kills

function onKill(cid, target, lastHit)
	if isPlayer(target) or isSummon(target) then return true end -- if target is not player and summon
	if getCreatureStorage(cid, kills) == -1 then doCreatureSetStorage(cid, kills, 0) end -- start from 0
	doCreatureSetStorage(cid, kills, getCreatureStorage(cid, kills) + 1) --add monster kills
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getCreatureStorage(cid, kills) .. " monsters already killed.") --message

	return true
end


If you want to make a prize for killing monsters there is one example:

Add it after doPlayerSendTexMessage....

if getCreatureStorage(cid, kills) == XXX then YYY end

XXX - How monsters need to get prize...
YYY - Prize for example (doAddPlayerItem, doCreatureSetStorage etc.)

data/creaturescripts.xml

Code:
<event type="kill" name="hunter" event="script" value="hunter.lua"/>

data/creaturescripts/login.lua

Code:
registerCreatureEvent(cid, "hunter")

Our GesiorACC:

Make a file tophunter.php

PHP:
<?php
	$result = $SQL->query("SELECT `players`.`name`, `player_storage`.`value` FROM `players` JOIN `player_storage` ON `players`.`id` = `player_storage`.`player_id` WHERE `player_storage`.`key` = 29998 
	ORDER BY CAST(`player_storage`.`value` AS UNSIGNED) DESC LIMIT 30 ;");
	    $main_content .= '<div style="text-align: center; font-weight: bold;"><h2>Top 30 of Hunters on ' . $config['server']['serverName'] . '</h2></div> 
<center><table border="0" cellspacing="1" cellpadding="4" width="100%"> 
    <tr bgcolor="'.$config['site']['vdarkborder'].'"> 
        <td width="10%"><b><font color=white><center>Pos</font></center></b></td> 
        <td width="30%"><b><font color=white><center>Player Name</center></b></font></td> 
        <td width="20%"><b><font color=white><center>Monsters Killed</center></b></font></td> 
        <td width="20%"><b><font color=white><center>Rank</center></b></font></td> 
    </tr>'; 
	$i = 0; 
	foreach ($result as $entry)
	{ 
    $i++; 
	$main_content .= '<tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']). '"> ';
	$main_content .= '
	<td><center>'.$i.' </center></td>
	<td><b><center><a href="?subtopic=characters&name='.$entry['name'].'">'.$entry['name'].'</a></center></b></td>
	<td><center>'. $entry["value"] .'</center></td>';
$rank = $entry["value"];
if ($rank >= 0){$rank_name = 'None';} 
if ($rank >= 1000){$rank_name = 'Specialist';} 
if ($rank >= 2000){$rank_name = 'Corporal';} 
if ($rank >= 3500){$rank_name = 'Sergeant';} 
if ($rank >= 5000){$rank_name = 'Staff Sergeant';} 
if ($rank >= 10000){$rank_name = 'Sergeant Major';} 
if ($rank >= 20000){$rank_name = 'Command Sergeant Major';} 
if ($rank >= 35000){$rank_name = 'Sergeant Major of the Army';} 
if ($rank >= 50000){$rank_name = 'Hunter';} 

	$main_content .= "<td><center>".$rank_name."</center></td></td></tr>";
	} 
	$main_content .= '</table><br />'; 
?>

Our index.php

PHP:
	case "tophunter";
		$subtopic = "tophunter";
		$topic = "Top Hunters";
		include("tophunter.php");
	break;




I know this is a very simple script, but I didn't want better for my needs.
A may be useful to someone who is just starting his OT career ^_^ :D
 
Can someone help convert to Znote AAC?

Top 3 Hunters
Post automatically merged:

Lua:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/hunter.lua:onKill
data/creaturescripts/scripts/hunter.lua:5: attempt to call global 'getCreatureStorage' (a nil value)
stack traceback:
    [C]: in function 'getCreatureStorage'
    data/creaturescripts/scripts/hunter.lua:5: in function <data/creaturescripts/scripts/hunter.lua:3>

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/hunter.lua:onKill
data/creaturescripts/scripts/hunter.lua:5: attempt to call global 'getCreatureStorage' (a nil value)
stack traceback:
    [C]: in function 'getCreatureStorage'
    data/creaturescripts/scripts/hunter.lua:5: in function <data/creaturescripts/scripts/hunter.lua:3>
 
Last edited:
Lua:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/hunter.lua:onKill
data/creaturescripts/scripts/hunter.lua:5: attempt to call global 'doCreatureSetStorage' (a nil value)
stack traceback:
    [C]: in function 'doCreatureSetStorage'
    data/creaturescripts/scripts/hunter.lua:5: in function <data/creaturescripts/scripts/hunter.lua:3>
 
Back
Top