Well, I'm with my system of domination of the castle, and I wanted
add an item to the leader of the winning guild.
here is the script
Help-me.
add an item to the leader of the winning guild.
here is the script
Code:
function onDeath(cid, corpse, deathList)
local msg, topGuild, topHits = "", "", 0
for guild, hits in pairs(MONSTER_ATTACKERS_GUILD) do
msg = msg.."Guild: "..guild.." Hits: "..hits.."\n"
if hits > topHits then
topGuild = guild
topHits = hits
end
end
doBroadcastMessage("[Castle Event] The Guild "..topGuild.." domination the castle !")
local gid = getGuildId(topGuild)
setGlobalStorageValue(gid, 29002, -1)
setGlobalStorageValue(29002, gid)
setGlobalStorageValue(5181, 0)
MONSTER_ATTACKERS_GUILD = {}
return TRUE
end
function onStatsChange(cid, attacker, type, combat, value)
local player = isPlayer(attacker) and attacker or getCreatureMaster(attacker)
if isPlayer(player) and getPlayerGuildId(attacker) ~= 0 and type == STATSCHANGE_HEALTHLOSS then
local name = getPlayerGuildName(attacker)
if not MONSTER_ATTACKERS_GUILD[name] then
MONSTER_ATTACKERS_GUILD[name] = 0
end
MONSTER_ATTACKERS_GUILD[name] = MONSTER_ATTACKERS_GUILD[name] + value
end
return TRUE
end
Help-me.