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

[ACTION] Someone can fix???

f@bio

Fudera Otserver
Joined
Jul 10, 2007
Messages
213
Reaction score
0
Location
Brasil
-- Hello friends, i made a new system of my obsidian knife, and my script dont work fine... this work only one time, i use a obsidian on a corpse and if i use one more time, made a error on console and dont work more...

-- This my script:
Lua:
-- by F@bio

local dead = {3090,2866,2871,2876,3104,2881,6307,4259,4256,4262,3031,2924,2969,3086,3109,2931,5625,4268,4271,4274,4265,2945,2981,2979,4298}
local after = {3091,2867,2872,2877,3105,2882,6308,4260,4257,4263,3032,2925,2970,3087,3110,2932,5626,4269,4272,4275,4266,2946,2982,2980,4299}
local addon = {5878,5878,5878,5878,5877,5948,5925,5876,5876,5876,5925,5897,5897,5897,5896,5983,5899,5883,5883,5883,5890,5922,5922,5922,5894}

-- minotaur / mage / archer / guard
-- dragon / dragon lord / undead dragon
-- lizard templar / sentinel / snakecharmer
-- bone beast
-- winter wolf / war wolf / wolf
-- bear
-- behemoth
-- tortoise
-- kongra / merlkiin / sibang
-- chicken
-- elf / scout / arcanist
-- bat

function onUse(cid, item, frompos, item2, topos)

	if isInArray(dead, item2.itemid) == TRUE then
        for a = 1, table.getn(dead) do
            if item2.itemid == dead[a] then
                after = after[a]
                addon = addon[a]
                break
            end
        end
	
	if item.itemid == 5908 then
            rand = math.random(1,9)
               if rand == 1 then
		    doSendMagicEffect(topos,14)
		    doPlayerAddItem(cid,addon,1)
		    doSendAnimatedText(getPlayerPosition(cid), "Obaaaa!!!...", TEXTCOLOR_ORANGE)
	            doTransformItem(item2.uid,after)
		else
		    doSendMagicEffect(topos,3)
		    doSendAnimatedText(getPlayerPosition(cid), "Merda!", TEXTCOLOR_ORANGE)
		    doTransformItem(item2.uid,after)
  		end
        end

	else
		doPlayerSendCancel(cid, "Você não pode usar nesse corpo.")
	   return TRUE
 	end   
end

-- Please someone help me to fix this... after error apear, work onle me made /reload actions with gamemaster, after reload work one more time and made error on a new time...

-- This is a message error after using on console:
Lua:
Lua Script Error: [Action Interface]
data/actions/scripts/obsidian_knife.lua:onUse

data/actions/scripts/obsidian_knife.lua:25: attempt to index global 'after' (a n
umber value)
stack traceback:
        data/actions/scripts/obsidian_knife.lua:25: in function <data/actions/sc
ripts/obsidian_knife.lua:20>

-- Thx for all to help me....
 
Back
Top