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

Citizen Script PremiumAccount

Forkz

Well-Known Member
Joined
Jun 29, 2020
Messages
360
Solutions
1
Reaction score
76
Hi otlanders,

I use this script to become a resident of a city, however I would like to add that X city can only become a resident if it has "PremiumAccount". My premiumaccount system is from tibia itself.

Lua:
function onStepIn(cid, item, position, fromPosition)
    if(item.actionid > 30020 and item.actionid < 30100) then
        local townId = (item.actionid - 30020)
        doPlayerSetTown(cid, townId)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are the newest resident of " .. getTownName(townId) .. ".")
    end
    return true
end
 
Solution
Lua:
local config = {
    -- 1 is town ID
    [1] = {premium = true}
}
function onStepIn(cid, item, position, fromPosition)
    if(item.actionid > 30020 and item.actionid < 30100) then
        local townId = (item.actionid - 30020)
        if config[townId] then
            if config[townId].premium then
                if getPlayerPremiumDays(cid) <= 0 then
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to have a premium account.")
                    return doTeleportThing(cid, fromPosition)
                end
            end
        end
        doPlayerSetTown(cid, townId)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are the newest resident of " .. getTownName(townId) .. ".")
    end
    return...
Lua:
local config = {
    -- 1 is town ID
    [1] = {premium = true}
}
function onStepIn(cid, item, position, fromPosition)
    if(item.actionid > 30020 and item.actionid < 30100) then
        local townId = (item.actionid - 30020)
        if config[townId] then
            if config[townId].premium then
                if getPlayerPremiumDays(cid) <= 0 then
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to have a premium account.")
                    return doTeleportThing(cid, fromPosition)
                end
            end
        end
        doPlayerSetTown(cid, townId)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are the newest resident of " .. getTownName(townId) .. ".")
    end
    return true
end
 
Solution
Lua:
local config = {
    -- 1 is town ID
    [1] = {premium = true}
}
function onStepIn(cid, item, position, fromPosition)
    if(item.actionid > 30020 and item.actionid < 30100) then
        local townId = (item.actionid - 30020)
        if config[townId] then
            if config[townId].premium then
                if getPlayerPremiumDays(cid) <= 0 then
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to have a premium account.")
                    return doTeleportThing(cid, fromPosition)
                end
            end
        end
        doPlayerSetTown(cid, townId)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are the newest resident of " .. getTownName(townId) .. ".")
    end
    return true
end
OMG, perfect! Thanks <3
 
Back
Top