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

Problem whit Reputation for killing monsters, players.

Teddy

SweStream.se
Joined
Oct 2, 2008
Messages
3,797
Reaction score
10
Location
Sweden 172
Hello i use this script from http://otland.net/f82/reputation-killing-monsters-players-47993/
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 = getCreatureSkullType(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

and i got this error (and when i kill a monster its not die its stay at (0hp) no xp no corpse only a monster whitout hp and they dont move..)

Code:
[23:15:45.176] [Error - CreatureScript Interface]
[23:15:45.176] data/creaturescripts/scripts/reputation from monsters.lua:onKill
[23:15:45.192] Description:
[23:15:45.192] ...creaturescripts/scripts/reputation from monsters.lua:16: attem
pt to index field '?' (a nil value)
[23:15:45.192] stack traceback:
[23:15:45.192]  ...creaturescripts/scripts/reputation from monsters.lua:16: in f
unction <...creaturescripts/scripts/reputation from monsters.lua:1>

can some help me :D rep+
 
Try
LUA:
--//Config. start\\--
local storage = 666
local monsut = {"Rat"} --1 rep point
local monsut2 = {"Demon"} --5 rep point
local monsut3 = {"Ferumbras"} --100 rep point
--//Config. end\\--
function onKill(cid, target)
local rep = getPlayerStorageValue(cid, storage)
if isPlayer(target) == FALSE and isMonster(target) == TRUE then
local targi = getCreatureName(target)
   if getCreatureName(target) == monsut then
   setPlayerStorageValue(cid, storage + 1)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got 1 reputation points for killing monster ".. targi ..". Atm. you have" .. rep .. " killing rep points.")
   elseif getCreatureName(target) == monsut2 then
   setPlayerStorageValue(cid, storage + 5)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got 5 reputation points for killing monster ".. targi ..". Atm. you have" .. rep .. " killing rep points.")
   elseif getCreatureName(target) == monsut3 then
   setPlayerStorageValue(cid, storage + 100)
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got 100 reputation points for killing monster ".. targi ..". Atm. you have" .. rep .. " killing rep points.")
   end
 end
 return 1
 end
 
Last edited:
creaturescripts.xml add
Code:
	<event type="kill" name="monsterkill" script="monsukill.lua"/>
login.lua add
Code:
registerCreatureEvent(cid, "monsterkill")
and in every monster (which you've used in script!) after
Code:
	</flags>
add
Code:
<script>
<event name="monsterkill"/>
</script>


monsukill.lua
LUA:
local storage = 666
function onKill(cid, target)
local rep = getPlayerStorageValue(cid, storage)
if isPlayer(target) == FALSE and isMonster(target) == TRUE then
local targi = getCreatureName(target)
   if getCreatureName(target) == "Rat" then --Edit monster name, this is for 1 rep points
   setPlayerStorageValue(cid, 666 + 1)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got 1 reputation points for killing monster Rat. Atm. you have" .. rep .. " killing rep points.")
   elseif getCreatureName(target) == "Demon" then --Edit monster name, this is for 5 rep points
   setPlayerStorageValue(cid, 666 + 5)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got 5 reputation points for killing monster Demon. Atm. you have" .. rep .. " killing rep points.")
   elseif getCreatureName(target) == "Ferumbras" then --Edit monster name, this is for 200 rep points
   setPlayerStorageValue(cid, 666 + 100)
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got 100 reputation points for killing monster Ferumbras. Atm. you have" .. rep .. " killing rep points.")
   end
 end
 return 1
 end
If you want many monsters edit this line
LUA:
   if getCreatureName(target) == "Rat" then 
   setPlayerStorageValue(cid, 666 + 1)
to
LUA:
   if getCreatureName(target) == "Rat" or getCreatureName(target) == "Rotworm" then 
   setPlayerStorageValue(cid, 666 + 1)
just add or getCreatureName(target) == "Rotworm" between last "name" and then.

Rep++
 
still dont working..
21:52 You got 10 reputation points for killing monster orshabaal. Atm. you have 18349 killing rep points.
21:58 You got 10 reputation points for killing monster orshabaal. Atm. you have 18349 killing rep points.
 
LUA:
local config = {
        repstorage = 87931
}
function onKill(cid, target)
local currentRep = getPlayerStorageValue(cid, config.repstorage)
local rep = getPlayerStorageValue(cid, config.repstorage)
if isPlayer(target) == FALSE and isMonster(target) == TRUE then
   if getCreatureName(target) == "Rat" then --Edit monster name, this is for 1 rep points
setPlayerStorageValue(cid,currentRep,currentRep+1)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got 1 reputation points for killing monster Rat. Atm. you have" .. rep .. " killing rep points.")
   elseif getCreatureName(target) == "Demon" then --Edit monster name, this is for 5 rep points
setPlayerStorageValue(cid,currentRep,currentRep+5)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got 5 reputation points for killing monster Demon. Atm. you have" .. rep .. " killing rep points.")
   elseif getCreatureName(target) == "Ferumbras" then --Edit monster name, this is for 200 rep points
setPlayerStorageValue(cid,currentRep,currentRep+100)
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got 100 reputation points for killing monster Ferumbras. Atm. you have" .. rep .. " killing rep points.")
   end
 end
 return 1
 end
 
Last edited:
22:29 You got 1 reputation points for killing monster Rat. Atm. you have-1 killing rep points.
22:29 Your Rat deals 6 damage to a rat.
22:29 You deal 14 damage to a rat.
22:29 You got 1 reputation points for killing monster Rat. Atm. you have-1 killing rep points.
22:29 You deal 20 damage to a rat.
22:29 You got 1 reputation points for killing monster Rat. Atm. you have-1 killing rep points.
22:29 You deal 7 damage to a rat.
22:29 You deal 13 damage to a rat.
22:29 You got 1 reputation points for killing monster Rat. Atm. you have-1 killing rep points.
 
ffs use table ;<
LUA:
local storage = 666 -- Storage value of the script.
local monsters =
    {
        ['rat'] = {points = 1},
        ['demon'] = {points = 5},
        ['ferumbras'] = {points = 100},
    }

function onKill(cid, target, lastHit)
    if isPlayer(cid) and isMonster(cid) and monsters[getCreatureName(target):lower()] then
        local script =    
        {
            name = getCreatureName(target):lower(), -- Do not edit.
            killed = getCreatureStorage(cid,storage), -- Do not edit.
        }
        local points = monsters[script.name].points
        local pointss = script.killed + points
        local msg = 'You have now '.. pointss ..' points.'
        -- Standard message for killing monster you can edit this.
        local msg_monster = 'You have slain '.. script.name ..' and you get '.. points ..' reputation point.' 
        doCreatureSetStorage(cid, storage, script.killed + points)
        doPlayerSendTextMessage(cid,22,msg_monster)
        doPlayerSendTextMessage(cid,23,msg)
    end
    return true
end
 
Last edited:
none of them work only this
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 = getCreatureSkullType(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
but its work perfect on all monsters that are on that list other monsters just stand still if u kill it (0 hp )

same error
'
[3:0:05.984] [Error - CreatureScript Interface]
[3:0:05.984] data/creaturescripts/scripts/reputation from monsters.lua:onKill
[3:0:05.984] Description:
[3:0:05.984] ...creaturescripts/scripts/reputation from monsters.lua:17: attempt
to index field '?' (a nil value)
[3:0:06.000] stack traceback:
[3:0:06.000] ...creaturescripts/scripts/reputation from monsters.lua:17: in f
unction <...creaturescripts/scripts/reputation from monsters.lua:1>
 
LUA:
function onKill(cid, target, lastHit)
    -- Config --
    local storage = 666 -- Storage value of the script.
    local script =
    {
        name = getCreatureName(target):lower(), -- Do not edit.
        how_check = getCreatureStorage(cid,999), -- Do not edit.
        killed = getCreatureStorage(cid,storage), -- Do not edit.
        skull_check = getCreatureSkullType(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.'
    -- Standard message for killing monster you can edit this.
    local msg_monster = 'You have slained '.. script.name ..' and you get '.. points ..' reputation point.' 
    local tbl = monsters[script.name]
    
    if tbl and isMonster(target) then
        doCreatureSetStorage(cid, storage,script.killed + points)
        doPlayerSendTextMessage(cid,22,msg_monster)
        doPlayerSendTextMessage(cid,23,msg)
    end
    return true
end
 
same error..
[3:11:02.312] [Error - CreatureScript Interface]
[3:11:02.312] data/creaturescripts/scripts/reputation from monsters.lua:onKill
[3:11:02.312] Description:
[3:11:02.312] ...creaturescripts/scripts/reputation from monsters.lua:17: attemp
t to index field '?' (a nil value)
[3:11:02.312] stack traceback:
[3:11:02.312] ...creaturescripts/scripts/reputation from monsters.lua:17: in f
unction <...creaturescripts/scripts/reputation from monsters.lua:1>
 
okey, let's do it the Cyber-Style way

LUA:
local storage = 666 -- Storage value of the script.
local monsters =
    {
        ['rat'] = 1,
        ['demon'] = 5,
        ['ferumbras'] = 100,
    }

function onKill(cid, target, lastHit)
    local rep = monsters[getCreatureName(target):lower()]
    if isPlayer(cid) and isMonster(target) and rep then
        doCreatureSetStorage(cid, storage,math.max(1, getCreatureStorage(cid, storage)+rep))
        doPlayerSendTextMessage(cid, 22, 'You have slained a '.. getCreatureName(target) ..' and get '.. rep ..' reputation points.')
        doPlayerSendTextMessage(cid, 23, 'You now have '.. getCreatureStorage(cid, storage)..' reputation points.')
    end
    return true
end
 
Thx CyberSHOT! :D i dont know how to rep on the new VB can u tell me in your next post and do you know whats the problem where on that script.. so i can learn ^^
 
dont worry im not rep whore

i wont tell you where's the main bug, i just saw all that messy code and rewrote it to an easier one
doPlayerSendTextMessage(cid,23,msg)
return TRUE
end
return TRUE
end
that "return TRUE" caused monsters to not die
 
Back
Top