Xart Irok
Senior User
- Joined
- Sep 7, 2008
- Messages
- 2,925
- Reaction score
- 419
- Age
- 32
jako plik lua wklejmy to i zapisz przykladowo jako AdvencLvl.lua
w creaturescripts/creaturescripts.xml dodaj ta linjke
a potem w pliku creaturescripts/scripts/login.lua dodaj ta linijke
PHP:
local data = {
[1] = { "Level UP", 30} -- 30 = variable[2] // Animation effect
}
local config = {
showAllAdvances = "YES", --(YES/NO) // czy ma pokazywac napis nad postacia przy kazdym awansie? // YES == tak, NO == nie
broadcastOnLevels = {100, 200, 300, 400, 500} // wpisz poziomy, na ktorych ma oglaszac awans kazdemu graczowi // aby wylaczyc wpisz samo 0
}
function onAdvance(cid, skill, oldlevel, newlevel)
local pos = getPlayerPosition(cid)
local positions = {
{x=pos.x+1,y=pos.y-1,z=pos.z},
{x=pos.x-1,y=pos.y-1,z=pos.z},
{x=pos.x+1,y=pos.y+1,z=pos.z},
{x=pos.x-1,y=pos.y+1,z=pos.z},
{x=pos.x+1,y=pos.y,z=pos.z},
{x=pos.x-1,y=pos.y,z=pos.z},
{x=pos.x,y=pos.y+1,z=pos.z},
{x=pos.x,y=pos.y-1,z=pos.z}}
if config.showAllAdvances == "YES" and (isInArray(config.broadcastOnLevels, getPlayerLevel(cid))) == TRUE and skill == 1 then
broadcastMessage(getPlayerName(cid).." has been advanced on ".. newlevel .." level. Congratulations!", MESSAGE_EVENT_ADVANCE)
end
for type, variable in pairs(data) do
if skill == 1 then
for i = 1, table.maxn(positions) do
doSendMagicEffect(positions[i],variable[2])
end
break
end
end
return TRUE
end
PHP:
<event type="advance" name="AdvencLvl" script="AdvencLvl.lua"/>
PHP:
registerCreatureEvent(cid, "AdvencLvl")
Last edited: