• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction [9.8]Simple personal rank

Fec

Member
Joined
Oct 24, 2008
Messages
69
Reaction score
6
This is simple presonal rank command! (!myrank). It shows your position [level sorted by exp] in server. This is my second script so please don't insult me ; p

In talkactions\scripts\simplerank.lua:
PHP:
-- simple personal ranking
-- Created by Layflette/Fec/3dzio

function onSay(cid, words, param)
	local best_list = db.getResult("SELECT `level`,`name` FROM `players` WHERE `group_id` < '2' AND `account_id` > '1' ORDER BY `experience` DESC;")
	local player_name = getPlayerName(cid)
	local count = 1
	if best_list:getID() ~= -1 then
		while true do
			local currName = best_list:getDataString('name')
			if currName == player_name then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You are in the ' .. count .. ' place !')
			else
				count = count + 1
			end
			if not best_list:next() then break end
		end
	end
	best_list:free()
	return TRUE
end

In talkactions.xml add
PHP:
<talkaction words="!myrank" script="simplerank.lua"/>
Tested on tfs 0.2.15.r102 mystic spirit.
 
Thanks! I was looking for this, since I don't have a website yet.
 
@up
I think so, just give it a try and post the errors here if u get any
 
Back
Top