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

[Tutorial] First login tutorial

Fallen

Freelancer
Senator
Joined
Aug 21, 2009
Messages
3,712
Reaction score
250
Location
Egypt
Credits to Nahruto!
LUA:
local config = 
    {
        tilepos1 = {x=200, y=200, z=7},
        tilepos2 = {x=200, y=200, z=7},
        tilepos3 = {x=200, y=200, z=7},
        tilepos4 = {x=200, y=200, z=7},
        playerlevel = 20,
        effects = {0, 10, 39},
        str1 = "Welcome to " .. getConfigValue("Server Name") .. ", Please go down the stairs to complete your tour.",
        str2 = "To start your tour please enter the teleport.",
        str3 = "All right now Click on the sewer gate and kill slimes, after You get level 20 go back to the depot and you will get teleported to get your new promotion.",
        str4 = "Talk to [Npc Name] to get your promotion!",
        str5 = "Congratulations! You\'ve completed the tutorial sucessfully!"
    }
    
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local myTable = 
    {
        [10031] = {stor = 9531, tp = true, pos = config.tilepos2, str = config.str1, lvl = 0},
        [10032] = {stor = 9532, tp = true, pos = config.tilepos3, str = config.str2, lvl = 0},
        [10033] = {stor = 9533, tp = false, pos = nil, str = config.str3, lvl = 0},
        [10034] = {stor = 9534, tp = false, pos = config.tilepos4, str = config.str4, lvl = config.playerlevel}
    
    }
    if isPlayer(cid) then
        local action = myTable[item.actionid]
        if action then
            if (getPlayerStorageValue(cid, action.stor) == -1) then
                if (getPlayerLevel(cid) >= action.playerlevel) then
                    doPlayerPopupFYI(cid, action.str)
                    setPlayerStorageValue(cid, action.stor, 1)
                    if action.pos then
                        doSendMagicEffect(action.pos, 55)
                        if action.tp then
                            doTeleportThing(cid, action.pos)
                        end
                    end
                    for i = 1, #config.effect do
                        doSendMagicEffect(getPlayerPosition(cid), effect[i])
                    end
                else
                    doPlayerSendCancel(cid, "You\'ve not reached level " .. action.playerlevel .. " or higher yet.")
                end
            else
                doPlayerSendCancel(cid, "You\'ve completed that once.")
            end
        end
    end
    return true
end
:peace:
 
Last edited:
LUA:
local config = {
    tilepos1 = {x=200, y=200, z=7},
    tilepos2 = {x=200, y=200, z=7},
    tilepos3 = {x=200, y=200, z=7},
    tilepos4 = {x=200, y=200, z=7},
    playerlevel = 20,
    effects = {0,10,39},
    str1 = "Welcome to Forgotten, Please go down the stairs to complete your tour.",
    str2 = "To start your tour please enter the teleport.",
    str3 = "All right now Click on the sewer gate and kill slimes, after You get level 20 go back to the depot and you will get teleported to get your new promotion.",
    str4 = "Talk to [Npc Name] to get your promotion!",
    str5 = "Congratulations! You\'ve completed the tutorial sucessfully!"
}
function onStepIn(cid, item, frompos, item2, topos)
    local gettilepos1 = getThingfromPos(tilepos1)
    local gettilepos2 = getThingfromPos(tilepos2)
    local gettilepos3 = getThingfromPos(tilepos3)
    local gettilepos4 = getThingfromPos(tilepos4)
    if isPlayer(cid) == TRUE then
        if item.actionid == 10031 then
            if getPlayerStorageValue(cid,9531) == -1 then
                doSendMagicEffect(tilepos2, 55)
                doPlayerPopupFYI(cid, config.str1)
                setPlayerStorageValue(cid, 9531, 1)
                doTeleportThing(cid, config.tilepos2)
                for i=1, #config.effect do
                    doSendMagicEffect(getPlayerPosition(cid), effect[i])
                end
            else
                doPlayerSendCancel(cid, "You\'ve completed that once.")
            end
        elseif item.actionid == 10032 then
            if getPlayerStorageValue(cid,9532) == -1 then
                doSendMagicEffect(tilepos3, 55)
                doPlayerPopupFYI(cid, config.str2)
                setPlayerStorageValue(cid,9532,1)
                doTeleportThing(cid, config.tilepos3)
                for i=1, #config.effect do
                    doSendMagicEffect(getPlayerPosition(cid), effect[i])
                end
            else
                doPlayerSendCancel(cid, "You\'ve completed that once.")
            end
        elseif item.actionid == 10033 then
            if getPlayerStorageValue(cid,9533) == -1 then
                doPlayerPopupFYI(cid, config.str3)
                setPlayerStorageValue(cid,9533,1)
            else
                doPlayerSendCancel(cid, "You\'ve completed that once.")
            end
        elseif item.actionid == 10034 then
            if getPlayerStorageValue(cid,9534) == -1 and getPlayerLevel(cid) >= config.playerlevel then
                doSendMagicEffect(tilepos4, 55)
                doPlayerPopupFYI(cid, config.str4)
                for i=1, #config.effect do
                    doSendMagicEffect(getPlayerPosition(cid), effect[i])
                    setPlayerStorageValue(cid,9534,1)
                end
            else
                doPlayerSendCancel(cid, "You\'ve not reached level 20 or higher yet or You\'ve already done this before.")
            end
        end
    end
