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

Counter of monster killeds!

labbadia

New Member
Joined
Aug 29, 2010
Messages
51
Reaction score
1
Hello guys!

I want one script to count how much monster i kill ...like this
10 nightmare...
100 demon
300 rotworms...
etc...
i already found that in one forum but lost the link!

Someone have this?
Thank you guys!
 
Do u have idea what is type of this script? i donwloaded one styler yurots but didnt found!
Do u know if is creaturescript? or what?
Thanks
 
Try to make it based on this, not sure if this works though.

LUA:
local monsters = {
	['Rotworm'] = 4123 -- storage
	}

function onKill(cid, target, lastHit)
local check = monsters[getCreatureName(target)]
	if isInArray(monsters,getCreatureName(target)) then
		setPlayerStorageValue(cid,check,getStorageValue(cid,check)+1)
		doPlayerSendTextMessage(cid,27,'You killed '..getPlayerStorageValue(cid,check)..' '..getCreatureName(target)..'s.')
	end
	return true
end
 
Didnt work i think...can i chose any storage id? or each monster have one?

what i did...
1- created file teste.lua in creaturescripts/ scripts
local monsters = {
['Rotworm'] = 4123 -- storage
}

function onKill(cid, target, lastHit)
local check = monsters[getCreatureName(target)]
if isInArray(monsters,getCreatureName(target)) then
setPlayerStorageValue(cid,check,getStorageValue(cid,check)+1)
doPlayerSendTextMessage(cid,27,'You killed '..getPlayerStorageValue(cid,check)..' '..getCreatureName(target)..'s.')
end
return true
end

2-open login.lua and paste
registerCreatureEvent(cid, "teste")
3-open creaturescript.xml and paste
<event type="kill" name="teste" event="script" value="teste.lua"/>

need to do anything more?
thank you!
 
Did you restart the server?

also try this

LUA:
local monsters = {
	['rotworm'] = 4123 -- storage, make monstername lowercase.
	}
 
function onKill(cid, target, lastHit)
local check = monsters[getCreatureName(target)lower()]
	if isInArray(monsters,getCreatureName(target):lower()) then
		setPlayerStorageValue(cid,check,getStorageValue(cid,check)+1)
		doPlayerSendTextMessage(cid,27,'You killed '..getPlayerStorageValue(cid,check)..' '..getCreatureName(target)..'s.')
	end
	return true
end

and in

Code:
local monsters = {
['Rotworm'] = 4123 -- storage
}

function onKill(cid, target, lastHit)
local check = monsters[getCreatureName(target)]
if isInArray(monsters,getCreatureName(target)) then
setPlayerStorageValue(cid,check,getStorageValue([B]ci d,[/B]check)+1)
doPlayerSendTextMessage(cid,27,'You killed '..getPlayerStorageValue(cid,check)..' '..getCreatureName(target)..'s.')
end
return true
end

why is there a space?
 
tried that
local monsters = {
['rotworm'] = 4123 -- storage, make monstername lowercase.
}

function onKill(cid, target, lastHit)
local check = monsters[getCreatureName(target)lower()]
if isInArray(monsters,getCreatureName(target):lower()) then
setPlayerStorageValue(cid,check,getStorageValue(cid,check)+1)
doPlayerSendTextMessage(cid,27,'You killed '..getPlayerStorageValue(cid,check)..' '..getCreatureName(target)..'s.')
end
return true
end

and got error in execution
teste.lua:6 '] expected near 'lower'

EDIT: found one by mock but
function onKill(cid, target)--- Script by mock
local s = getPlayerStorageValue(cid,23483)
s = s == -1 and 1 or s
s = tonumber(s) or 1
setPlayerStorageValue(cid,23483,s+1)
addEvent(doPlayerSendTextMessage,100,cid,23,'Você ja matou '..(s+1)..' monstros')
return true
end

But its all monster total...it dont separate each for each monster....but if cant do that its ok...
do u think this script will reset anytime? where is saved that informations? sql?
 
Last edited:
LUA:
local monsters = 
{
	["rotworm"] = {stor = 4123, text = "You have killed "}
}

function onKill(cid, target, lastHit)
	local creature = monsters[getCreatureName(target):lower()]
	if not creature then return true end
	if getCreatureStorage(cid, creature.stor) < 0 then return doCreatureSetStorage(cid, creature.stor, 0) end

	doCreatureSetStorage(cid, creature.stor, getCreatureStorage(cid, creature.stor) + 1)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, creature.text .. getCreatureStorage(cid, creature.stor) .. " " .. getCreatureName(target) .. ".")
	return true
end
 
Back
Top