Anakonta
Senior User
- Joined
- Oct 5, 2010
- Messages
- 536
- Reaction score
- 10
Cze??, napisa?em skrypt na tworzenie creatures(summon/pet) i mam kilka problem?w zwi?zanych z tym skryptem, m?j summon atakuje mnie i mo?na ich robi? ile si? chce, w configu mam ustawione maxsummons = 3. Co w tym skrypcie jest nie tak i jak to naprawi??
U?ywam silnika Devland 0.97B
Code:
function doPlayerAddSummon(cid, name, pos)
local creature = doSummonCreature(name, pos)
doConvinceCreature(cid, creature)
return creature
end
function onUse(cid, item, frompos, item2, topos)
local playerpos = getPlayerPosition(cid)
local tablica = {
exhausted_time = 10,
exhausted_storagevalue = 751416,
----------------------------------
SummonName = "Piccolo Summon",
PlayerSay = "Cloning: Two-Form",
MagLevel = 60,
Mana = 2000
}
if(os.time() > getPlayerStorageValue(cid, tablica.exhausted_storagevalue)) then
if item.itemid == 7596 then
if getTilePzInfo(playerpos) == 0 then
if getPlayerMagLevel(cid) >= tablica.MagLevel then
if getPlayerMana(cid) >= tablica.Mana then
doPlayerAddMana(cid, -tablica.Mana)
doPlayerSpalonaMana(cid, -tablica.Mana)
doPlayerSay(cid, tablica.PlayerSay, TALKTYPE_ORANGE_1)
doSendMagicEffect(playerpos,19)
setPlayerStorageValue(cid, tablica.exhausted_storagevalue, os.time() + tablica.exhausted_time)
--------------------------------------------Summon----------------------------------------------------------------------------------
mySummon1 = doPlayerAddSummon(cid, tablica.SummonName, playerpos)
doChangeSpeed(mySummon1, getCreatureBaseSpeed(cid) + getCreatureBaseSpeed(mySummon1))
doSetCreatureOutfit(mySummon1, getCreatureOutfit(cid), -1)
doCreatureAddHealth(mySummon1, getPlayerMaxHealth(cid) / 50)
else
doPlayerSendCancel(cid,"You do not have enough mana[2000].")
end
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid,"You do not have enough magic level[60].")
end
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "This action is not permitted in a protection zone.")
end
end
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
end
return 1
end
U?ywam silnika Devland 0.97B