2025-06-21 13:30:52 -04:00
|
|
|
required_rank = GM_RANK_DEBUG
|
2025-06-25 16:52:37 -04:00
|
|
|
sender = "[setspeed] "
|
2025-06-21 13:30:52 -04:00
|
|
|
|
|
|
|
function onCommand(args, player)
|
|
|
|
local parts = split(args)
|
2025-06-25 15:21:09 -04:00
|
|
|
local argc = #parts
|
2025-06-21 13:30:52 -04:00
|
|
|
local usage = "\nThis command sets the user's speed to a desired multiplier.\nUsage: !setspeed <multiplier>"
|
|
|
|
local SPEED_MAX = 10 -- Arbitrary, but it's more or less unplayable even at this amount
|
|
|
|
local speed_multiplier = tonumber(parts[1])
|
|
|
|
|
|
|
|
if argc == 1 and not speed_multiplier then
|
2025-06-25 16:52:37 -04:00
|
|
|
printf(player, "Error parsing speed multiplier! Make sure the multiplier is an integer."..usage)
|
2025-06-21 13:30:52 -04:00
|
|
|
return
|
|
|
|
elseif argc == 0 then
|
|
|
|
speed_multiplier = 1
|
|
|
|
end
|
|
|
|
|
|
|
|
if speed_multiplier <= 0 then
|
|
|
|
speed_multiplier = 1
|
|
|
|
elseif speed_multiplier > SPEED_MAX then
|
|
|
|
speed_multiplier = SPEED_MAX
|
|
|
|
end
|
|
|
|
|
|
|
|
player:set_speed(speed_multiplier)
|
2025-06-25 16:52:37 -04:00
|
|
|
printf(player, "Speed multiplier set to %s.", speed_multiplier)
|
2025-06-21 13:30:52 -04:00
|
|
|
end
|