• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

pvp-zone, onDeath script

Scooty

Enemia.EU
Joined
Jul 24, 2010
Messages
564
Reaction score
14
Location
Kraków
Hi, take this script:


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
 
Back
Top