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

Lua Error in Script

FabianoBN

l|¬¬"|l
Joined
Jan 23, 2009
Messages
745
Reaction score
22
Location
Goias - Brazil
I have one erro in the script, do not let the monster die

Script:
Lua:
function onKill(cid, target) 

local m = {
["humongous fungus"] = 101007,
} 
  
if(isMonster(target) == TRUE) then 
local n = getCreatureName(target) 
local name_monster = m[string.lower(n)] 
if(name_monster) then 
local contagem = getPlayerStorageValue(cid, name_monster) 
if(contagem == -1) then 
contagem = 1 
end 
setPlayerStorageValue(cid, name_monster, contagem+1)    -- LINE 29
end 
end 
return TRUE 
end

Error in the Screen Shot:

Sem título.jpg

Thanks!
 
here is my old script I made for testing:
Lua:
function onKill(cid, target, damage, flags)
	local killstorage = "25909"
	local name = getCreatureName(target):lower()
	
	if isPlayer(target) then return true end
	if name == 'testboss' then
		doCreatureSay(cid, 'You have defeated the ' .. name .. '. You may continue exploring now.', TALKTYPE_ORANGE_1)
		if(getCreatureStorage(cid, killstorage) < 1) then
		doCreatureSetStorage(cid, killstorage, 1)
		end
	end
	return true
end

if you want to register multiple creatures, use:
Lua:
local name = getCreatureName(target):lower()

if m[name] ~= nil then
-- action
end

to get values from m, use:
Lua:
m[name]
eg.
Lua:
doCreatureSetStorage(cid, m[name], 1)

tested on 0.3.7 only

oh, and use this also to prevent counting summons:
Lua:
if (not isSummon(target)) then
 
Back
Top