• 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!

Top 25 Fragers on website 70% complete //tfs 0.3.6pl1

Skeyba

Banned User
Joined
May 5, 2009
Messages
378
Reaction score
0
Location
PL
Hi all,
Can someone writes me a script (for tfs 0.3.6) that will count how many people killed?
It's mean if i kill someone table frags_all will get +1.
i need this:)
It will be very helpful for all :)




mysql:
ALTER TABLE `players` ADD `frags_all` INT( 11 ) NOT NULL;

and it is my frags.php
PHP:
<?php
function coloured_value($valuein)
{
	$value2 = $valuein;
	while(strlen($value2) > 3)
	{
		$value .= ' '.substr($value2, -3, 3);
		$value2 = substr($value2, 0, strlen($value2)-3);
	}
	$value = $value2.$value;
	if($valuein > 0)
		return ''.$value.'';
	elseif($valuein < 0)
		return '<font color="red">-'.$value.'</font>';
	else
		return ''.$value.'';
}

function placeImages($count){
	if($count > 300) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/blackskull.gif'><img src='images/blackskull.gif'><img src='images/blackskull.gif'>";
	if($count > 260) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/blackskull.gif'><img src='images/blackskull.gif'>";
	if($count > 230) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskullhalf.gif'>";
	if($count > 190) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'>";
	if($count > 150) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskullhalf.gif'>";
	if($count > 120) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'>";
	if($count > 90) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskullhalf.gif'>";
	if($count > 70) return "<img src='images/redskull.gif'><img src='images/redskull.gif'>";
	if($count > 50) return "<img src='images/redskull.gif'><img src='images/redskullhalf.gif'>";
	if($count > 30) return "<img src='images/redskull.gif'>";
	if($count > 10) return "<img src='images/redskullhalf.gif'>";
}

function showTopExp()
{
	global $SQL;
	global $config,$connect;
	$world = $_GET['world'];
	if ($world > 0 && is_numeric($world)){
		$world = " WHERE `world_id` = ".(int)($world-1)."";
	}
	$return .= "<br><h2><center><font color='red'>Top 25 Fragers on ".$config['server']['serverName']."</font></center></h2><br>
        <table border=0 cellspacing=1 cellpadding=4 width=100%>
	<tr bgcolor=\"".$config['site']['vdarkborder']."\">
	<td class=white><font><b>Lp.</b></font></td>
	<td class=white width=\"40%\"><font><b>Name</b></font></td>
	<td class=white><font><b>Online</b></font></td>
	<td class=white width=\"20%\"><font><b>World</b></font></td>
	<td class=white width=\"40%\"><font><b>Count</b></font></td></tr>";
	$groupMembers = $SQL->query('SELECT `name`,`frags_all`,`level`,`world_id`,`online`,`account_id` FROM `players`'.$world.' ORDER BY `frags_all` DESC LIMIT 25');

	$membersCount = 0;
	$memberss = 0;

	foreach($groupMembers as $member)
	{
		$membersCount++;
		if(is_int($membersCount / 2))
			$bgcolor = $config['site']['darkborder'];
		else
			$bgcolor = $config['site']['lightborder'];
			
		$count = $member['experience']-$member['exphist_lastexp'];
		
				

		$return .= "<tr bgcolor=\"".$bgcolor."\"><td>".$membersCount.".</td>
		<td><a href=\"index.php?subtopic=characters&name=".$member['name']."\">".$member['name']." [".$member['level']."]</a></td>
		<td><center>".$on."</center></td>
                <td>".$config['server']['serverName']."</td>
		<td>".$member['frags_all']." different people<br/>".placeImages($member['frags_all'])."</td>
		</tr>";
		$memberss++;
	}
	if ($membersCount = 0) $return .= "<tr bgcolor=\"".$config['site']['darkborder']."\">
	<td colspan=\"2\">No statistics available.</td>
	</tr>";
	$return .= "</table>";
	 if($memberss > 0){
	 $memberss = 0;
	return $return;
	}else
	{
        return false;
        }
}

