Odp: Summon !!! Pomoc
Dopatrzy?em si? tak?e b??du w pliku script.lua z action(radz? zmieni?):
[lua]function onUse(cid, item, frompos, item2, topos)
local pet_name = "rat"
if item.itemid == 11256 then
if not getTilePzInfo(getPlayerPosition(cid)) then
if #getCreatureSummons(cid) < 1 then
doRemoveItem(item.uid, 11256)
setPlayerStorageValue(cid, 12345, 1)
local summon = doSummonCreature(pet_name, getThingPos(cid))
doConvinceCreature(cid, summon)
doSendMagicEffect(getCreaturePosition(summon), 67)
doCreatureSay(cid, "Pomoz mi, ".. pet_name .. "!", TALKTYPE_SAY)
else
doPlayerSendCancel(cid, "Mozesz przywolac tylko jednego pomocnika na raz.")
end
else
doPlayerSendCancel(cid, "Nie mozesz przywolac pomocnika w strefie bezpiecznej.")
end
end
return true
end[/lua]
Co do czasu to trzymaj, podajesz w sekundach:
[lua]local config = {healthPercent = 15.0, manaPercent = 15.0, time = 1}
function onThink(cid, interval)
if last_interval == nil then last_interval= os.clock() end
if getPlayerStorageValue(cid, 12345) == 1 and #getCreatureSummons(cid) == 0 then
doPlayerAddItem(cid,11256,1)
setPlayerStorageValue(cid, 12345, 0)
end
if getPlayerStorageValue(cid, 12345) == 1 then
if isPlayer(cid) == true then
hp = config.healthPercent
mp = config.manaPercent
local hpheal, mpheal = getCreatureMaxHealth(cid)*(hp/100), getPlayerMaxMana(cid) * (mp / 100)
if (os.clock() - last_interval) > config.time then
if hpheal >= 1 and getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
doCreatureAddHealth(cid, hpheal)
end
if getPlayerMana(cid) < getPlayerMaxMana(cid) then
if mpheal >= 1 then
doPlayerAddMana(cid, mpheal)
end
end
last_interval= os.clock()
end
end
end
return true
end[/lua]