• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Frags Higscore inGAME

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,812
Solutions
6
Reaction score
822
Hello,
Im using 0.3.6pl1 and I want a frags highscrore. if you say !frags highscore it shows u top 10fraggers

thanks:w00t:
 
LUA:
function onSay(cid, words, param)
    dofile("./config.lua")
	local players = 20 -- The amount of players that is shown in the list
	
	if sqlType == "mysql" then
		env = assert(luasql.mysql())
		con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
	else
		env = assert(luasql.sqlite3())
		con = assert(env:connect(sqliteDatabase))
	end
	
	local str = ""
	cur = assert(con:execute("SELECT `p`.`name` AS `name`, COUNT(`p`.`name`) as `frags` FROM `killers` k LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id` LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id` WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1 GROUP BY `name` ORDER BY `frags` DESC LIMIT 0,"..players..";"))
	row = cur:fetch({}, "a")
	str = "# [Level] - Name - (Amount of Frags)\n"
	local i = 0
	while row do
		str = str.."\n#"..(i+1).." ["..row.level.."] - "..row.name.." - ("..row.frags..")"
		row = cur:fetch (row, "a")
		i = i+1
	end
	if str ~= "" then
		doPlayerPopupFYI(cid, str)
	end
	con:close()
	env:close()
end
 
Back
Top