• 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 x item to acces this area? Hunting room script. TFS 0.3.6 Windows

ohman

Member
Joined
Oct 24, 2008
Messages
289
Reaction score
5
Location
Sweden
Hi guys!! I found a script for hunting rooms here at otland. But it wasnt exacly as I wanted. Now its working like this: Go at x square, teleports you into the room, after 30 min you automatically tps out. But I want to have an "item required tp", so you need for example 1cc to go into the room. Here is the movement script for the enter square:

PHP:
function onStepIn(cid, item, pos, fromPosition) 
local storage_global = 16591 -- whenever the next room you need to change the value! 
if getGlobalStorageValue(storage_global) == -1 then 
    doPlayerSendTextMessage(cid, 25, 'You have 30 minutes in the hunting room.') 
    setGlobalStorageValue(storage_global, 1) 
    doTeleportThing(cid, {x=33134, y=32970, z=6}) -- Position sqm see picture (welcome) 
    return addEvent(function() 
        if isPlayer(cid) and getGlobalStorageValue(storage_global) == 1 then 
            doTeleportThing(cid, {x=33134, y=32976, z=6}) -- Position sqm see picture (end exp) 
            doPlayerSendTextMessage(cid, 25, 'Your time is over.') 
                return setGlobalStorageValue(storage_global, -1) 
                    end end, 
                    1 * 60 * 1000, -- How long exp 
                    cid, storage_global) 
else 
    doTeleportThing(cid, fromPosition) 
    return doPlayerSendTextMessage(cid, 25, 'Ktos juz sie znajduje w roomie lub nie posiadasz Vip Coin!') 
end 
return true 
end

Thanks!!
 
Code:
function onStepIn(cid, item, pos, fromPosition) 
local storage_global = 16591 -- whenever the next room you need to change the value! 
if getGlobalStorageValue(storage_global) == -1 then 
    doPlayerSendTextMessage(cid, 25, 'You have 30 minutes in the hunting room.') 
    setGlobalStorageValue(storage_global, 1) 
    doRemoveItem(item.uid, count)
    doTeleportThing(cid, {x=33134, y=32970, z=6}) -- Position sqm see picture (welcome) 
    return addEvent(function() 
        if isPlayer(cid) and getGlobalStorageValue(storage_global) == 1 then 
            doTeleportThing(cid, {x=33134, y=32976, z=6}) -- Position sqm see picture (end exp) 
            doPlayerSendTextMessage(cid, 25, 'Your time is over.') 
                return setGlobalStorageValue(storage_global, -1) 
                    end end, 
                    1 * 60 * 1000, -- How long exp 
                    cid, storage_global) 
else 
    doTeleportThing(cid, fromPosition) 
    return doPlayerSendTextMessage(cid, 25, 'Ktos juz sie znajduje w roomie lub nie posiadasz Vip Coin!') 
end 
return true 
end

doRemoveItem(item.uid, count) Change itemid and count.
not sure it works so
 
Make it an if statement

Lua:
if(doPlayerRemoveItem(cid, temid, count)) then
-- code here
else
doTeleportThing(cid, fromPosition)
end
 
hmm, I dont got it working :/ Where to put this? can it be 2 "then" after eachother? Doesnt it need to be 1 then and 1 else. Or.. what to change in the script? Because there is a text with: " doRemoveItem(item.uid, count)" what is item.uid? Thanks for the help!
 
Back
Top