• logo_cipsoft
    Nowe serwery zostały otwarte 27 Paź 2025:
    Idyllia (Optional PvP) Hostera (Open PvP) us_logo Dracobra (Open PvP)

Creaturescripts Inny opis ?mierci

Status
Zamknięty.

Forseti

Senior User
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
Zamknięty.
Back
Do góry Bottom