• 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 Checkpoint system help.

highclick

New Member
Joined
Mar 21, 2011
Messages
80
Reaction score
4
Hi guys! I found this checkpoint system available: http://otland.net/threads/advanced-checkpoint-system.172371/

I tried it out, followed all steps but I can't get it working.

I am using TFS 0.3.6

I get NO errors in the console. Literally nothing happens in game, at all.

Does anyone know how too solve this? Or if there is another checkpoint system i can try out?


Here are my scripts:

PHP:
    <movevent type="StepIn" actionid="100" event="script" value="checkpoint.lua"/>
    <movevent type="StepIn" actionid="1001" event="script" value="opencheckpointdialog.lua"/>
    <movevent type="StepOut" actionid="1001" event="script" value="opencheckpointdialog.lua"/>

PHP:
local otswe = {
storage_on_enter_tile = 1000,
first_time_enter_tile = "CHECKPOINT!",
already_enter_the_tile = "Sorry, but you already entered this checkpoint tile."
}

function onStepIn(cid, item, position, fromPosition)
if not(isPlayer(cid)) then return true end
if getPlayerStorageValue(cid, otswe.storage_on_enter_tile) == -1 then
setPlayerStorageValue(cid, otswe.storage_on_enter_tile, 1)
doCreatureSay(cid, otswe.first_time_enter_tile, TALKTYPE_MONSTER)
else
doPlayerSendTextMessage(cid,20, otswe.already_enter_the_tile)
end
end

PHP:
local message = "Here can you chose your latest check points"
local open_storage = 5555 -- make sure use a empty storage

function dialog(cid)
if isPlayer(cid) then
openChannelDialog(cid)
end
end

function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
doPlayerPopupFYI(cid, message)
addEvent(dialog, 1*1, cid)
setPlayerGroupId(cid, 7)
setPlayerStorageValue(cid, open_storage, 1)
end
end

function onStepOut(cid, item, position, fromPosition)
if isPlayer(cid) then
setPlayerGroupId(cid, 1)
setPlayerStorageValue(cid, open_storage, -1)
end
end

PHP:
<?xml version="1.0" encoding="UTF-8"?>
<channels>
    <!-- README:
        0 - dynamic, reserved for guilds
        1 - always acts as Party channel, only "name" tag available
        3 - always acts as Rule Violations channel
        9 - acts as Help channel- clientsided message
        65535 - DO NOT CHANGE THE ID- only "name", "enabled", "active" and "logged" tags available
    -->
    <channel id="1" name="Party" access="1"/>
    <channel id="2" name="Staff" access="1"/>
    <channel id="3" name="Rule Violations" logged="yes" access="1"/>
    <channel id="4" name="Counselor" access="1"/>
    <channel id="5" name="Game-Chat" level="1" access="1"/>
    <channel id="6" name="Trade" level="8" muted="120" conditionId="2" conditionMessage="You may only place one offer in two minutes." access="1">
        <vocation id="1-8"/>
    </channel>
    <channel id="7" name="Trade-Rookgaard" level="2" muted="120" conditionId="3" conditionMessage="You may only place one offer in two minutes." access="1">
        <vocation id="0"/>
    </channel>
    <channel id="8" name="RL-Chat" level="2" access="1"/>
    <channel id="9" name="Help" logged="yes" access="1"/>
    <!-- <channel id="10" name="My Custom Channel"/> -->
    <channel id="65535" name="Private Chat Channel" access="1"/>
   
    <!-- Checkpoint-->
    <!--////////////////////Dungeons Channels/////////////-->
    <channel id="20" name="Dark Dungeon" access="0"/>
    <channel id="21" name="Spooky House" access="0"/>
    <!--////////////////////Dungeons Channels/////////////-->
</channels>

