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

RevScripts Revscript not work, no error

Jpstafe

Well-Known Member
Joined
Aug 8, 2011
Messages
507
Reaction score
68
This script is not giving error but does not work can somebody fix it for me ?
Lua:
local skulls = {
    [SKULL_YELLOW] = "%s is on killing spree! He killed 5 players!",
    [SKULL_GREEN] = "%s is dominating! He killed 10 players!",
    [SKULL_WHITE] = "%s is CRAZY! He killed 15 players!",
    [SKULL_RED] = "%s is UNSTOPPABLE!! He killed 20 players! DO SOMETHING!",
}

local creatureevent = CreatureEvent("greet_skull")
function creatureevent.onKill(player, target)
    addEvent(function()
        local skull = skulls[player:getSkull()]
        if skull then
            Game.broadcastMessage(skull:format(player:getName()))
        end
    end, 0)
    return true
end
creatureevent:register()


local login = CreatureEvent("greet_skull")

function login.onLogin(player)
    player:registerEvent("greet_skull")
    return true
end
login:register()
 
Just change local login = CreatureEvent("greet_skull") to local login = CreatureEvent("greet_skull_login")
I don't understand the point of the script but this should work.
 
joking? not work
What are you trying to do here?
I can see that onKill you're using addEvent with delay 0 which is useless if it's 0 delay anyway so just remove it.
Then you're checking if the player has got a skull and broadcasting a message from the table based on player's skull. Nothing more.
So as I mentioned above the only issue I can see is that you're using the same event name in both scripts.
 
Last edited:
I can see that onKill you're using addEvent with delay 0 which is useless if it's 0 delay anyway so just remove it.
Nono thats not useless at all... it creates a scheduled task to execute once the onKill event is done, not while its execution, which its necessary to broadcast the correct skull type message
 
What are you trying to do here?
I can see that onKill you're using addEvent with delay 0 which is useless if it's 0 delay anyway so just remove it.
Then you're checking if the player has got a skull and broadcasting a message from the table based on player's skull. Nothing more.
So as I mentioned above the only issue I can see is that you're using the same event name in both scripts.
that small delay will make the addevent trigger slightly later.

So after onKill, onPrepareDeath, onDeath have all triggered, that addEvent would then trigger..
Meaning their current skull type would be fully updated.

Where if you did it right away as you suggest, it may broadcast a white skull message instead of a red skull message.

--
But yeah otherwise I agree.
 
What are you trying to do here?
I can see that onKill you're using addEvent with delay 0 which is useless if it's 0 delay anyway so just remove it.
Then you're checking if the player has got a skull and broadcasting a message from the table based on player's skull. Nothing more.
So as I mentioned above the only issue I can see is that you're using the same event name in both scripts.
yes. becaus ei need to check if a player has gained skull and raight away brodcast the message, that's why it works in that way, any other solution?
 
yes. becaus ei need to check if a player has gained skull and raight away brodcast the message, that's why it works in that way, any other solution?
He means that:

Lua:
local skulls = {
    [SKULL_YELLOW] = "%s is on killing spree! He killed 5 players!",
    [SKULL_GREEN] = "%s is dominating! He killed 10 players!",
    [SKULL_WHITE] = "%s is CRAZY! He killed 15 players!",
    [SKULL_RED] = "%s is UNSTOPPABLE!! He killed 20 players! DO SOMETHING!",
}

local creatureevent = CreatureEvent("greet_skull")
function creatureevent.onKill(player, target)
    addEvent(function()
        local skull = skulls[player:getSkull()]
        if skull then
            Game.broadcastMessage(skull:format(player:getName()))
        end
    end, 0)
    return true
end
creatureevent:register()


local login = CreatureEvent("login_skull") -- from greet to login_skull

function login.onLogin(player)
    player:registerEvent("greet_skull")
    return true
end
login:register()
 
He means that:

