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

Help Script.

CesarZ

Well-Known Member
Joined
Sep 20, 2012
Messages
268
Solutions
4
Reaction score
63
Alright guys trying to learn how to write code and update script and this simple one is giving me trouble.
this is the changes i did.
Lua:
local failposition = Position(770, 934, 6)
function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
 
    if player:getPremiumDays() then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Welcome to Quick Hunting zone")
    else
        player:teleportTo(failposition)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need Premium Account to Pass")
            failposition:sendMagicEffect(CONST_ANI_ENERGYBALL)
         
    end
  return true
end

This is the script i tried to update to TFS 1.3 (is someone else script but im updating it)

Code:
local failPosition = Position(785, 971, 7)

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

    if player:isPremium() then
        return true
    end
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need Premium Account to Pass")
    failPosition:sendMagicEffect(CONST_ANI_ENERGYBALL)
    player:teleportTo(failPosition)
    return true
end

it used to work when i had TFS 1.0 now im working with TFS 1.3 is not giving me any error but is no working either
 
Last edited:
Alright guys trying to learn ow to write and update script and this simple one is giving me trouble.
this is the changes i did.
Lua:
local failposition = Position(770, 934, 6)
function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
   
    if player:getPremiumDays() then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Welcome to Quick Hunting zone")
    else
        player:teleportTo(failposition)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need Premium Account to Pass")
            failposition:sendMagicEffect(CONST_ANI_ENERGYBALL)
           
    end
  return true
end

This is the script i tried to update to TFS 1.3 (is someone else script but im updating it)

Code:
local failPosition = Position(785, 971, 7)

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

    if player:isPremium() then
        return true
    end
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need Premium Account to Pass")
    failPosition:sendMagicEffect(CONST_ANI_ENERGYBALL)
    player:teleportTo(failPosition)
    return true
end

it used to work when i had TFS 1.0 now im working with TFS 1.3
this is the error that is giving me. what symbol near then on my script is unexpected?
View attachment 53019
It is an error that you show in the image, it does not seem to match the code that I publish, and it is not a distribution error, it is just that you are typing wrong
you're adding a 'then' in the wrong place.

You should also know that this function will always be taken as true, since in lua any value that is not, false or null will be true:
player:getPremiumDays(), you should correctly convert the check like this: if player:getPremiumDays() > 0 then
 
It is an error that you show in the image, it does not seem to match the code that I publish, and it is not a distribution error, it is just that you are typing wrong
you're adding a 'then' in the wrong place.

You should also know that this function will always be taken as true, since in lua any value that is not, false or null will be true:
player:getPremiumDays(), you should correctly convert the check like this: if player:getPremiumDays() > 0 then
yea the error was from the Second Premiumtile script i took it off sorry for that.
it worked dude thanks a lot i updated the script to

Lua:
local failposition = Position(770, 934, 6)

function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
  
    if player:getPremiumDays() > 0 then
        player:teleportTo(failposition)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need Premium Account to Pass")
        failposition:sendMagicEffect(CONST_ANI_ENERGYBALL)
    else
      
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Welcome to Quick Hunting zone")
    end
    return true
end
it wasnt giving me any error but wasnt working either but now is good
 
Lua:
local failposition = Position(770, 934, 6)

function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return false
    end
    
    if creature:getPremiumDays() <= 0 then
        creature:teleportTo(failposition)
        failposition:sendMagicEffect(CONST_ANI_ENERGYBALL)
        creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need Premium Account to Pass.")
        return false
    end
    
    creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Welcome to Quick Hunting zone.")
    return true
end
 
Lua:
local failposition = Position(770, 934, 6)

function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return false
    end
   
    if creature:getPremiumDays() <= 0 then
        creature:teleportTo(failposition)
        failposition:sendMagicEffect(CONST_ANI_ENERGYBALL)
        creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need Premium Account to Pass.")
        return false
    end
   
    creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Welcome to Quick Hunting zone.")
    return true
end
it was working for non premium players and it won't let in premium players either. i see what you did here this one worked fine.
thanks guys
 
@Sarah Wesker @kubernik

It's till bad xD

I was testing it with Free account and it worked fine, but when i Tried it Premium today it kicked me as if i was free account. dammit. the script look fine. i dont understand whats the problem. Even made some adjustments to see if it worked but it didnt.

i try all script we posted here.
i also tried to


im stuck here
Lua:
local failposition = Position(770, 934, 6)
function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
   
    if player:getPremiumDays() <= 0 then
       
        player:teleportTo(failposition)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need Premium Account to Pass")
        failposition:sendMagicEffect(40)
        return false
    end
                   doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Welcome to Quick Hunting zone")
    return true
end

is there another way we can put it?

i thinking is a return problem OR the premiumDays() is not setup properly. but to me looks fine. im testing it on TFS 1.3 OTserverbr-Gloval 12.51.
Post automatically merged:

@Sarah Wesker @kubernik

It's till bad xD

I was testing it with Free account and it worked fine, but when i Tried it Premium today it kicked me as if i was free account. dammit. the script look fine. i dont understand whats the problem. Even made some adjustments to see if it worked but it didnt.

i try all script we posted here.
i also tried to


im stuck here
Lua:
local failposition = Position(770, 934, 6)
function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
  
    if player:getPremiumDays() <= 0 then
      
        player:teleportTo(failposition)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need Premium Account to Pass")
        failposition:sendMagicEffect(40)
        return false
    end
                   doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Welcome to Quick Hunting zone")
    return true
end

is there another way we can put it?

i thinking is a return problem OR the premiumDays() is not setup properly. but to me looks fine. im testing it on TFS 1.3 OTserverbr-Gloval 12.51 or probably is the server.
 
Back
Top