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

Solved Remove "item" when enter script

Legoland

Legoland OT
Joined
Mar 3, 2013
Messages
75
Reaction score
4
Location
Sweden
Hello otland! :)
I use: The Forgotten Server - Edited By Cyko V8, version 0.3.6 - Edited By Cyko V8 (Crying Damson - Edited By Cyko V8)
I need help with this script:


Code:
local tibleId = 5865
local pos = {x=923, y=1043, z=7}
function onStepIn(cid, item, position, fromPosition)
    if isPlayer(cid) == TRUE then
        if getPlayerItemCount(cid, tibleId) >= 100 then
            doTeleportThing(cid, pos, TRUE)
            doSendMagicEffect(pos, 10)
        else
            doTeleportThing(cid, fromPosition, TRUE)
            doSendMagicEffect(position, 10)
        end
    end
    return TRUE
end

I want this script to remove 100x of item 5865 when you enter the teleport but not if you access the door within 1 hour.

So if you walk into the teleport 01.32 it will charge you 100x of item 5865 but will not cost you anything until 02.32 :) 1 hour countdown until you most pay again.

I have no idea how to edit .lua scripts so i would appreciate your help alot!

Thank you for reading my thread! :)


#edit:

Also, how do i make item 5865 collected in 1 slot of 100x max like crystal coins? Thanks again!

#SOLUTION by Limos:
Code:
local pos = {x=923, y=1043, z=7}
local storage = 38745

function onStepIn(cid, item, position, fromPosition)

    if isPlayer(cid) then
        if exhaustion.check(cid, storage) then
            doTeleportThing(cid, pos)
            doSendMagicEffect(pos, CONST_ME_TELEPORT)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have "..math.floor(exhaustion.get(cid, storage)/60).." minutes left before you need to pay 100 juice coins again.")
            return true
        end
        if doPlayerRemoveItem(cid, 5865, 100) then
            doTeleportThing(cid, pos)
            doSendMagicEffect(pos, CONST_ME_TELEPORT)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have paid 100 juice coins and can now enter for 1 hour.")
            exhaustion.set(cid, storage, 60 * 60)
        else
            doTeleportThing(cid, fromPosition)
            doSendMagicEffect(position, CONST_ME_TELEPORT)
            doPlayerSendCancel(cid, "You need 100 juice coins to enter.")
        end
    end
    return true
end
 
Last edited:
Code:
local tibleId = 5865
local pos = {x=923, y=1043, z=7}
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) == TRUE then
if getPlayerItemCount(cid, tibleId) >= 100 then
doTeleportThing(cid, pos, TRUE)
doSendMagicEffect(pos, 10)
doRemoveItem(item.uid, 5865, 100)
else
doTeleportThing(cid, fromPosition, TRUE)
doSendMagicEffect(position, 10)
end
end
return TRUE
end
 
Thank you for your help! Do you also know how to edit the item 5865 so i can have 100x of them in 1 slot? atm i can only have 1x..

#edit:
the teleport doesnt work :/ i get teleported back..
 
Last edited:
Code:
local tibleId = 5865
local pos = {x=923, y=1043, z=7}
local fromposition = {x=1000, y=1000, z=7}

function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) == TRUE then
if getPlayerItemCount(cid, tibleId) >= 100 then
doTeleportThing(cid, pos, TRUE)
doSendMagicEffect(pos, 10)
doRemoveItem(item.uid, 5865, 100)
else
doTeleportThing(cid, fromPosition, TRUE)
doSendMagicEffect(position, 10)
end
end
return TRUE
end
 
Ofc, it lets you through if your a PLAYER, your on a god account.
Try this
Code:
local tibleId = 5865
local pos = {x=923, y=1043, z=7}
function onStepIn(cid, item, position, fromPosition)
if getPlayerGroupId(cid) >= 1 then
if getPlayerItemCount(cid, tibleId) >= 100 then
doTeleportThing(cid, pos, TRUE)
doSendMagicEffect(pos, 10)
doRemoveItem(item.uid, 5865, 100)
else
doTeleportThing(cid, fromPosition, TRUE)
doSendMagicEffect(position, 10)
end
end
return TRUE
end
@Legoland
 
