Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.2 kB
7
Indexable
Never
 data/creaturescripts/scripts add a new file named deathSkulls.lua and place this inside:
PHP:
local fragStorage = 1234 -- storage id for killer players (storage if para o jogador matador)
local skulls = { -- skulls ids
	[1]={frags = 10}, -- id 1 for yellow skull
	[2]={frags = 25}, -- id 2 for green skull
	[3]={frags = 50}, -- id 3 for white skull
	[4]={frags = 100} -- id 4 for red skull
}

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
	if isPlayer(mostDamageKiller) == true then
		setPlayerStorageValue(mostDamageKiller, fragStorage, getPlayerStorageValue(mostDamageKiller, fragStorage)+1)
		for i = 1, table.maxn(skulls) do
			if getPlayerStorageValue(mostDamageKiller, fragStorage) >= skulls[i].frags then
				doCreatureSetSkullType(mostDamageKiller, skulls[i])
			end
		end
	end
	return true
end

in data/creaturescripts/creaturescripts.xml add this line:
PHP:
<event type="death" name="addSkullForFrags" event="script" value="deathSkulls.lua"/>

and in data/creaturescripts/scripts/login.lua, add this event:
PHP:
registerCreatureEvent(cid, "addSkullForFrags")

like this: (example)
PHP:
function onLogin(cid)
	registerCreatureEvent(cid, "addSkullForFrags")
	return true
end