• 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 Summon Monster With Switch

kokorec

Tavon Online - Soon
Joined
May 3, 2008
Messages
287
Reaction score
0
Location
Turkey
Hi,

summon.lua
Code:
function exhaust(cid, storevalue, exhausttime)
    
    newExhaust = os.time()
    oldExhaust = getPlayerStorageValue(cid, storevalue)
    if (oldExhaust == nil or oldExhaust < 0) then
        oldExhaust = 0
    end
    if (exhausttime == nil or exhausttime < 0) then
        exhausttime = 1
    end
    diffTime = os.difftime(newExhaust, oldExhaust)
    if (diffTime >= exhausttime or diffTime < 0) then
        setPlayerStorageValue(cid, storevalue, newExhaust) 
        return 1
    else
        return 0
    end
end



function onUse(cid, item, frompos, item2, topos)
local config = {
		storevalue = 1000,
		exhausttime = [COLOR="Red"]2[/COLOR], 
		newnPosition = {[COLOR="Red"]x=5475, y=5397, z=9[/COLOR]},

		}

local monster = {
			["[COLOR="Red"]Hero[/COLOR]"] = {[COLOR="Red"]x=5479, y=5395, z=9[/COLOR]}
		}

for name, pos in pairs(monster) do


		if (exhaust(cid, config.storevalue, config.exhausttime) == TRUE) then
			if item.itemid == 1945 then
				doSummonCreature(name, pos)
				
				doTransformItem(item.uid,item.itemid+1)
			break

			elseif  item.itemid == 1946 then
				doSummonCreature(name, pos)
				doTransformItem(item.uid,item.itemid-1)
			break

			else
				doPlayerSendCancel(cid,"Sorry,not possible.")
			end
		break
		else
			doPlayerSendCancel(cid,"[COLOR="Red"]You Need Wait 2 Second.[/COLOR]")
			doSendMagicEffect(getCreaturePosition(cid),CONST_ME_POFF)
			
			
		end
	
end
return TRUE
end

actions.xml
Code:
      <action uniqueid="[COLOR="Red"]6500[/COLOR]" script="[COLOR="Red"]summon[/COLOR].lua" />

Note: exhausttime = 2 (2 second)

Can you change with red colour words.

Thanks~
 
Great but I would like to have a script of when you walk on for example a grass tile, close to it would spawn 1 demon, and if you walk another grass tile it would spawn 1 grim reaper.

Possible? I will give the one who helps me rep++ ofc :D
 
Back
Top