$main_content .= showTopExp();
?>


FEBA OTS - Top Fragers <=it show what is wrong


plz help
 
Last edited:
the databse can't count?

here is a script count. it counts how many monsters you killed, I smart to help you.


HTML:
function onKill(cid, target, lastHit)
local monster = getCreatureName(target)
if isMonster(target) == TRUE then
        db.executeQuery("INSERT INTO killed_monsters (`name`, `date`) VALUES\n('".. monster .."',".. os.time() ..");")

        end
        return TRUE
end
 
forget the above, I have another script here:

Code:
local monsters = {
	--name = storage
	["rat"] = 35001,
	["troll"] = 35002,
	["rotworm"] = 35003,
	["carrion worm"] = 35004,
	["dragon"] = 35005,
	["dragon lord"] = 35006,
	["hydra"] = 35007,
	["demon"] = 35008,
	["giant spider"] = 35009,
	["hydra"] = 35010,
	["behemoth"] = 35011,
	["warlock"] = 35012,
	["cyclops"] = 35013,
}

function onKill(cid, target)
	if(isMonster(target) == TRUE) then
		local name = getCreatureName(target)
		local monster = monsters[string.lower(name)]
		if(monster) then
			local killedMonsters = getPlayerStorageValue(cid, monster)
			if(killedMonsters == -1) then
				killedMonsters = 1
			end
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou " .. killedMonsters .. " " .. name .. "'s.")
			setPlayerStorageValue(cid, monster, killedMonsters + 1)
		end
	end
	return TRUE
end

I just need to put a function pra run in the database.
 
Wtf is that? He wanna a web site script. Not an script that gets how meny monsters you kill?..
 
Are you using a LUA script to add the frags to the database? If you look in phpMyAdmin do people actually get frags or are they staying at 0 like the website is showing?
 
Here..
Lua:
function onKill(cid, target, lastHit)
         if isPlayer(target) == TRUE then
            db.executeQuery("UPDATE `players` SET `frags_all` = 'frags_all + 1' WHERE id = '" .. getPlayerGUID(cid) .. "';")
         end
        return TRUE
end
 
Last edited:
Here..
Lua:
function onKill(cid, target, lastHit)
         if isPlayer(target) == TRUE then
            db.executeQuery("UPDATE `players` SET `frags_all` = 'frags_all + 1' WHERE id = '" .. getPlayerGUID(cid) .. "';")
         end
        return TRUE
end
dont work. all time Count 0 different people
 
[B]I build the script:[/B]

see the screen:

topfrags.jpg


Legend: Nome = Name, Mundo = World, Matou = Killed.

in the data/lib/function.lua paste:

PHP:
function addPlayerFrag(cid, amount)
        db.executeQuery("UPDATE `players` SET `frags_all` = `frags_all` + " .. amount .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
end

in data/creaturescripts/scripts make a file called frags.lua and paste:

PHP:
function onKill(cid, target, lastHit)
        if(isPlayer(target) ~= true) then
        return true
    end

        if (isPlayer(cid) == true) and (isPlayer(target) == true) then
                if getPlayerSkullType(target) == SKULL_WHITE then
                        addPlayerFrag(cid, 1)
		 elseif getPlayerSkullType(target) == SKULL_YELLOW then
                        addPlayerFrag(cid, 1)
                elseif getPlayerSkullType(target) == SKULL_RED then
                        addPlayerFrag(cid, 1)
                elseif getPlayerSkullType(target) == SKULL_BLACK then
                        addPlayerFrag(cid, 1)
                elseif getPlayerSkullType(target) == SKULL_NONE then
                        addPlayerFrag(cid, 1)
                end
        return TRUE
        end
end

register in Login.lua

PHP:
registerCreatureEvent(cid, "Frags")

add tag in creatures.xml :

PHP:
<event type="kill" name="Frags" event="script" value="frags.lua"/

i think work for all TFS 0.3+
thats all, it's work 100% in TFS 0.3.4 PL2 (cryng danson) and any Gesior acc maker...

good bye :D
 
Last edited:
Back
Top