• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Create monster with exhtaush

Gcr

New Member
Joined
Apr 23, 2010
Messages
2
Reaction score
0
Create monster with exhtaush

Data/Actions/Scripts.NAME.LUA
Lua:
local positions = {
    {"Demon", {x = 1000, y = 1000, z = 7}},
    {"Demon", {x = 2000, y = 2000, z = 7}},
    {"Demon", {x = 3000, y = 3000, z = 7}},
    {"Demon", {x = 4000, y = 4000, z = 7}},
    {"Demon", {x = 5000, y = 5000, z = 7}}
}

local exh = 30 
local storage = 1905
function onUse(cid, item, frompos, item2, topos)
    for i = 1, #positions do
        doCreateMonster(positions[i][1], positions[i][2])
    end
        if(getPlayerStorageValue(cid, storage) <= os.time()) then
            setPlayerStorageValue(cid, storage, os.time()+ exh)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Fight awaits you Demons!")
        else
            doPlayerSendCancel(cid, "You have to wait ".. exh .." in order to use this again!")
        end
    return true
end

Actions.xml added:
Lua:
<action itemid="XXXX" event="script" value="NAME.lua"/>
 
Fixed
Code:
local positions = {
	{"Demon", {x = 1000, y = 1000, z = 7}},
	{"Demon", {x = 2000, y = 2000, z = 7}},
	{"Demon", {x = 3000, y = 3000, z = 7}},
	{"Demon", {x = 4000, y = 4000, z = 7}},
	{"Demon", {x = 5000, y = 5000, z = 7}}
}
local exh = 30
local storage = 1905

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, storage) <= os.time() then
		for _, v in ipairs(positions) do
			doCreateMonster(v[1], v[2])
		end
		setPlayerStorageValue(cid, storage, os.time() + exh)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Fight awaits you Demons!")
	else
		doPlayerSendCancel(cid, "You have to wait ".. getPlayerStorageValue(cid, storage) - os.time() .." seconds in order to use this again!")
	end
	return true
end
 
as can be done so that when one uses for example, the egg of hydra, this can not be used by anyone until the end of the waiting time?
 
Back
Top