• 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 [Creaturescript] Count kills

Northnorial

Member
Joined
May 30, 2009
Messages
742
Reaction score
5
Location
Germany
It doesn't work ...

Code:
function onKill(cid, target)
	if (isPlayer(target) == FALSE and getCreatureName(target) == "Demon" and getPlayerStorageValue(cid, 76672) == 2) then
	if getPlayerStorageValue(cid, 55667) < 100 then 
		local killedMonsters = getPlayerStorageValue(cid, 55667)
            if (killedMonsters == -1) then
                killedMonsters = 1
			end
			setPlayerStorageValue(cid, 55667, killedMonsters + 1)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed " .. killedMonsters .. " of 100 demons.")
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed enough demons.")
			setPlayerStorageValue(cid, 76672, 3)
		end
	end
	return TRUE
end

Could you fix it for me? ;)
 
Last edited:
here, grab
Code:
local s, t = 76672, 55667

function onKill(cid, target, lastHit)
    if isMonster(target) and getCreatureName(target):lower() == 'demon' and isPlayer(cid) and getCreatureStorage(cid, s) == 2 then
        if getCreatureStorage(cid, t) < 100 then 
            doCreatureSetStorage(cid, t, math.max(1,getCreatureStorage(cid, t)+1))
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have killed ' .. getCreatureStorage(cid, t) .. ' of 100 demons.')
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have killed enough demons.')
            doCreatureSetStorage(cid, s, 3)
        end
    end
    return true
end
 
If you tell us whats wrong, maybe.. your tabbing is a mess.

Sorry, I edited the script without tabbing.

here, grab
Code:
local s, t = 76672, 55667

function onKill(cid, target, lastHit)
    if isMonster(target) and getCreatureName(target):lower() == 'demon' and isPlayer(cid) and getCreatureStorage(cid, s) == 2 then
        if getCreatureStorage(cid, t) < 100 then 
            doCreatureSetStorage(cid, t, math.max(1,getCreatureStorage(cid, t)+1))
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have killed ' .. getCreatureStorage(cid, t) .. ' of 100 demons.')
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have killed enough demons.')
            doCreatureSetStorage(cid, s, 3)
        end
    end
    return true
end


Ok, thank you. It works now.
 
Last edited:
Lua:
registerCreatureEvent(cid, 'demon')

Lua:
<event type="kill" name="demon" event="script" value="demon.lua"/>
 
Back
Top