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

[OTX 2.6] Help with Scripts you can't drop items on teleport

jareczekjsp

Member
Joined
Jan 30, 2023
Messages
191
Reaction score
9
GitHub
Jarek123
[ENG]Hello Guys.I have a problem, how to make it impossible to throw items on the teleport? and I need a script "When I have no space in the backpack, I can't change the money and a message pops up that I can't change the money because I have no space in the backpack" can anyone help me?

[PL] Witam Wszystkich.Mam problem,jak zrobić zeby nie bylo mozna rzucac items na teleport?i potrzebuje scrypt "Kiedy nie mam miejsca w backpacku nie moge rozmienić pieniędzy i wyskakuje komunikat ze nie moge rozmienic pieniedzy poniewaz nie mam miejsca w backpacku" moze mi ktoś pomóc?
 
[ENG]Hello Guys.I have a problem, how to make it impossible to throw items on the teleport? and I need a script "When I have no space in the backpack, I can't change the money and a message pops up that I can't change the money because I have no space in the backpack" can anyone help me?

[PL] Witam Wszystkich.Mam problem,jak zrobić zeby nie bylo mozna rzucac items na teleport?i potrzebuje scrypt "Kiedy nie mam miejsca w backpacku nie moge rozmienić pieniędzy i wyskakuje komunikat ze nie moge rozmienic pieniedzy poniewaz nie mam miejsca w backpacku" moze mi ktoś pomóc?
If you need help, you have to provide at least some minimal information: for example which server you use. I am assuming it is tfs 1x.
In the folder data/events/scripts/
open player.lua
and add inside the function:
Lua:
function Player:onMoveItem(item, count, fromPosition, toPosition)
this:
Lua:
    local tile = toPosition:getTile()
    if tile then
        local thing = tile:getItemByType(ITEM_TYPE_TELEPORT)
        if thing then
            self:sendCancelMessage('Sorry, not possible.')
            self:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end
 
Thanks for helm but I cant find Player.lua and I have OTX Engine and I dont have a folder Event Can you help me?where I can put this script
Post automatically merged:

OTX Engine Server client is 8.60
 
Thanks for helm but I cant find Player.lua and I have OTX Engine and I dont have a folder Event Can you help me?where I can put this script
Post automatically merged:

OTX Engine Server client is 8.60
Saying you use OTX Engine Server client is 8.60 doesn't help, there are many OTX versions that work with 8.60 client
You must provide the engine version, not the client version.
Examples:
1677204657154.png
When you start your server, a message should appear on the console that gives you this information.
 
I don't know or use that engine, but according to the sources that are on github this code should work:
data/creaturescripts/creaturescripts.xml
XML:
<event type="moveitem" name="MoveItem" event="script" value="test.lua"/>

data/creaturescripts/scripts/test.lua
Lua:
function onMoveItem(moveItem, frompos, position, cid)
    if getTileItemByType(position, ITEM_TYPE_TELEPORT).uid == 0 then
        return TRUE
    end

    doPlayerSendCancel(cid, "You cannot move items into a teleport.")
    doSendMagicEffect(position, CONST_ME_POFF)
    return FALSE
end

If it doesn't work then it's already a problem with your engine and you have no other alternatives than to change to another engine or make a change in your sources and compile your own engine.
 
Not Working;/ ,Meybe you have a script when you dont have place in backpack you can not change money?because player when chamhe money and dont have place in backpack money go to floor
 

Similar threads

Back
Top