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

summoning help request

izaak

New Member
Joined
Feb 1, 2009
Messages
161
Reaction score
3
I need help with a summon script and i hope you can help me.

im trying to edit a script wich i found it summons a creature , but i want it to remove the creature after 30 seconds
but somehow it wont remove the creature , dous any1 know howto? il rep u for it

Code:
function onSay(cid, words, param, channel)
 
local level = 50
local mana = 200
local vocsCanUse = {2}
local canBeSummoned = {"Guardian"}

	if getPlayerLevel(cid) < level then
		doPlayerSendCancel(cid, "Your level is too low.")
		return TRUE
	end
 
	if getCreatureMana(cid) < mana then
		doPlayerSendCancel(cid, "You do not have enough mana.")
		return TRUE
	end
 
	if getCreatureMana(cid) < mana then
		doPlayerSendCancel(cid, "You do not have enough mana.")
		return TRUE
	end
 
	if(not isInArray(vocsCanUse, getPlayerVocation(cid))) then
		doPlayerSendCancel(cid, "Your vocation cannot use this spell.")
		return TRUE
	end
 
	if getCreatureCondition(cid, condition) == FALSE then
		doPlayerSendCancel(cid, "You need to be drunked to use this spell.")
		return TRUE
	end
 
	if(not isInArray(canBeSummoned, param)) then
		doPlayerSendCancel(cid, "You cannot summon this creature.")
		return TRUE
	end
 
	doSummonCreature(param, getCreaturePosition(cid), FALSE)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
	return TRUE
end
 
Try this:
Lua:
function onSay(cid, words, param, channel)
 
local level = 50
local mana = 200
local vocsCanUse = {2}
local canBeSummoned = {"Guardian"}
local time = 30 --60sec = 1min

	if getPlayerLevel(cid) < level then
	return	doPlayerSendCancel(cid, "Your level is too low.")
	end
 
	if getCreatureMana(cid) < mana then
	return	doPlayerSendCancel(cid, "You do not have enough mana.")
	end
 
	if getCreatureMana(cid) < mana then
	return	doPlayerSendCancel(cid, "You do not have enough mana.")
	end
 
	if(not isInArray(vocsCanUse, getPlayerVocation(cid))) then
	return	doPlayerSendCancel(cid, "Your vocation cannot use this spell.")
	end
 
	if getCreatureCondition(cid, condition) == FALSE then
	return	doPlayerSendCancel(cid, "You need to be drunked to use this spell.")
	end
 
	if(not isInArray(canBeSummoned, param)) then
	return	doPlayerSendCancel(cid, "You cannot summon this creature.")
	end
 
	doSummonCreature(param, getCreaturePosition(cid), FALSE)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
	addEvent(Remove, time*1000, cid)
	return TRUE
	end
	
	function Remove(cid)
        local summons = getCreatureSummons(cid)
        if #summons >= 1 then
                if isCreature(summons) then
                        doRemoveCreature(summons)
                end
        end
        return true
    end
 
Lua:
function onSay(cid, words, param, channel)
local function removeSummon(cid)
	local s = getCreatureSummons(cid)
	if #s >= 1 then
		for _,pid in ipairs(n) do
			doRemoveCreature(pid)
		end
		return true
	end
end

local level = 50
local mana = 200
local vocsCanUse = {2}
local canBeSummoned = {"Guardian"}

	if getPlayerLevel(cid) < level then
		doPlayerSendCancel(cid, "Your level is too low.")
		return TRUE
	end
 
	if getCreatureMana(cid) < mana then
		doPlayerSendCancel(cid, "You do not have enough mana.")
		return TRUE
	end
 
	if getCreatureMana(cid) < mana then
		doPlayerSendCancel(cid, "You do not have enough mana.")
		return TRUE
	end
 
	if(not isInArray(vocsCanUse, getPlayerVocation(cid))) then
		doPlayerSendCancel(cid, "Your vocation cannot use this spell.")
		return TRUE
	end
 
	if getCreatureCondition(cid, condition) == FALSE then
		doPlayerSendCancel(cid, "You need to be drunked to use this spell.")
		return TRUE
	end
 
	if(not isInArray(canBeSummoned, param)) then
		doPlayerSendCancel(cid, "You cannot summon this creature.")
		return TRUE
	end
 
	doSummonCreature(param, getCreaturePosition(cid), FALSE)
	addEvent(removeSummon, 30*1000, cid)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
	return TRUE
