Hi, take this script:
All players with storage 13375/13376 is in pvp-zone
But i think onStatsChange script can lag server.
Can someone re-write this script to other function?OnDeath, OnPrepareDeath or somthing like that?
Thanks
PHP:
local corpse_ids = {
[0] = 3065, -- female
[1] = 3058 -- male
}
local bluespawn = {x = 792, y = 1004, z = 7}
local redspawn = {x = 854, y = 1004, z = 7}
function onStatsChange(cid, attacker, type, combat, value)
if getPlayerStorageValue(cid,13375) == 1 or getPlayerStorageValue(cid,13376) == 1 then
if isPlayer(cid) and type == STATSCHANGE_HEALTHLOSS then
if value >= getCreatureHealth(cid) and getCreatureHealth(cid) > 1 then
if getPlayerStorageValue(cid,13375) == 1 then
doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".\n[Arena kill]")
doTeleportThing(cid, bluespawn, TRUE)
setGlobalStorageValue(13376, getGlobalStorageValue(cid,13376)+1)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
end
if getPlayerStorageValue(cid,13376) == 1 then
doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".\n[Arena kill]")
doTeleportThing(cid, redspawn, TRUE)
setGlobalStorageValue(13375, getGlobalStorageValue(cid,13375)+1)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
end
return false
end
end
end
return true
end
All players with storage 13375/13376 is in pvp-zone
But i think onStatsChange script can lag server.
Can someone re-write this script to other function?OnDeath, OnPrepareDeath or somthing like that?
Thanks