• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Getcreatureskulltype a nil value

There's only 1 way to find out, try it and post any error(s).

Error this time:
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/reputationfrommonsters.lua:onKill

...a/creaturescripts/scripts/reputationfrommonsters.lua:17: attempt to index a field '?' <a nil value> 
stack traceback:
      ...a/reaturescripts/scripts/reputationfrommonsters.lua:17: in function
<...a/reaturescripts/scripts/reputationfrommonsters.lua:1>

And the script looks like this:
Code:
function onKill(cid, target)
-- Config --
local storage = 666 -- Storage value of the script.
local script =
{
    name = getCreatureName(target), -- Do not edit.
    how_check = getPlayerStorageValue(cid,999), -- Do not edit.
    killed = getPlayerStorageValue(cid,storage), -- Do not edit.
    skull_check = getPlayerSkullType(target) -- Do not edit.
}
local monsters =
{
	["Rat"] = {points = 1},
	["Demon"] = {points = 5},
	["Ferumbras"] = {points = 100},
}
local points = monsters[script.name].points
local pointss = script.killed + points
local msg = "You have now ".. pointss .." points."
local msg_monster = "You have slain ".. script.name .." and you get ".. points .." reputation point." -- Standard message for killing monster you can edit this.
local tbl = monsters[script.name]
-- Script --
if(not tbl) then
        return TRUE
end
 
if(tbl) and isMonster(target) == TRUE then
                setPlayerStorageValue(cid, storage,script.killed + points)
                doPlayerSendTextMessage(cid,22,msg_monster)
                doPlayerSendTextMessage(cid,23,msg)
                return TRUE
			end
		return TRUE
end
 
LUA:
local monsters = {
	['rat'] = {points = 1},
	['demon'] = {points = 5},
	['ferumbras'] = {points = 100},
}
local storage = 666 -- Storage value of the script.

function isMonster(cid)
	return isCreature(cid) and cid >= 0x40000000 and cid < 0x80000000
end

function onKill(cid, target)
	if not isMonster(target) then
		return TRUE
	end

	local name = getCreatureName(target)
	local killed = math.max(0, getPlayerStorageValue(cid, storage))

	local tbl = monsters[name:lower()]
	if not tbl then
		return TRUE
	end

	local points = tbl.points

	setPlayerStorageValue(cid, storage, killed + points)
	doPlayerSendTextMessage(cid, 22, 'You have slain '.. name ..' and you got '.. points ..' reputation points.')
	doPlayerSendTextMessage(cid, 23, 'You have now '.. killed + points ..' points.')
	return TRUE
end
 
You lost me there.. I meant, how the h*ll do you get all my scripts working so fast? :D Ofc i wouldnt know first thing about the difficulty in this kind of scripts. So no harm intended.. :O
 
That's not fast at all, you should see nwtr. He responds to all common database / db.executeQuery issues within max. 1 minute.
 
Back
Top