i need a mod that if player have town id 5 he allow to this mode
or make it all in 1 mod
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Respawn_Module" version="2.0" author="Syntax" contact="[email protected]" enabled="yes">
<config name="respawn_config"><![CDATA[
config = {
masterpos = true, -- set to true if you want them teleported to their home town
townid = 5, -- if masterpos is false then set for custom town or set to 0 for custom position
position = {x = 1231, y = 988, z = 8}
}
]]></config>
<event type="login" name="Respawn_login" event="buffer"><![CDATA[
registerCreatureEvent(cid, "Respawn_status")
]]></event>
<event type="statschange" name="Respawn_status" event="script"><![CDATA[
domodlib('respawn_config')
function onStatsChange(cid, attacker, type, combat, value)
if type == 1 and getCreatureHealth(cid) <= value then
pos = config.position
if(config.masterpos)then
pos = getPlayerMasterPos(cid)
elseif config.townid > 0 then
pos = getTownTemplePosition(config.townid)
end
doTeleportThing(cid, pos)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
return false
end
return true
end
]]></event>
</mod>