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

TFS 1.0 | onStepIn tile vocation with possible payment restrictions

Its still a good script and it better that uses releases things like this then what I hate the most atm, the rlmap project(not trying to start a discussion) but this won't increase the download and run servers and will make it easier for other users to find what they serach for(if new users even does that now adays)...
Still I don't get why you seem to hate on uses releasing things like this script? Its a script that can help the community even if its not the best.
And PLEASE use code tags insted of php tags...
Don't see sense of releasing something that doesn't work correctly. Of course, he fixed it so it isn't "dangerous" but he should test it before (i'm not talking about few thousands test just one or two ~ only basic functionality).

I'm still waiting for Lua tags (php syntax is better than no syntax imo).
 
Don't see sense of releasing something that doesn't work correctly. Of course, he fixed it so it isn't "dangerous" but he should test it before (i'm not talking about few thousands test just one or two ~ only basic functionality).

I'm still waiting for Lua tags (php syntax is better than no syntax imo).

Its better to release something that atleast works rather then not releasing anything, someone might have use for this.
And ofc if he is unsure he should test it, but tbh I never test my scripts, but I get your point that if your new to lua its better to test it out.

Haha trust me im also waiting, even if what I understod it will probbly never happen, but to me its better with the code tags rather then some of the operators having a color.
 
This was hilarious, also it would be easier to read if you do
Code:
if not player then
  return false
end
and please use constants for Position.sendMagicEffect and other functions.
 
Code:
local config = {
    -- Where to teleport the player
    -- X , Y , Z
    position = Position(20, 323, 7),

    -- What vocation you need to enter?
    vocation = {1, 2, 3, 4},

    -- Enable cost to enter?
    -- This is 10 Crystal coins.
    itemCostEnable = true,
    itemID = 2160,
    itemCount = 10
}

function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
    if not player then
        return true
    end

    if not isInArray(config.vocation, player:getVocation():getId()) then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You dont have the right vocation to enter here.')
        player:teleportTo(fromPosition, true)
        fromPosition:sendMagicEffect(CONST_ME_HITBYFIRE)
        return true
    end

    if config.itemCostEnable and not player:removeItem(config.itemID, config.itemCount) then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You need ' .. config.itemCount .. 'x of ' .. ItemType(config.itemID):getName() .. ' to pass.')
        player:teleportTo(fromPosition, true)
        fromPosition:sendMagicEffect(CONST_ME_HITBYFIRE)
        return true
    end

    player:teleportTo(config.position, true)
    config.position:sendMagicEffect(CONST_ME_TELEPORT)
    return true
end
If you return ealier it often makes the script more readable and you don't get lost in huge conditional blocks. Constants help too.
Script is not tested but if I did not mess up a brace somewhere it should work.
 
Back
Top