Code:
local tibleId = 5865
function onStepIn(cid, item, position, fromPosition)
if getPlayerItemCount(cid, tibleId) >= 100 then
doTeleportThing(cid, pos, TRUE)
doSendMagicEffect(pos, 10)
doRemoveItem(item.uid, 5865, 100)
else
doTeleportThing(cid, fromPosition, TRUE)
doSendMagicEffect(position, 10)
end
end
return TRUE
end
@Legoland

Make sure you have the ID 5865, and 100 of them
 
Code:
[15/02/2014 17:03:01] [Error - LuaScriptInterface::loadFile] data/movements/scripts/gametoken1.lua:13: '<eof>' expected near 'end'
[15/02/2014 17:03:01] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/gametoken1.lua)
[15/02/2014 17:03:01] data/movements/scripts/gametoken1.lua:13: '<eof>' expected near 'end'
[15/02/2014 17:03:01] Reloaded movements.

i got the ID 5865 and 100 of them aswell.. you cant have the item 5865 stacked so i got bps full of them! haha! u know how to stack them?
 
this script take money to teleport you so pos

PHP:
function onStepIn(cid, item, position, fromPosition)
    if (isPlayer(cid) and getPlayerMoney(cid) >= 1000000) then
        doTeleportThing(cid, {x = 1207, y = 1152, z = 6}, true)
        doPlayerRemoveMoney(cid, 1000000)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You Lost 100 cc")
    else
        doPlayerSendCancel(cid, "You need 100 Crystal Coins To Go IN!")
        doTeleportThing(cid, fromPosition)
    end
    return true
end
 
nothing happens at all when i walk on the disk with that money script.. :/

what i need help with is to create a .lua script that removes 100x of item 5865 and in the script it should be a timer on 1 hour so you can travel trough the teleport for free after you paid the first time. after 1 hour you have to pay again..

i use:
Code:
        <movevent type="StepIn" actionid="20202" event="script" value="gametoken1.lua" />
Code:
local tibleId = 5865
local pos = {x=923, y=1043, z=7}
function onStepIn(cid, item, position, fromPosition)
if getPlayerGroupId(cid) >= 1 then
if getPlayerItemCount(cid, tibleId) >= 100 then
doTeleportThing(cid, pos, TRUE)
doSendMagicEffect(pos, 10)
doRemoveItem(item.uid, 5865, 100)
else
doTeleportThing(cid, fromPosition, TRUE)
doSendMagicEffect(position, 10)
end
end
return TRUE
end

and it wont work and has no timer for 1 hour of free traveling .. help any1? :/
 
Last edited by a moderator:
Code:
local pos = {x=923, y=1043, z=7}
local storage = 38745

function onStepIn(cid, item, position, fromPosition)

     if isPlayer(cid) then
         if exhaustion.check(cid, storage) then
             doTeleportThing(cid, pos)
             doSendMagicEffect(pos, CONST_ME_TELEPORT)
             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have "..math.floor(exhaustion.get(cid, storage)/60).." minutes left before you need to pay 100 juice coins again.")
             return true
         end
         if doPlayerRemoveItem(cid, 5865, 100) then
             doTeleportThing(cid, pos)
             doSendMagicEffect(pos, CONST_ME_TELEPORT)
             doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have paid 100 juice coins and can now enter for 1 hour.")
             exhaustion.set(cid, storage, 60 * 60)
         else
             doTeleportThing(cid, fromPosition)
             doSendMagicEffect(position, CONST_ME_TELEPORT)
             doPlayerSendCancel(cid, "You need 100 juice coins to enter.")
         end
     end
     return true
end
The exhaustion only works for players (so with gods you will have to pay 100 every time you go in the teleport).
 
Back
Top