• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

RevScripts TalkAction

alcapone

Member
Joined
Jan 13, 2021
Messages
191
Reaction score
16
I'm wanting a talk for when it runs all the monsters on the screen receive hitkill, why use a talk and not using it as a spell because when using it it wouldn't appear on the screen
 
Solution
Lua:
local talk = TalkAction("/killall", "!killall")

function talk.onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
   
    local spectators = Game.getSpectators(player:getPosition(), false, false, 8, 8, 6, 6) -- should be slightly larger then the full screen.
    if spectators and #spectators > 0 then
        for i = 1, #spectators do
            local monster = Monster(spectators[i])
            if monster then
                monster:addHealth((creature:getHealth() * -1))   
            end
        end
    end

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "All monsters on screen have been killed.")
    return false
end

talk:separator(" ")
talk:register()

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,245
Solutions
545
Reaction score
4,481
Lua:
local talk = TalkAction("/killall", "!killall")

function talk.onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
   
    local spectators = Game.getSpectators(player:getPosition(), false, false, 8, 8, 6, 6) -- should be slightly larger then the full screen.
    if spectators and #spectators > 0 then
        for i = 1, #spectators do
            local monster = Monster(spectators[i])
            if monster then
                monster:addHealth((creature:getHealth() * -1))   
            end
        end
    end

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "All monsters on screen have been killed.")
    return false
end

talk:separator(" ")
talk:register()
 
Solution
Top