vexler222
Active Member
- Joined
- Apr 22, 2012
- Messages
- 714
- Solutions
- 15
- Reaction score
- 46
Hi, can someone help me with damagemap? I tried add it few times, with examples from others topics, but everytime when i add it, script don't giving points for me, without any errors.
If someone can explain to me how damagemap works, I will be very grateful!
If someone can explain to me how damagemap works, I will be very grateful!
Code:
function onKill(creature, target)
local config = {
["Rotworm"] = {pkt = 1, },
}
if player:isPlayer() and target:isMonster() then
local monster = config[Creature(target):getName()]
local storage_v = 367465
local max_storage = 367466
if monster and player:getStorageValue(storage_v) <= player:getStorageValue(max_storage) then
player:setStorageValue(storage_v, player:getStorageValue(storage_v) + monster.pkt)
player:sendTextMessage(MESSAGE_EVENT_ORANGE, "You get " .. monster.pkt .. " points!")
elseif monster and player:getStorageValue(storage_v) >= player:getStorageValue(max_storage) then
player:sendTextMessage(MESSAGE_EVENT_ORANGE, "You can\'t get more points! Just purchase something!")
end
return true
end
Code:
function onKill(creature, target)
local config = {
["Rotworm"] = {pkt = 1, },
}
if player:isPlayer() and target:isMonster() then
local player = Player(cid)
local monster = config[Creature(target):getName()]
local storage_v = 367465
local max_storage = 367466
local targetMonster = Monster(target)
for currentPlayerId, currentDamage in pairs(targetMonster:getDamageMap()) do
local attackerPlayer = Player(currentPlayerId)
if attackerPlayer then
if monster and player:getStorageValue(storage_v) <= player:getStorageValue(max_storage) then
player:setStorageValue(storage_v, player:getStorageValue(storage_v) + monster.pkt)
player:sendTextMessage(MESSAGE_EVENT_ORANGE, "You get " .. monster.pkt .. " points!")
elseif monster and player:getStorageValue(storage_v) >= player:getStorageValue(max_storage) then
player:sendTextMessage(MESSAGE_EVENT_ORANGE, "You can\'t get more points! Just purchase something!")
end
end
end
end
return true
end
Last edited: