What's new

Creaturescripts Inny opis ?mierci

Status
Not open for further replies.

Forseti

Senior User
Joined
Dec 23, 2011
Messages
954
Reaction score
82
Hej.
Tutaj taki ma?y skrypt, kt?ry zmienia opis ?mierci.

Autor: darkhaos
Opis: Pokazuj? ?mier? gracza na specjalnym kanale i mo?na zmieni? opis.
Skrypt:

Utw?rz plik w creatureevent o nazwie "playerdeath.lua" i wklej do niego to:
PHP:
function onDeath(cid, corpse, deathList)
 
local strings = {""}
local t, position = 1, 1
 
local deathType = "killed"
local toSlain, toCrushed, toEliminated = 3, 9, 15
 
	if #deathList >= toSlain and #deathList < toCrushed then
		deathType = "slain"
	elseif #deathList >= toCrushed and #deathList < toEliminated then
		deathType = "crushed"
	elseif #deathList >= toEliminated then
		deathType = "eliminated"
	end
 
	for _, pid in ipairs(deathList) do
		if isCreature(pid) == true then
			strings[position] = t == 1 and "" or strings[position] .. ", "
			strings[position] = strings[position] .. getCreatureName(pid) .. ""
			t = t + 1
		else
			strings[position] = t == 1 and "" or strings[position] .. ", "
			strings[position] = strings[position] .."a field item"
			t = t + 1
		end
	end
 
	for i, str in ipairs(strings) do
		if(str:sub(str:len()) ~= ",") then
			str = str .. "."
		end
 
		msg = getCreatureName(cid) .. " was " .. deathType .. " at level " .. getPlayerLevel(cid) .. " by " .. str
	end
 
	for _, oid in ipairs(getPlayersOnline()) do
		doPlayerSendChannelMessage(oid, "Death channel", msg, TALKTYPE_CHANNEL_O, CHANNEL_DEATH)
	end
	return true
end

Dodaj do 'login.lua' oto ten kod:
PHP:
registerCreatureEvent(cid, "PlayerDeath")
To dodaj do 'creaturescripts.xml':
PHP:
<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>
Teraz przejd? do "data/XML/channels.xml" i wklej to:
PHP:
<channel id="10" active="no" name="Death Channel"/>
I wklej w "data/lib/constant.lua" (po CHANNEL_HELP):
PHP:
CHANNEL_DEATH = 10

No i wszystko gotowe. Oto zdj?cie jak wygl?da nasz efekt:
T1PbgUefekt.jpg
 
Status
Not open for further replies.
Top