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

[Creature Script] Ondeath

baralala

New Member
Joined
Jan 15, 2009
Messages
120
Reaction score
1
Location
Argentina
This will setstoragevalue to the first player on the monster death list.
I want the same but giving the storage to every one who hit the monster.

server: cryingdamson6pl1-gui


Code:
function onDeath(cid, corpse, deathList)

local killer = deathList[1]
local pirates = 30624
local out = 30600
local killed = getPlayerStorageValue(killer, 30624)

	if isPlayer(killer) then
		if getPlayerStorageValue(killer, out) == 1  then
				if getPlayerStorageValue(killer, pirates) < 9 then
					doPlayerSetStorageValue(killer, pirates, killed + 1)
					doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE, "" .. getPlayerStorageValue(killer, pirates) .. " pirates defeated.")
				else
					doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_RED, "You have killed the required number.")
				end
		end
	end
	return TRUE
end

I know, this script sux, but i dont really know how to make good ones
 
Code:
function onDeath(cid, corpse, deathList)

local killer = deathList[[COLOR=Red]#deathList[/COLOR]]
local pirates = 30624
local out = 30600
local killed = getPlayerStorageValue(killer, 30624)

    if isPlayer(killer) then
        if getPlayerStorageValue(killer, out) == 1  then
            if getPlayerStorageValue(killer, pirates) < 9 then
                doPlayerSetStorageValue(killer, pirates, killed + 1)
                doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE, "" .. getPlayerStorageValue(killer, pirates) .. " pirates defeated.")
            else
                doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_RED, "You have killed the required number.")
            end
        end
    end
    return TRUE
end
wouldn't that work?
 
@up
You were faster, but yours doesn't work as he wants it. Yours will give storage only to last player in death list..

Try this: (+shortened)
PHP:
function onDeath(cid, corpse, deathList)
local pirates,out = 30624,30600
	for i = 1, #deathList do
		if isPlayer(deathList[i]) and getPlayerStorageValue(deathList[i], out) == 1 then
			local add = getPlayerStorageValue(deathList[i], pirates) < 9 and (doPlayerSetStorageValue(deathList[i], pirates, getPlayerStorageValue(deathList[i], pirates) + 1) and doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_BLUE,getPlayerStorageValue(deathList[i], pirates) .. " pirates defeated.")) or doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_RED, "You have killed the required number.")
		end
	end
	return TRUE
end
 
Last edited:
I looped the deathList table and it contains the unique ids (uid) of every killer of the monster, so yeah..
 
@up
You were faster, but yours doesn't work as he wants it. Yours will give storage only to last player in death list..

Try this: (+shortened)
PHP:
function onDeath(cid, corpse, deathList)
local pirates,out = 30624,30600
    for i = 1, #deathList do
        if isPlayer(deathList[i]) and getPlayerStorageValue(deathList[i], out) == 1 then
            local add = getPlayerStorageValue(deathList[i], pirates) < 9 and (doPlayerSetStorageValue(deathList[i], pirates, getPlayerStorageValue(deathList[i], pirates) + 1) and doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_BLUE,getPlayerStorageValue(deathList[i], pirates) .. " pirates defeated.")) or doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_RED, "You have killed the required number.")
        end
    end
    return TRUE
end
The script wasn't mine, I didn't even look through the script, I just changed deathlist[1] for deathList[#deathList]
 
kkkkkkkk
Code:
function onDeath(cid, deathList)
	local pirates, out = 30624, 30600
	local corpse_ids = {
		[0] = 3065,
		[1] = 3058
	}
	local corpse, killers = doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), ""
	for i = 1, math.min(getConfigInfo('deathAssistCount') + 1, #deathList) do
		killers = killers .. (i == 1 and "" or ", ") .. (isMonster(deathList[i]) and "a " or "") .. getCreatureName(deathList[i])
	end
	for i = 1, #deathList do
		if getPlayerStorageValue(deathList[i], out) == 1 then
			if getPlayerStorageValue(deathList[i], pirates) < 9 then
				setPlayerStorageValue(deathList[i], pirates, getPlayerStorageValue(deathList[i], pirates)+1)
				doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_BLUE, "" .. getPlayerStorageValue(deathList[i], pirates) .. " pirates defeated.")
			else
				doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_RED, "You have killed the required number.")
			end
			break
		end
	end
	doItemSetAttribute(corpse, "specialdescription", "You recognize " .. getCreatureName(cid) .. ". " .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed by " .. killers .. ".")
	return true
end
 
kkkkkkkk
Code:
function onDeath(cid, deathList)
	local pirates, out = 30624, 30600
	local corpse_ids = {
		[0] = 3065,
		[1] = 3058
	}
	local corpse, killers = doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), ""
	for i = 1, math.min(getConfigInfo('deathAssistCount') + 1, #deathList) do
		killers = killers .. (i == 1 and "" or ", ") .. (isMonster(deathList[i]) and "a " or "") .. getCreatureName(deathList[i])
	end
	for i = 1, #deathList do
		if getPlayerStorageValue(deathList[i], out) == 1 then
			if getPlayerStorageValue(deathList[i], pirates) < 9 then
				setPlayerStorageValue(deathList[i], pirates, getPlayerStorageValue(deathList[i], pirates)+1)
				doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_BLUE, "" .. getPlayerStorageValue(deathList[i], pirates) .. " pirates defeated.")
			else
				doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_RED, "You have killed the required number.")
			end
			break
		end
	end
	doItemSetAttribute(corpse, "specialdescription", "You recognize " .. getCreatureName(cid) .. ". " .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed by " .. killers .. ".")
	return true
end
Why are you creating a corpse? %^$&ing newfags.
 
@up
You were faster, but yours doesn't work as he wants it. Yours will give storage only to last player in death list..

Try this: (+shortened)
PHP:
function onDeath(cid, corpse, deathList)
local pirates,out = 30624,30600
	for i = 1, #deathList do
		if isPlayer(deathList[i]) and getPlayerStorageValue(deathList[i], out) == 1 then
			local add = getPlayerStorageValue(deathList[i], pirates) < 9 and (doPlayerSetStorageValue(deathList[i], pirates, getPlayerStorageValue(deathList[i], pirates) + 1) and doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_BLUE,getPlayerStorageValue(deathList[i], pirates) .. " pirates defeated.")) or doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_RED, "You have killed the required number.")
		end
	end
	return TRUE
end

I will try this when i have time. Thanks to all guys
 
Back
Top