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

Need "!rank frags" command

ffriozi

New User of Linux OS
Joined
Apr 4, 2008
Messages
96
Reaction score
1
like the title say... i tried search here and cant find!

anyone can help?
 
Lua:
local exhaust = 3435 
local exhaustionTime = 60

function onSay(cid, words, param, channel)
    if exhaustion.check(cid, exhaust) then
        doPlayerSendCancel(cid, 'You can\'t use this command yet['..exhaustion.get(cid, exhaust)..'].')
        return true
    else
        exhaustion.set(cid, exhaust, exhaustionTime)
    end
    
    local str = '[#]-[Name]-[Frags]'
    result = db.getResult('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, `name` ASC LIMIT 0,10;')
    
    if isInArray({-1,nil,false,''},result:getID()) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'No results were found.')
        return true
    end
    
    local i = 1
    while true do
        str = str .. '\n ' .. i .. '. ' .. result:getDataString('name') .. ' - [' .. result:getDataInt('frags') .. ']'
        i = i + 1
        if not(result:next()) then
            break
        end
    end
    result:free()
    doPlayerPopupFYI(cid, str)
    return true
end

XML:
<talkaction words="!frag" event="script" value="fragscore.lua"/>
 
Cyber s2 XD

error in console:

btw i sent u a Private msg...

Code:
[Error - TalkAction Interface]
data/talkactions/scripts/fragscore.lua:onSay
Description:
data/lib/004-database.lua:75: attempt to index local 'self' (a number value)
stack traceback:
        data/lib/004-database.lua:75: in function <data/lib/004-database.lua:74>

        (tail call): ?
        data/talkactions/scripts/fragscore.lua:22: in function <data/talkactions
/scripts/fragscore.lua:4>

going sleep cya tomorrow ppl :)
 
Last edited:
Back
Top