This iscript is not too much unsefull but i done it 4 fun
With this script every time you create a new creraturescript you will not need add registerCreatureEvent(cid,'name') in login.lua.
This script register all 4 you ;D
Just add this tag on xml:
delete all registerCreatureEvent form you login.lua
and create reginster.lua and put this:
If you use a tag like this:
<event type="kill" name="loot" event="script" value="loot.lua"/>
it will register.
But if you use like this:
<event type="kill" name="loot" block="1" event="script" value="loot.lua"/>
it wont register
done
With this script every time you create a new creraturescript you will not need add registerCreatureEvent(cid,'name') in login.lua.
This script register all 4 you ;D
Just add this tag on xml:
Code:
<event type="login" name="registrando" script="register.lua"/>
and create reginster.lua and put this:
Lua:
local s = ''
do -- Load XML once
f = io.open('data/creaturescripts/creaturescripts.xml','r')
s = f:read('*a')
f:close()
end
function onLogin(cid) -- Script by mock
for line in s:gmatch('<event(.-)/>') do
local type,name,block = line:match('type="(.-)"'),line:match('name="(.-)"'),line:match('block="(.-)"')
if not isInArray({'login','logout'},type) and (not block or block == '0') then
registerCreatureEvent(cid,name)
end
end
return true
end
If you use a tag like this:
<event type="kill" name="loot" event="script" value="loot.lua"/>
it will register.
But if you use like this:
<event type="kill" name="loot" block="1" event="script" value="loot.lua"/>
it wont register
done
Last edited: