• 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 command attackspeed

jel

Member
Joined
Mar 22, 2014
Messages
302
Reaction score
12
Good morning, I tried to make a script to know the player's current attackspeed, but it didn't work

using distro canary

Lua:
local speed = TalkAction("!speed")

function speed.onSay(player, words, param)
local speed = player:getBaseAttackSpeed()
        player:sendCancelMessage(string.format('You have %s speed%s left.', (speed == 1 and '' or 's')))
end

speed:register()
 
I believe you can't without source edit. This function getBaseAttackSpeed only allows vocations check.
You can try to add this one.
 
Good morning, I tried to make a script to know the player's current attackspeed, but it didn't work

using distro canary
This script appears to be a Lua script that creates a custom talk action for a game or virtual world, which allows players to check their attack speed. The action is triggered when a player says "!speed" in the game's chat.

When the action is triggered, the script gets the player's base attack speed using the getBaseAttackSpeed() function and then sends a message to the player using the sendCancelMessage() function. The message includes the player's current attack speed and whether it is singular or plural.

The script also registers the action using the register() function, which allows the action to be triggered when the player says the specified words.

It's looks like it's working well, but it's possible to optimize it

  • by adding a little message to indicate that the command is working and that is being processed
  • By returning the exact speed value instead of "speed" or "speeds"
With small adjustments, the script could look like this:


local speed = TalkAction("!speed")

function speed.onSay(player, words, param)
player:sendCancelMessage("Checking your attack speed..")
local speed = player:getBaseAttackSpeed()
player:sendCancelMessage(string.format('You have %s attack speed.', speed))
end

speed:register()
 
I believe you can't without source edit. This function getBaseAttackSpeed only allows vocations check.
You can try to add this one.
attackspeed does not appear in numbers, what should I change in the script?

You have userdata: 0x7e873aa5bc58 attack speed

Lua:
local speed = TalkAction("!speed")

function speed.onSay(player, words, param)
local vocation = player:getVocation()
vocation:getBaseAttackSpeed()
--player:sendCancelMessage(string.format('You have %s attack speed.', vocation))
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You have %s attack speed", vocation))
end

speed:register()
 
Back
Top