mRefaat
Marketing and Coding
Hello
i am using 0.3.7
i was trying to convert this script to work with 0.3.7 but it is not working
what i have done
any help to make it work ?
i am using 0.3.7
i was trying to convert this script to work with 0.3.7 but it is not working
Monster - Training Dummy with DPS calculation
Simple training dummy that is showing players DPS (Damage Per Second). The highest DPS is stored in storage and can be used for different things, like rewards or requirements for items or something, I don't know, use your brain. Open data/creaturescripts/creaturescripts.xml Add Open...
otland.net
what i have done
Lua:
DPS_STORAGE = 50392
PLAYER_DPS = {}
PLAYER_EVENTS = {}
function onStatsChange(cid, attacker, type, combat, value)
if not cid then
return true
end
if not attacker then
return true
end
local function ReadDPS(cid, attacker)
local player = attacker
local target = cid
if player and target then
PLAYER_DPS[pid] = PLAYER_DPS[pid] * -1
if PLAYER_DPS[pid] > getPlayerStorageValue(player, DPS_STORAGE) then
setPlayerStorageValue(player, DPS_STORAGE, PLAYER_DPS[pid])
doCreatureSay(target, string.format("New Record! DPS: %d", PLAYER_DPS[pid]), TALKTYPE_MONSTER, nil, nil, getCreaturePosition(target))
else
doCreatureSay(target, string.format("DPS: %d", PLAYER_DPS[pid]), TALKTYPE_MONSTER, nil, nil, getCreaturePosition(target))
end
PLAYER_DPS[pid] = 0
PLAYER_EVENTS[pid] = nil
end
end
if isMonster(cid) and isPlayer(attacker) then
local damage = value
local pid = attacker
if not PLAYER_DPS[pid] then PLAYER_DPS[pid] = 0 end
PLAYER_DPS[pid] = PLAYER_DPS[pid] + damage
if not PLAYER_EVENTS[pid] then
PLAYER_EVENTS[pid] = addEvent(ReadDPS, 1000)
end
end
return true
end
any help to make it work ?