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

Need a Script? Then I'm here to help!

I need a script!
I need the !online script to only show 3/4 online players. It will look like this...

!online
Code:
John [200], James [150], Test [120], ... See the rest at "www.yourwebsite.com."

try this

Lua:
local config = {
    showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}

function onSay(cid, words, param, channel)
    local players = {}
    local strings = {""}
    
    
    local tmp = getPlayersOnline()
    local toCount = math.floor(#tmp / 4) * 3    -- if there is 1 player online it should give errors in the next block.
    for i = 1, toCount do
        table.insert(players, tmp[i])
    end    

    local i, position = 1, 1
    local added = false
    for _, pid in ipairs(players) do
        if(added) then
            if(i > (position * 7)) then
                strings[position] = strings[position] .. ","
                position = position + 1
                strings[position] = ""
            else
                strings[position] = i == 1 and "" or strings[position] .. ", "
            end
        end

        if((config.showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
            strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
            i = i + 1
            added = true
        else
            added = false
        end
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) online:")
    for i, str in ipairs(strings) do
        if(str:sub(str:len()) ~= ",") then
            str = str .. "."
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str .. ".. See the rest at www.yourwebsite.com")
    end

    return true
end
 
So this is like this , Ex: You have a shovel and click on a present bag, if you clicked on somthng else you get a cancel msg, if you click on the present bag you have a 25% ration to win a item and a 75% ration to lose and in both ways you lose your shovel on use?
 
So this is like this , Ex: You have a shovel and click on a present bag, if you clicked on somthng else you get a cancel msg, if you click on the present bag you have a 25% ration to win a item and a 75% ration to lose and in both ways you lose your shovel on use?

isnt a object that you have to click use with, you click on the machine 8895 and if you have 2157 you have a 25% ration to win 2160 and 70% to lose one 2157 and yes, in both ways you lose one of 2157
 
Lua:
local c =	{
				winitem = 2160,   -- item that will be won
				winpercent = 25,    -- percent of win
				winitem_count = 1,  -- won item count
				items = 2193,    -- the item that player should have
				cancel_msg = "Sorry you dont have the right item."   -- msg he will get if he dont have the right item
				
			}
function onUse(cid, item, fromPosition, itemEx, toPosition)	
	if getPlayerItemCount(cid, c.items) >= 1 then
		if math.random(1,100) <= c.winpercent then
			doPlayerAddItem(cid,c.winitem,c.winitem_count)
			doRemoveItem(item.uid,1)
			doPlayerSendTextMessage(cid,19,"Congratulations!")
		else
			doRemoveItem(item.uid,1)
			doPlayerSendTextMessage(cid,27,"Try again!")
		end
	else
		doPlayerSendCancel(cid,c.cancel_msg)
	end
	return true
end
 
Last edited:
Make the !online command to show up in a Text Dialog popup

Lua:
local config = {
	showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}

function onSay(cid, words, param, channel)
	local players = getPlayersOnline()
	local strings = {""}

	local i, position = 1, 1
	local added = false
	for _, pid in ipairs(players) do
		if(added) then
			if(i > (position * 7)) then
				strings[position] = strings[position] .. ","
				position = position + 1
				strings[position] = ""
			else
				strings[position] = i == 1 and "" or strings[position] .. ", "
			end
		end

		if((config.showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
			strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
			i = i + 1
			added = true
		else
			added = false
		end
	end

	doShowTextDialog(cid, itemid, (i - 1) .. " player(s) online:")
	for i, str in ipairs(strings) do
		if(str:sub(str:len()) ~= ",") then
			str = str .. "."
		end

		doShowTextDialog(cid, itemid, text)
	end

	return true
end

if that one doesn't work then this one will:

Lua:
local config = {
	showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}

function onSay(cid, words, param, channel)
	local players = getPlayersOnline()
	local strings = {""}

	local i, position = 1, 1
	local added = false
	for _, pid in ipairs(players) do
		if(added) then
			if(i > (position * 7)) then
				strings[position] = strings[position] .. ","
				position = position + 1
				strings[position] = ""
			else
				strings[position] = i == 1 and "" or strings[position] .. ", "
			end
		end

		if((config.showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
			strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
			i = i + 1
			added = true
		else
			added = false
		end
	end

	doShowTextDialog(cid, itemid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) online:")
	for i, str in ipairs(strings) do
		if(str:sub(str:len()) ~= ",") then
			str = str .. "."
		end

		doShowTextDialog(cid, itemid, MESSAGE_STATUS_CONSOLE_BLUE)
	end

	return true
end
 
Hi , i need a script like anni. so if u stand on the 4 positions and pull a lever u will be teleported to another place . i can't find the script , :)
 
Do you want the script to summon monsters at the place u will be teleported too?
 
I think this will work, I was in a hurry..

Lua:
local config = {
	entry =
	{
		{x = 247, y = 659, z = 13},
		{x = 247, y = 660, z = 13},
		{x = 247, y = 661, z = 13},
		{x = 247, y = 662, z = 13}
	},
	destination =
	{
		{x = 189, y = 650, z = 13},
		{x = 189, y = 651, z = 13},
		{x = 189, y = 652, z = 13},
		{x = 189, y = 653, z = 13}
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1946 and itemEx.actionid == 9999 then
		doComparePositions(getCreaturePosition(cid), entry))
		doTeleportThing(cid, config.destination[i], true)
	elseif not isPlayer(cid) then
		doPlayerSendCancel("text")
	else
	end
end
 
Last edited:
I want mana fluids (its for old tibia):
  • Unlimited
  • Dont spill out when you use them standing on another person/ladder
Here is normal fluids.lua:
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)

function onUse(cid, item, frompos, item2, topos)
        if(hasCondition(cid, CONDITION_EXHAUSTED) == TRUE) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
	end
	if item2.itemid == 1 then
		if item.type == 0 then
			doPlayerSendCancel(cid, "It is empty.")
		else
			if item2.uid == cid then
				doChangeTypeItem(item.uid, 0)
				if item.type == 7 then
					new_mana = math.random(80, 160)
					doPlayerAddMana(cid, new_mana)
					doSendMagicEffect(topos, 12)
					doPlayerSay(cid, "Aaaah...", 1)
                              doAddCondition(cid, exhaust)
				elseif item.type == 10 then
					new_life = math.random(40, 80)
					doPlayerAddHealth(cid, new_life)
					doSendMagicEffect(topos, 12)
					doPlayerSay(cid, "Aaaah...", 1)
				else
					doPlayerSay(cid, "Gulp.", 1)
				end
			else
				doChangeTypeItem(item.uid, 0)
				splash = doCreateItem(2025, item.type, topos)
				doDecayItem(splash)
			end
		end
	elseif item2.itemid >= 490 and item2.itemid <= 517 
	or item2.itemid >= 618 and item2.itemid <= 629 
	or item2.itemid == 1368 or item2.itemid == 1369 
	or item2.itemid >= 4820 and item2.itemid <= 4825 
	or item2.itemid >= 4828 and item2.itemid <= 4831 
	or item2.itemid >= 4608 and item2.itemid <= 4666 then
		doChangeTypeItem(item.uid, 1)
	elseif item2.itemid == 103 then
		doChangeTypeItem(item.uid, 19)
	elseif item2.itemid >= 598 and item2.itemid < 601 
	or item2.itemid == 1509 
	or item2.itemid >= 518 and item2.itemid <= 529 then
		doChangeTypeItem(item.uid, 26)
	elseif item2.itemid >= 351 and item2.itemid <= 355 then
		doChangeTypeItem(item.uid, 19)
	elseif item2.itemid >= 602 and item2.itemid <= 605 
	or item2.itemid >= 4691 and item2.itemid <= 4755 
	or item2.itemid == 4758 then
		doChangeTypeItem(item.uid, 28)
	elseif item2.itemid == 1771 then
		doChangeTypeItem(item.uid, 1)
	elseif item2.itemid == 1772 then
		doChangeTypeItem(item.uid, 3)
	elseif item2.itemid == 1773 then
		doChangeTypeItem(item.uid, 15)
	elseif item2.itemid > 2806 and item2.itemid < 3132 
	or item2.itemid >= 4251 and item2.itemid <= 4327 then
		doChangeTypeItem(item.uid, 2)
	else
		if item.type == 0 then
			doPlayerSendCancel(cid, "It is empty.")
		else
			doChangeTypeItem(item.uid, 0)
			splash = doCreateItem(2025, item.type, topos)
			doDecayItem(splash)
		end
	end
	return 1
end

I must say its really nice of you to help people with this :) Hope its not too long to fix.
 
lol, I didn't feel like removing code, so here you are, it's another solution. It just changes the item type, to a new full mana fluid again, instead of making it empty :)

Lua:
local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)
 
function onUse(cid, item, frompos, item2, topos)
        if(hasCondition(cid, CONDITION_EXHAUSTED) == TRUE) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
	end
	if item2.itemid == 1 then
		if item.type == 0 then
			doPlayerSendCancel(cid, "It is empty.")
		else
			if item2.uid == cid then
				doChangeTypeItem(item.uid, 1)
				if item.type == 7 then
					new_mana = math.random(80, 160)
					doPlayerAddMana(cid, new_mana)
					doSendMagicEffect(topos, 12)
					doPlayerSay(cid, "Aaaah...", 1)
                              doAddCondition(cid, exhaust)
				elseif item.type == 10 then
					new_life = math.random(40, 80)
					doPlayerAddHealth(cid, new_life)
					doSendMagicEffect(topos, 12)
					doPlayerSay(cid, "Aaaah...", 1)
				else
					doPlayerSay(cid, "Gulp.", 1)
				end
			else
				doChangeTypeItem(item.uid, 1)
				splash = doCreateItem(2025, item.type, topos)
				doDecayItem(splash)
			end
		end
	elseif item2.itemid >= 490 and item2.itemid <= 517 
	or item2.itemid >= 618 and item2.itemid <= 629 
	or item2.itemid == 1368 or item2.itemid == 1369 
	or item2.itemid >= 4820 and item2.itemid <= 4825 
	or item2.itemid >= 4828 and item2.itemid <= 4831 
	or item2.itemid >= 4608 and item2.itemid <= 4666 then
		doChangeTypeItem(item.uid, 1)
	elseif item2.itemid == 103 then
		doChangeTypeItem(item.uid, 19)
	elseif item2.itemid >= 598 and item2.itemid < 601 
	or item2.itemid == 1509 
	or item2.itemid >= 518 and item2.itemid <= 529 then
		doChangeTypeItem(item.uid, 26)
	elseif item2.itemid >= 351 and item2.itemid <= 355 then
		doChangeTypeItem(item.uid, 19)
	elseif item2.itemid >= 602 and item2.itemid <= 605 
	or item2.itemid >= 4691 and item2.itemid <= 4755 
	or item2.itemid == 4758 then
		doChangeTypeItem(item.uid, 28)
	elseif item2.itemid == 1771 then
		doChangeTypeItem(item.uid, 1)
	elseif item2.itemid == 1772 then
		doChangeTypeItem(item.uid, 3)
	elseif item2.itemid == 1773 then
		doChangeTypeItem(item.uid, 15)
	elseif item2.itemid > 2806 and item2.itemid < 3132 
	or item2.itemid >= 4251 and item2.itemid <= 4327 then
		doChangeTypeItem(item.uid, 2)
	else
		if item.type == 0 then
			doPlayerSendCancel(cid, "It is empty.")
		else
			doChangeTypeItem(item.uid, 1)
			splash = doCreateItem(2025, item.type, topos)
			doDecayItem(splash)
		end
	end
	return 1
end
 
It dident work , i used the script then i used this in action

Try it out now, I did some small changes, but I'm rly tired tonight so can barely think right atm.
I'll do it for you tomorrow else, if it doesn't work and I promise it will tomorrow :p
 
Back
Top