Look at this script: It is working when 1 player kill 1 player but not when many people kill 1 player. Can you help me?
I think this function is problem:
this is full script:
I think this function is problem:
PHP:
if isPlayer(cid) and type == STATSCHANGE_HEALTHLOSS then
if value >= getCreatureHealth(cid) and getCreatureHealth(cid) > 1 then
this is full 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 isPlayer(cid) and type == STATSCHANGE_HEALTHLOSS then
if value >= getCreatureHealth(cid) and getCreatureHealth(cid) > 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]")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
if getPlayerStorageValue(cid,13375) == 1 then
doTeleportThing(cid, bluespawn, TRUE)
setGlobalStorageValue(13376, getGlobalStorageValue(cid,13376)+1)
end
if getPlayerStorageValue(cid,13376) == 1 then
doTeleportThing(cid, redspawn, TRUE)
setGlobalStorageValue(13375, getGlobalStorageValue(cid,13375)+1)
end
return false
end
end
return true
end
Last edited: