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

Lua I Need help in the script

hacuna

New Member
Joined
Sep 24, 2010
Messages
19
Reaction score
1
Hello Guys, someone can help me?

Lua:
function onStepIn (creature, item, position, fromposition)
    local player = creature:getplayer()
    if not player then
        return
    end
    if  creature:getplayer
        player:teleportTo(Position(32722, 32242, 8)
        player:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH)
        return true
    else
        player:teleportTo(Position(32614, 32269, 7)
        player:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH)
    end
    return true
end


erro: fount.lua:7: function arguments expected near 'player'
 
Change if creature:getplayer to if creature:getPlayer() then
But overall this script is bad.
You are checking if player is empty and return nothing.
Then you are trying to getPlayer once again, for no reason and check if getPlayer is not empty and do stuff on him.
else part won't even execute.

Fixed:
Lua:
function onStepIn (creature, item, position, fromposition)
    local player = creature:getPlayer()
    if player then
        player:teleportTo(Position(32722, 32242, 8))
        player:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH)
        return true
    end
    return false
end
 
Last edited:
Change if creature:getplayer to if creature:getPlayer() then
But overall this script is bad.
You are checking if player is empty and return nothing.
Then you are trying to getPlayer once again, for no reason and check if getPlayer is not empty and do stuff on him.
else part won't even execute.

Fixed:
Lua:
function onStepIn (creature, item, position, fromposition)
    local player = creature:getPlayer()
    if player then
        player:teleportTo(Position(32722, 32242, 8)
        player:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH)
        return true
    end
    return false
end


I do not know how to program, thank you very much for your help, but it is still giving error :(

[Warning - Event::checkScript] Can not load script: scripts/quests/forgotten knowledge/fount.lua
data/movements/scripts/quests/forgotten knowledge/fount.lua:5: ')' expected (to close '(' at line 4) near 'player'
 
I do not know how to program, thank you very much for your help, but it is still giving error :(

[Warning - Event::checkScript] Can not load script: scripts/quests/forgotten knowledge/fount.lua
data/movements/scripts/quests/forgotten knowledge/fount.lua:5: ')' expected (to close '(' at line 4) near 'player'
Made edit to previous post.
 
flBAO4u.jpg
 
I LOVE YOU. THANKS
Change if creature:getplayer to if creature:getPlayer() then
But overall this script is bad.
You are checking if player is empty and return nothing.
Then you are trying to getPlayer once again, for no reason and check if getPlayer is not empty and do stuff on him.
else part won't even execute.

Fixed:
Lua:
function onStepIn (creature, item, position, fromposition)
    local player = creature:getPlayer()
    if player then
        player:teleportTo(Position(32722, 32242, 8))
        player:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH)
        return true
    end
    return false
end
 
Back
Top