end

@JDB's post that worked here it is:
LUA:
local config = {
    tilepos1 = {x=200, y=200, z=7},
    tilepos2 = {x=200, y=200, z=7},
    tilepos3 = {x=200, y=200, z=7},
    tilepos4 = {x=200, y=200, z=7},
    playerlevel = 20,
    effects = {0,10,39},
    str1 = "Welcome to Forgotten, Please go down the stairs to complete your tour.",
    str2 = "To start your tour please enter the teleport.",
    str3 = "All right now Click on the sewer gate and kill slimes, after You get level 20 go back to the depot and you will get teleported to get your new promotion.",
    str4 = "Talk to [Npc Name] to get your promotion!",
    str5 = "Congratulations! You\'ve completed the tutorial sucessfully!"
}
function onStepIn(cid, item, frompos, item2, topos)
    local gettilepos1 = getThingfromPos(tilepos1)
    local gettilepos2 = getThingfromPos(tilepos2)
    local gettilepos3 = getThingfromPos(tilepos3)
    local gettilepos4 = getThingfromPos(tilepos4)
    if isPlayer(cid) == true and item.actionid == 10031 and getPlayerStorageValue(cid,9531) == -1 then
            doSendMagicEffect(config.tilepos2, 55)
            doPlayerPopupFYI(cid, config.str1)
            doTeleportThing(cid, config.tilepos2)
            setPlayerStorageValue(cid, 9531, 1)
            for i=1, #config.effect do
                 doSendMagicEffect(getPlayerPosition(cid), effect[i])
            end
end
    end
    if item.actionid == 10032 and getPlayerStorageValue(cid,9532) == -1 then
            doSendMagicEffect(config.tilepos3, 55)
            doPlayerPopupFYI(cid, config.str2)
            doTeleportThing(cid, config.tilepos3)
            setPlayerStorageValue(cid,9532,1)
            for i=1, #config.effect do
             doSendMagicEffect(getPlayerPosition(cid), effect[i])
            end
            if getPlayerStorageValue(cid, 9532) == 1 then
              return false
            end
    end
    if item.actionid == 10033 and getPlayerStorageValue(cid,9533) == -1 then
            doPlayerPopupFYI(cid, config.str3)
            setPlayerStorageValue(cid,9533,1)
            if getPlayerStorageValue(cid, 9533) == 1 then
               return false
            end
    end
    if item.actionid == 10034 and getPlayerStorageValue(cid,9534) == -1 and getPlayerLevel(cid) >= config.playerlevel then
            doSendMagicEffect(config.tilepos4, 55)
            doPlayerPopupFYI(cid, config.str4)
            setPlayerStorageValue(cid,9534,1)
            for i=1, #config.effect do
                doSendMagicEffect(getPlayerPosition(cid), effect[i])
            end
            if not getPlayerLevel(cid) >= config.level then
               return doPlayerPopupFYI(cid, "You haven\'t reached level 20 or higher yet")
            end
    end
 
Last edited:
LUA:
local config = 
    {
        tilepos1 = {x=200, y=200, z=7},
        tilepos2 = {x=200, y=200, z=7},
        tilepos3 = {x=200, y=200, z=7},
        tilepos4 = {x=200, y=200, z=7},
        playerlevel = 20,
        effects = {0, 10, 39},
        str1 = "Welcome to " .. getConfigValue("Server Name") .. ", Please go down the stairs to complete your tour.",
        str2 = "To start your tour please enter the teleport.",
        str3 = "All right now Click on the sewer gate and kill slimes, after You get level 20 go back to the depot and you will get teleported to get your new promotion.",
        str4 = "Talk to [Npc Name] to get your promotion!",
        str5 = "Congratulations! You\'ve completed the tutorial sucessfully!"
    }
    
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local myTable = 
    {
        [10031] = {stor = 9531, tp = true, pos = config.tilepos2, str = config.str1, lvl = 0},
        [10032] = {stor = 9532, tp = true, pos = config.tilepos3, str = config.str2, lvl = 0},
        [10033] = {stor = 9533, tp = false, pos = nil, str = config.str3, lvl = 0},
        [10034] = {stor = 9534, tp = false, pos = config.tilepos4, str = config.str4, lvl = config.playerlevel}
    
    }
    if isPlayer(cid) then
        local action = myTable[item.actionid]
        if action then
            if (getPlayerStorageValue(cid, action.stor) == -1) then
                if (getPlayerLevel(cid) >= action.playerlevel) then
                    doPlayerPopupFYI(cid, action.str)
                    setPlayerStorageValue(cid, action.stor, 1)
                    if action.pos then
                        doSendMagicEffect(action.pos, 55)
                        if action.tp then
                            doTeleportThing(cid, action.pos)
                        end
                    end
                    for i = 1, #config.effect do
                        doSendMagicEffect(getPlayerPosition(cid), effect[i])
                    end
                else
                    doPlayerSendCancel(cid, "You\'ve not reached level " .. action.playerlevel .. " or higher yet.")
                end
            else
                doPlayerSendCancel(cid, "You\'ve completed that once.")
            end
        end
    end
    return true