Lua:
local skulls = {
    [SKULL_YELLOW] = "%s is on killing spree! He killed 5 players!",
    [SKULL_GREEN] = "%s is dominating! He killed 10 players!",
    [SKULL_WHITE] = "%s is CRAZY! He killed 15 players!",
    [SKULL_RED] = "%s is UNSTOPPABLE!! He killed 20 players! DO SOMETHING!",
}

local creatureevent = CreatureEvent("greet_skull")
function creatureevent.onKill(player, target)
    addEvent(function()
        local skull = skulls[player:getSkull()]
        if skull then
            Game.broadcastMessage(skull:format(player:getName()))
        end
    end, 0)
    return true
end
creatureevent:register()


local login = CreatureEvent("login_skull") -- from greet to login_skull

function login.onLogin(player)
    player:registerEvent("greet_skull")
    return true
end
login:register()
Works now but it's broadcasting message every kill a player makes, since skull reward is my by table range so from
is there a way to do it by kill amount or amount of frags if player has kill 5, 10, 15, broadcast a different message?
 
Nono thats not useless at all... it creates a scheduled task to execute once the onKill event is done, not while its execution, which its necessary to broadcast the correct skull type message
that small delay will make the addevent trigger slightly later.

So after onKill, onPrepareDeath, onDeath have all triggered, that addEvent would then trigger..
Meaning their current skull type would be fully updated.

Where if you did it right away as you suggest, it may broadcast a white skull message instead of a red skull message.

--
But yeah otherwise I agree.
I didn't think of it that way, Just saw the delay 0 and assumed it's useless but good then something new to know today xD
 
Lua:
local skulls = {
    [SKULL_YELLOW] = "%s is on killing spree! He killed 5 players!",
    [SKULL_GREEN] = "%s is dominating! He killed 10 players!",
    [SKULL_WHITE] = "%s is CRAZY! He killed 15 players!",
    [SKULL_RED] = "%s is UNSTOPPABLE!! He killed 20 players! DO SOMETHING!",
}

local creatureevent = CreatureEvent("greet_skull")
function creatureevent.onKill(player, target)
    addEvent(function()
        local skull = skulls[player:getSkull()]
        if skull then
            Game.broadcastMessage(skull:format(player:getName()))
        end
    end, 0)
    return true
end
creatureevent:register()


local login = CreatureEvent("login_skull") -- from greet to login_skull

function login.onLogin(player)
    player:registerEvent("greet_skull")
    return true
end
login:register()

the script works. but is broken as xikini said. is there a way to broadcast message if player has reached a certain amount of kill, 5 kills 1 message, 10 other message instead of cheking skulls, if so? how to?

made this
Lua:
local fragSkulls = {
    [1] = "%s is on killing spree! He killed 5 players!",
    [2] = "%s is dominating! He killed 10 players!",
    [3] = "%s is CRAZY! He killed 15 players!",
    [4] = "%s is UNSTOPPABLE!! He killed 20 players! DO SOMETHING!",
}

local creatureevent = CreatureEvent("greet_skull")
function creatureevent.onKill(player, target)
    addEvent(function()
        local frags = fragSkulls[player:getFrags()]
        if frags then
            Game.broadcastMessage(fragSkulls:format(player:getName()))
        end
    end, 0)
    return true
end
creatureevent:register()


local login = CreatureEvent("login_skull") -- from greet to login_skull

function login.onLogin(player)
    player:registerEvent("greet_skull")
    return true
end
login:register()

this line does not work
Code:
 local frags = fragSkulls[player:getFrags()]

Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
/home/otserv/data/scripts/skull_message_greet.lua:11: attempt to call method 'getFrags' (a nil value)
stack traceback:
        [C]: in function 'getFrags'
        /home/otserv/data/scripts/skull_message_greet.lua:11: in function </home/otserv/data/scripts/skull_message_greet.lua:10>
 
Last edited:
@Jpstafe

getfrags() doesn't exist, I think its called getskulltime() that return time of skull in seconds

maybe you can do something using storage
 
Back
Top