PHP:
<?xml version="1.0" encoding="UTF-8"?>
<groups>
    <group id="1" access="1" name="Player"/>
    <group id="2" name="Tutor" flags="16809984" customFlags="2" access="1" violationReasons="4" nameViolationFlags="2"/>
    <group id="3" name="Senior Tutor" flags="68736352256" customFlags="14" access="2" violationReasons="10" nameViolationFlags="2" statementViolationFlags="63" maxVips="200"/>
    <group id="4" name="Gamemaster" flags="3808558964575" customFlags="257215" access="3" violationReasons="19" nameViolationFlags="10" statementViolationFlags="69" depotLimit="3000" maxVips="300" outfit="75"/>
    <group id="5" name="Community Manager" flags="3840774348794" customFlags="781823" access="4" violationReasons="23" nameViolationFlags="42" statementViolationFlags="213" depotLimit="4000" maxVips="400" outfit="266"/>
    <group id="6" name="Owner" flags="3845069447162" customFlags="2097151" access="5" violationReasons="23" nameViolationFlags="426" statementViolationFlags="469" depotLimit="5000" maxVips="500" outfit="302"/>
    <group id="7" access="0" name="Player"/>
</groups>

PHP:
    <event type="joinchannel" name="CheckJoin" event="script" value="checkpointsystem.lua"/> <!-- Checkpoint system -->
    <event type="leavechannel" name="CheckLeave" event="script" value="checkpointsystem.lua"/> <!-- Checkpoint system -->

PHP:
local otswe =
{
cave1 =
{
[1000] = {pos1 = { x = 1129, y = 1112, z = 7 , stackpos = 1 }},
[1001] = {pos1 = { x = 1129, y = 1112, z = 8 , stackpos = 1 }},  --The first box is the storage to get teleported to the first check point.
},
cave2 =
{
[1002] = {pos1 = { x = 1251, y = 1132, z = 8 , stackpos = 1 }},
[1003] = {pos1 = { x = 1251, y = 1130, z = 7 , stackpos = 1 }}  --The first box is the storage to get teleported to the first check point.
}
}