end
 
Script:
LUA:
local config = 
    {
        tilepos1 = {x=200, y=200, z=7},
        tilepos2 = {x=200, y=200, z=7},
        tilepos3 = {x=200, y=200, z=7},
        tilepos4 = {x=200, y=200, z=7},
        playerlevel = 20,
        effects = {0, 10, 39},
        str1 = "Welcome to " .. getConfigValue("serverName") .. ", Please go down the stairs to complete your tour.",
        str2 = "To start your tour please enter the teleport.",
        str3 = "All right now Click on the sewer gate and kill slimes, after You get level 20 go back to the depot and you will get teleported to get your new promotion.",
        str4 = "Talk to [Npc Name] to get your promotion!",
        str5 = "Congratulations! You\'ve completed the tutorial sucessfully!"
    }
    
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local myTable = 
    {
        [10031] = {stor = 9531, tp = true, pos = config.tilepos2, str = config.str1, lvl = 0},
        [10032] = {stor = 9532, tp = true, pos = config.tilepos3, str = config.str2, lvl = 0},
        [10033] = {stor = 9533, tp = false, pos = nil, str = config.str3, lvl = 0},
        [10034] = {stor = 9534, tp = false, pos = config.tilepos4, str = config.str4, lvl = config.playerlevel}
    
    }
    if isPlayer(cid) then
        local action = myTable[item.actionid]
        if action then
            if (getPlayerStorageValue(cid, action.stor) == -1) then
                if (getPlayerLevel(cid) >= action.playerlevel) then
                    doPlayerPopupFYI(cid, action.str)
                    setPlayerStorageValue(cid, action.stor, 1)
                    if action.pos then
                        doSendMagicEffect(action.pos, 55)
                        if action.tp then
                            doTeleportThing(cid, action.pos)
                        end
                    end
                    for i = 1, #config.effect do
                        doSendMagicEffect(getPlayerPosition(cid), effect[i])
                    end
                else
                    doPlayerSendCancel(cid, "You\'ve not reached level " .. action.playerlevel .. " or higher yet.")
                end
            else
                doPlayerSendCancel(cid, "You\'ve completed that once.")
            end
        end
    end
    return true
end

Error:
input:9: attempt to call global 'getConfigValue' (a nil value)

Have fun
 
Code:
local function getConfigValue(info)
	if (type(info) ~= 'string') then return nil end

	dofile('config.lua')
	return _G[info]
end
local config = {
	tilepos1 = {x=200, y=200, z=7},
	tilepos2 = {x=200, y=200, z=7},
	tilepos3 = {x=200, y=200, z=7},
	tilepos4 = {x=200, y=200, z=7},
	playerlevel = 20,
	effects = {0, 10, 39},
	str1 = "Welcome to " .. getConfigValue("serverName") .. ", Please go down the stairs to complete your tour.",
	str2 = "To start your tour please enter the teleport.",
	str3 = "All right now Click on the sewer gate and kill slimes, after You get level 20 go back to the depot and you will get teleported to get your new promotion.",
	str4 = "Talk to [Npc Name] to get your promotion!",
	str5 = "Congratulations! You've completed the tutorial sucessfully!"
}
local myTable = {
	[10031] = {stor = 9531, tp = true, pos = config.tilepos2, str = config.str1, lvl = 0},
	[10032] = {stor = 9532, tp = true, pos = config.tilepos3, str = config.str2, lvl = 0},
	[10033] = {stor = 9533, tp = false, pos = nil, str = config.str3, lvl = 0},
	[10034] = {stor = 9534, tp = false, pos = config.tilepos4, str = config.str4, lvl = config.playerlevel}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(cid) then
		local action = myTable[item.actionid]
		if action then
			if getPlayerStorageValue(cid, action.stor) < 1 then
				if getPlayerLevel(cid) >= action.playerlevel then
					doPlayerPopupFYI(cid, action.str)
					setPlayerStorageValue(cid, action.stor, 1)
					if action.pos then
						doSendMagicEffect(action.pos, 55)
						if action.tp then
							doTeleportThing(cid, action.pos)
						end
					end
					for i = 1, #config.effect do
						doSendMagicEffect(getPlayerPosition(cid), effect[i])
					end
				else
					doPlayerSendCancel(cid, "You've not reached level " .. action.playerlevel .. " or higher yet.")
				end
			else
				doPlayerSendCancel(cid, "You've completed that once.")
			end
		end
	end
	return true
end
 
Back
Top