• 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 Creaturescripts transform revscriptsys

adrenysny

Member
Joined
Feb 17, 2021
Messages
140
Reaction score
14
Can someone do me a favor to transform it to revscriptsys?

Code:
<event type="kill" name="TopFrags" event="script" value="topfrags.lua" />
<event type="login" name="RTopFrags" event="script" value="topfrags.lua" />

Lua:
local skulls = {SKULL_WHITE, SKULL_YELLOW, SKULL_RED, SKULL_BLACK}

function addPlayerFrag(cid, value)
    db.executeQuery("UPDATE `players` SET `frags_all` = `frags_all` + " .. value .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
    return true
end

function onKill(cid, target)
    if isPlayer(cid) and isPlayer(target) then
        for i= 1, #skulls do
            if getPlayerSkullType(target) == skulls[i]  then
                addPlayerFrag(cid, 1)
                break
            end
        end
    end
    return true
end

function onLogin(cid)
    registerCreatureEvent(cid, "TopFrags")
    return true
end
 

Snavy

Bakasta
Senator
Joined
Apr 1, 2012
Messages
1,243
Solutions
71
Reaction score
570
Location
Hell
Lua:
local skulls = {SKULL_WHITE, SKULL_YELLOW, SKULL_RED, SKULL_BLACK}
function addPlayerFrag(player, value)
    db.executeQuery("UPDATE `players` SET `frags_all` = `frags_all` + " .. value .. " WHERE `id` = " .. player:getGuid() .. ";")
    return true
end

local topFrags = CreatureEvent('TopFrags')
function topFrags.onKill(player, target)
    if not target:isPlayer() then
        return true
    end
    if table.contains(skulls, player:getSkull()) then
        addPlayerFrag(player, 1)
    end
    return true
end
topFrags:register()

local login = CreatureEvent('login')
function login.onLogin(player)
    player:registerEvent("TopFrags")
    return true
end
login:register()
 
OP
OP
A

adrenysny

Member
Joined
Feb 17, 2021
Messages
140
Reaction score
14
Lua:
local skulls = {SKULL_WHITE, SKULL_YELLOW, SKULL_RED, SKULL_BLACK}
function addPlayerFrag(player, value)
    db.executeQuery("UPDATE `players` SET `frags_all` = `frags_all` + " .. value .. " WHERE `id` = " .. player:getGuid() .. ";")
    return true
end

local topFrags = CreatureEvent('TopFrags')
function topFrags.onKill(player, target)
    if not target:isPlayer() then
        return true
    end
    if table.contains(skulls, player:getSkull()) then
        addPlayerFrag(player, 1)
    end
    return true
end
topFrags:register()

local login = CreatureEvent('login')
function login.onLogin(player)
    player:registerEvent("TopFrags")
    return true
end
login:register()
Lua:
Lua Script Error: [Scripts Interface]
/home/forgottenserver/data/scripts/creaturescripts/topfrags.lua:callback
...orgottenserver/data/scripts/creaturescripts/topfrags.lua:3: attempt to call field 'executeQuery' (a nil value)
stack traceback:
        [C]: in function 'executeQuery'
        ...orgottenserver/data/scripts/creaturescripts/topfrags.lua:3: in function 'addPlayerFrag'
        ...orgottenserver/data/scripts/creaturescripts/topfrags.lua:13: in function <...orgottenserver/data/scripts/creaturescripts/topfrags.lua:8>
 
Top