function onJoinChannel(cid, channelId, users)
if getPlayerStorageValue(cid, 5555) == -1 then
doPlayerSendTextMessage(cid,20, "Sorry, but you are at the wrong place to use any of these check points.")
return false
end
if channelId == 20 then
if getPlayerStorageValue(cid, otswe.cave1[1000]) == 1 then
doTeleportThing(cid, otswe.cave1[1000].pos1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
if getPlayerStorageValue(cid, otswe.cave1[1001]) == 1 then
doTeleportThing(cid, otswe.cave1[1001].pos2)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
else
doPlayerSendTextMessage(cid,20, "You dont have any check points in this place.")   
openChannelDialog(cid)
end
return false
end
if channelId == 21 then
if getPlayerStorageValue(cid, otswe.cave2[1002]) == 1 then
doTeleportThing(cid, otswe.cave2[1002].pos1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
if getPlayerStorageValue(cid, otswe.cave2[1003]) == 1 then
doTeleportThing(cid, otswe.cave2[1003].pos2)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
else
doPlayerSendTextMessage(cid,20, "You dont have any check points in this place.")
openChannelDialog(cid)
end   
return false
end
end


function onLeaveChannel(cid, channelId, users)
if channelId >= 20 and channelId <= 21 then
doPlayerSetGroupId(cid, 1)
end
return true
end

Code:
local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
if getPlayerGroupId(cid) == 7 then
setPlayerGroupId(cid, 1)   
end
if getPlayerStorageValue(cid, 5555) == 1 then
setPlayerStorageValue(cid, 5555, -1)
end
    if (getConfigValue("accountManager") == FALSE and getCreatureName(cid) == "Account Manager") then
        return false
    end

    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid,'SpellUp')


    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end

    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")
    return true
end
 
checkpoint dialog
Code:
local message = "Here can you chose your latest check points"
local open_storage = 5555 -- make sure use a empty storage

function dialog(cid)
    if isPlayer(cid) then
        openChannelDialog(cid)
    end
end

function onStepIn(cid, item, position, fromPosition)
    if isPlayer(cid) and getPlayerStorageValue() == -1 then
        doPlayerPopupFYI(cid, message)
        addEvent(dialog, 1, cid)
        setPlayerGroupId(cid, 7)
        setPlayerStorageValue(cid, open_storage, 1)
    end
    return true
end

function onStepOut(cid, item, position, fromPosition)
    if isPlayer(cid) then
        setPlayerGroupId(cid, 1)
        setPlayerStorageValue(cid, open_storage, -1)
    end
    return true
end
 
checkpoint.lua
edited
Code:
local otswe = {
    storage_on_enter_tile = 1000,
    first_time_enter_tile = "CHECKPOINT!",
    already_enter_the_tile = "Sorry, but you already entered this checkpoint tile."
}

function onStepIn(cid, item, position, fromPosition)
    if not isPlayer(cid) then
        return true
    end
    if getPlayerStorageValue(cid, otswe.storage_on_enter_tile) == -1 then
        setPlayerStorageValue(cid, otswe.storage_on_enter_tile, 1)
        doCreatureSay(cid, otswe.first_time_enter_tile, TALKTYPE_MONSTER)
    else
        doPlayerSendTextMessage(cid,20, otswe.already_enter_the_tile)
        doTeleportThing(cid, fromPosition)
        return false
    end
    return true
end
 
Last edited:
checkpoint system
Code:
local otswe =
{
    cave1 =
    {
        [1000] = {
            pos1 = {
                x = 1129, y = 1112, z = 7 , stackpos = 1
            }
        },
        [1001] = {
            pos1 = {
                x = 1129, y = 1112, z = 8 , stackpos = 1
            }
        },  --The first box is the storage to get teleported to the first check point.
    },
    cave2 =
    {
        [1002] = {
            pos1 = {
                x = 1251, y = 1132, z = 8 , stackpos = 1
            }
        },
        [1003] = {
            pos1 = {
                x = 1251, y = 1130, z = 7 , stackpos = 1
            }
        }  --The first box is the storage to get teleported to the first check point.
    }
}


function onJoinChannel(cid, channelId, users)
    if getPlayerStorageValue(cid, 5555) == -1 then
        doPlayerSendTextMessage(cid,20, "Sorry, but you are at the wrong place to use any of these check points.")
        return false
    end
    if channelId == 20 then
        if getPlayerStorageValue(cid, otswe.cave1[1000]) == 1 then
            doTeleportThing(cid, otswe.cave1[1000].pos1)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
        end
        if getPlayerStorageValue(cid, otswe.cave1[1001]) == 1 then
            doTeleportThing(cid, otswe.cave1[1001].pos2)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
        else
            doPlayerSendTextMessage(cid,20, "You dont have any check points in this place.")  
            openChannelDialog(cid)
        end
        return false
    end
    if channelId == 21 then
        if getPlayerStorageValue(cid, otswe.cave2[1002]) == 1 then
            doTeleportThing(cid, otswe.cave2[1002].pos1)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
        end
        if getPlayerStorageValue(cid, otswe.cave2[1003]) == 1 then
            doTeleportThing(cid, otswe.cave2[1003].pos2)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
        else
            doPlayerSendTextMessage(cid,20, "You dont have any check points in this place.")
            openChannelDialog(cid)
        end  
        return false
    end
    return true
end


function onLeaveChannel(cid, channelId, users)
    if channelId >= 20 and channelId <= 21 then
        doPlayerSetGroupId(cid, 1)
    end
    return true
end
 
login.lua
Code:
local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    if getPlayerGroupId(cid) == 7 then
        setPlayerGroupId(cid, 1)  
    end
    if getPlayerStorageValue(cid, 5555) == 1 then
        setPlayerStorageValue(cid, 5555, -1)
    end
    if (getConfigValue("accountManager") == FALSE and getCreatureName(cid) == "Account Manager") then
        return false
    end

    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid,'SpellUp')


    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end

    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")
    return true
end
 
login.lua
Code:
local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    if getPlayerGroupId(cid) == 7 then
        setPlayerGroupId(cid, 1) 
    end
    if getPlayerStorageValue(cid, 5555) == 1 then
        setPlayerStorageValue(cid, 5555, -1)
    end
    if (getConfigValue("accountManager") == FALSE and getCreatureName(cid) == "Account Manager") then
        return false
    end

    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid,'SpellUp')


    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end

    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")
    return true
end


Thank you very much for your time!

It still doesn't work. No errors at all, just when i step on the positions, nothing happens, at all. Any clue what to do next?
 
Thank you very much for your time!

It still doesn't work. No errors at all, just when i step on the positions, nothing happens, at all. Any clue what to do next?
Sorry I just cleaned up the code, did you just copy and paste the code above or did you write any of it yourself?
This is important to know, for me atleast.. unless someone else jumps in on this and doesn't require this information.
 
I don't think I will be able to help you with this since I am not familiar with this distro :(
 
Last edited:
Back
Top