end

Try this



xD Cyko beat me to it
 
Last edited:
Well, idk what is this:
Lua:
local = getCreatureSummons(cid)

Lua:
function onSay(cid, words, param, channel)
local function removeSummon(cid)
	local  = getCreatureSummons(cid)
	if #s >= 1 then
		for _,pid in ipairs(n) do
			doRemoveCreature(pid)
		end
		return true
	end
end

local level = 50
local mana = 200
local vocsCanUse = {2}
local canBeSummoned = {"Guardian"}

	if getPlayerLevel(cid) < level then
		doPlayerSendCancel(cid, "Your level is too low.")
		return TRUE
	end
 
	if getCreatureMana(cid) < mana then
		doPlayerSendCancel(cid, "You do not have enough mana.")
		return TRUE
	end
 
	if getCreatureMana(cid) < mana then
		doPlayerSendCancel(cid, "You do not have enough mana.")
		return TRUE
	end
 
	if(not isInArray(vocsCanUse, getPlayerVocation(cid))) then
		doPlayerSendCancel(cid, "Your vocation cannot use this spell.")
		return TRUE
	end
 
	if getCreatureCondition(cid, condition) == FALSE then
		doPlayerSendCancel(cid, "You need to be drunked to use this spell.")
		return TRUE
	end
 
	if(not isInArray(canBeSummoned, param)) then
		doPlayerSendCancel(cid, "You cannot summon this creature.")
		return TRUE
	end
 
	doSummonCreature(param, getCreaturePosition(cid), FALSE)
	addEvent(removeSummon, 30*1000, cid)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
	return TRUE
end

Try this



xD Cyko beat me to it
 
i love u guys your all getting rep lol

- - - Updated - - -

the creatures are spawning but there not being removed after the 30 seconds
 
Lua:
function onSay(cid, words, param, channel)
 
local function Remove(cid)
	local summons = getCreatureSummons(cid)
	if(#summons >= 1) then
		for _, pid in ipairs(summons) do
			doRemoveCreature(pid)
		end
	end
	return true
end
 
local config = {
	level = 50,
	mana = 200,
	vocsCanUse = {1, 2, 5, 6},
	canBeSummoned = {"Rat", "Orc"},
	timer = 30, --60sec = 1min
	condition = CONDITION_DRUNK,
	storage = 3344
	}
	if getPlayerStorageValue(cid, config.storage) > os.time() then return doPlayerSendCancel(cid, "You can use this command only all "..config.timer.." seconds.") end
	if getTileInfo(getCreaturePosition(cid)).protection then return	doPlayerSendCancel(cid, "You can not summon a monster in protection zone.") end
	if getPlayerLevel(cid) < config.level then	return	doPlayerSendCancel(cid, "Your level is too low.") end
 	if getCreatureMana(cid) < config.mana then	return	doPlayerSendCancel(cid, "You do not have enough mana.")	end
	if(not isInArray(config.vocsCanUse, getPlayerVocation(cid))) then	return	doPlayerSendCancel(cid, "Your vocation cannot use this spell.")	end
 	if getCreatureCondition(cid, config.condition) == FALSE then	return	doPlayerSendCancel(cid, "You need to be drunked to use this spell.")	end

	if isInArray(config.canBeSummoned, param:lower())then
		doSummonMonster(cid, param:lower())
		doCreatureAddMana(cid, -config.mana)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
		addEvent(Remove, config.timer * 1000, cid)
		setPlayerStorageValue(cid, config.storage, os.time() + config.timer)
	else
		doPlayerSendCancel(cid, "You cannot summon this creature.")
	end
	return TRUE
end

should works, also i add exhaus

and add this to logout
Lua:
	local summons = getCreatureSummons(cid)
	for _, pid in ipairs(summons) do
		doRemoveCreature(pid)
	end
 
Last edited:
Back
Top