• 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 with my noob script

Eazy M

Developer
Joined
Oct 17, 2010
Messages
911
Reaction score
62
Location
.
Hello,

I need help with my noob/first script lol.

When i use it one time it summon three creatures (Orc)
And when i use it again it removes them.

My code:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local gain = 60
    if item.itemid == 2300 and getPlayerLevel(cid) >= 100 then
        doSummonCreature("Orc", pos)
        doSummonCreature("Orc", pos)
        doSummonCreature("orc", pos)
    else
        doPlayerSendCancel(cid,"You don't have the required level to use this.")
    end
    return TRUE
end

Help plax lol ;)
 
Code:
local config = {
	level = 100,
	pos = {x = 1, y = 2, z = 3},
	storage = 123456
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerLevel(cid) < config.level) then
		doPlayerSendCancel(cid,"You don't have the required level to use this.")
		return TRUE
	end

	local storage = getPlayerStorageValue(cid, storage)
	if(storage == -1) then
		local pos = getCreaturePos(cid)
		local c = {
			doSummonCreature("Orc", pos)
			doSummonCreature("Orc", pos)
			doSummonCreature("orc", pos)
		}

		if(not c[1]) then table.remove(c, 1) end
		if(not c[2]) then table.remove(c, 2) end
		if(not c[3]) then table.remove(c, 3) end

		if(table.maxn(t) > 0) then
			setPlayerStorageValue(cid, config.storage, table.concat(c, ","))
		end
	else
		for _, tmp in pairs(string.explode(storage, ",")) do
			if(isCreature(tmp)) then
				doRemoveCreature(tmp)
			end
		end
		setStorageValue(cid, config.storage, -1)
	end

	return TRUE
end
 
Back
Top