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

highscore in game ?

Schizor89

New Member
Joined
Apr 27, 2012
Messages
8
Reaction score
0
Hello, I didnt know where to post it, but i thought here be fine. well thing is that im looking for a scrypt or someother way of making highscore in game i was playing this ot and it had a commend that looked like this !rank "level etc. if anyone knows how to do it please help me
@up sorry for my english.
 
Create a lua file into the data/talkactions/scripts of your ot and paste this inside:
Lua:
function onSay(cid, words, param)

     -- max players on the highscore
     local players = 20 -- The amount of players that is shown in the list

     -- don't touch --
     local str = ""
     local value = ""
     local name = ""
     local player_id = 0
     local result = nil
	if param == "level" or param == "exp" or param == "lvl" then
		str = "# [Level] - Name\n"
		value = "level"
		name = "name"
		result = db.getResult("SELECT `level`, `name` FROM `players` ORDER BY `level` DESC, `name` ASC;")
	elseif param == "magiclevel" or param == "magic" or param == "mlevel" or param == "ml" then
		str = "# [Magic Level] - Name\n"
		value = "maglevel"
		name = "name"
		result = db.getResult("SELECT `name`, `maglevel` FROM `players` ORDER BY `maglevel` DESC, `name` ASC;")
	elseif param == "fist" then
		str = "# [Fist] - Name\n"
		value = "value"
		player_id = "player_id"
		result = db.getResult("SELECT `player_id`, `value` FROM `player_skills`  WHERE `skillid` = 0 ORDER BY `value` DESC, `player_id` ASC;")
	elseif param == "club" then
		str = "# [Club] - Name\n"
		value = "value"
		player_id = "player_id"
		result = db.getResult("SELECT `player_id`, `value` FROM `player_skills`  WHERE `skillid` = 1 ORDER BY `value` DESC, `player_id` ASC;")
	elseif param == "sword" then
		str = "# [Sword] - Name\n"
		value = "value"
		player_id = "player_id"
		result = db.getResult("SELECT `player_id`, `value` FROM `player_skills`  WHERE `skillid` = 2 ORDER BY `value` DESC, `player_id` ASC;")
	elseif param == "axe" then
		str = "# [Axe] - Name\n"
		value = "value"
		player_id = "player_id"
		result = db.getResult("SELECT `player_id`, `value` FROM `player_skills`  WHERE `skillid` = 3 ORDER BY `value` DESC, `player_id` ASC;")
	elseif param == "dist" or param == "distance" then
		str = "# [Distance] - Name\n"
		value = "value"
		player_id = "player_id"
		result = db.getResult("SELECT `player_id`, `value` FROM `player_skills`  WHERE `skillid` = 4 ORDER BY `value` DESC, `player_id` ASC;")
	elseif param == "shield" or param == "shielding" then
		str = "# [Shield] - Name\n"
		value = "value"
		player_id = "player_id"
		result = db.getResult("SELECT `player_id`, `value` FROM `player_skills`  WHERE `skillid` = 5 ORDER BY `value` DESC, `player_id` ASC;")
	elseif param == "fish" or param == "fishing" then
		str = "# [Fishing] - Name\n"
		value = "value"
		player_id = "player_id"
		result = db.getResult("SELECT `player_id`, `value` FROM `player_skills`  WHERE `skillid` = 6 ORDER BY `value` DESC, `player_id` ASC;")
	else
	     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Unbekannter skill: '" .. param .. "'")
	     return TRUE
	end
	if (result:getID() ~= -1) then
		local i = 1
		while TRUE do
			if not(result:next()) or i > players then
				break
			end
			str = str .. "\n " .. i .. ". [" .. result:getDataInt(value) .. "] - " .. (name ~= "" and result:getDataString("name") or getPlayerNameByGUID(result:getDataInt(player_id)))
			i = i+1
		end
		result:free()
	end
	if str ~= "" then
		doPlayerPopupFYI(cid, str)
	end
	return TRUE
end

and in talkactions/talkactions.xml add this:
XML:
	<talkaction words="!highscore" event="script" value="scripts/highscore.lua"/>
 
i dont have talkaction in my ot it has to be another way
@ps the server is 7.6 version i think thats important to know
 
Last edited:
whats a distro ? im sory im a newbie in this. i use YurOTS 0.9.4F engine if thats what distro is.

@ps i have sources

- - - Updated - - -

Anyone know how to do it? I really need it , please.
 
Back
Top