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

NEED: House Key Buyer and Speed of Players ( always same )!

Hashirama479

World of Ninja
Joined
Dec 19, 2016
Messages
536
Solutions
6
Reaction score
74
As the title says: I need two scripts

1. House KEY Buyer, how should it work?
You should use a key on a door then you bought the house... same as !buyhouse just as key ( item )

2. Speed of Players always same:
Players should always have the same speed limit doesnt matter if level 8 or 3402020

would be nice if someone could help me out, thanks <3 :D
 
House Key Buyed
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not player:isPremium() then
        player:sendCancelMessage("You need a premium account.")
        return false
    end
   
    local position = player:getPosition()
    position:getNextPosition(player:getDirection())

    local tile = Tile(position)
    local house = tile and tile:getHouse()
    if house == nil then
        player:sendCancelMessage("You have to be looking at the door of the house you would like to buy.")
        return false
    end

    if house:getOwnerGuid() > 0 then
        player:sendCancelMessage("This house already has an owner.")
        return false
    end

    if player:getHouse() then
        player:sendCancelMessage("You are already the owner of a house.")
        return false
    end

    -- Remove Item Key
    item:remove(1)
   
    house:setOwnerGuid(player:getGuid())
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have successfully bought this house, be sure to have the money for the rent in the bank.")
    return true
end
 
changeSpeed.lua
Code:
local speed = 300

function onThink(interval)
    local players = getPlayersOnline()
    for _, cid in ipairs(players) do
        for i = 1, 20 do
            doChangeSpeed(cid, tonumber(tostring(speed)))
        end
    end
    return true
end

Code:
<globalevent name="speed" interval="1" event="script" value="changeSpeed.lua"/>
 
Its working thanks xD ah but I have a other question, is it possible that the ot will lag with the script? if there are as explain 100 players online?
 
Yo @Xeraphus seems like your script always add the speed also as explain sec 1 - slow sec 2- bit faster after 10 sec you are super fast xD you know what I mean?
Code:
local speed = 300

function onThink(interval)
    local players = getPlayersOnline()
    for _, cid in ipairs(players) do
        while getCreatureSpeed(cid) ~= speed do
            local x = {}
            for i = 1500, 1, -1 do
                table.insert(x, 1, i)
            end
            local _speed = x[getCreatureSpeed(cid)]
            doChangeSpeed(cid, _speed > speed and -1 or 1)
        end
    end
    return true
end
 
Last edited:
Code:
local speed = 300

function onThink(interval)
    local players = getPlayersOnline()
    for _, cid in ipairs(players) do
        while getCreatureSpeed(cid) ~= speed do
            local x = {}
            for i = 1500, 1, -1 do
                table.insert(x, 1, i)
            end
            local _speed = x[getCreatureSpeed(cid)]
            doChangeSpeed(cid, _speed > speed and -1 or 1)
        end
    end
    return true
end


fc5d18faab30e540eac893adb7aaa857.png

https://gyazo.com/fc5d18faab30e540eac893adb7aaa857
 
Code:
local speed = 300
function onThink(interval)
    local players = getPlayersOnline()
    for _, cid in ipairs(players) do
       doChangeSpeed(cid, -getCreatureSpeed(cid)+speed)
    end
    return true
end
 
Back
Top