What's new

Tibia [8.6] - TFS 4.0 / 3.777 - Licznik Potworów

robert100

User
Joined
Apr 30, 2011
Messages
47
Reaction score
0
Witam prosiłbym was o przerobienie skryptu tak żeby pokazywało co 10 zabity potworów Zabiles 10 Demonów / Zabiłeś 20 Demonów

function onKill(cid, target)
if(isPlayer(target) ~= TRUE) then
local name = getCreatureName(target)
local monster = monsters[string.lower(name)]
if(monster) then
local killedMonsters = getPlayerStorageValue(cid, monster)
if(killedMonsters == -1) then
killedMonsters = 1
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Zabiles " .. killedMonsters .. " " .. name .. "'s.")
setPlayerStorageValue(cid, monster, killedMonsters + 1)
end
end
return TRUE
end

Zmienienie jakiej kolwiek wartosci z 1 na 10 nie pomaga..
Jesli tutaj dam +10 setPlayerStorageValue(cid, monster, killedMonsters + 1) to wtedy liczy jednego potwora jako 10. Czegoś tutaj brakuje, lecz nie wiem czego i proszę o pomoc.... Pozdrawiam!
 

kamioool

Active User
Joined
Oct 18, 2008
Messages
102
Reaction score
5
@robert100

Nie było tu sprawdzenia czy liczba jest multiplikacja liczby 10, ten kod powinien działać:

INI:
function onKill(cid, target)
if(isPlayer(target) ~= TRUE) then
local name = getCreatureName(target)
local monster = monsters[string.lower(name)]
if(monster) then
local killedMonsters = getPlayerStorageValue(cid, monster)
if(killedMonsters == -1) then
killedMonsters = 1
end
if killedMonsters % 10 == 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Zabiles " .. killedMonsters .. " " .. name .. "'s.")
end
setPlayerStorageValue(cid, monster, killedMonsters + 1)
end
end
return TRUE
end
 
Top