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

[Lua Script] Return the 5 higher values

StormRusher

New Member
Joined
Dec 23, 2009
Messages
138
Reaction score
0
Well i wanna know how to return the 5 players which have the highers storagevalue(1), from online list (getPlayerOnline~~)

Thanks
 
seriously, this is mindfuck

everything would be so much easier if you just stored them in a separate table, but i'm probably wrong and sleepy.
 
You could make a Script to add +1 to the collum TFrags in your DB and then use this script.

Code:
local DontShow = {
		"Account Manager",
		"Master Sorcerer",
		"Elder Druid",
		"Royal Paladin",
		"Elite Knight"
	}

function onSay(cid, words, param, channel)
	local players = 1
	local result = db.getResult("SELECT `tfrags`, `name` FROM `players`  WHERE `group_id` = "..players.." ORDER BY `tfrags` DESC, `name` ASC;")

	if (result:getID() ~= -1) then
		str = "# [Total Frags] - Name -\n"
		local i, name = 1, ""
		while TRUE do
		     name = result:getDataString("name")
			if isInArray(DontShow, name) == false then
				str = str .. "\n " .. i .. ". [" .. result:getDataInt("tfrags") .. "] - " .. result:getDataString("name")
				i = i+1
			end
			if not(result:next()) or i > players then
				break
			end
		end
		if str ~= "" then
			doPlayerPopupFYI(cid, str)
		end
	end
	result:free()
	return TRUE
end
 
edit~~ already done

Now i only need that the script show the 5 players with the higher tfrags, not only one

thanks a lot
 
Last edited:
Back
Top