Boa Tarde Xtibianos,
venho aqui hoje pedir a ajuda de vocês, tenho um sistema de Spell e Talkaction que é uma arma que ao usar comando !ak ele troca de munição, só que ele continua tirando a mesma quantidade de vida dos monstros nao importa o level nem a munição, gostaria de pedir a vocês que no nivel 8 tirasse 100 com Bala 1 e 150 com a Bala 2 e ao upar nivel 10 por exemplo tirasse 120 com bala 1 e 180 com bala 2
AK GOLD em Spells: <rune name="AK-47" id="2088" allowfaruse="1" charges="1" lvl="1" maglv="0" exhaustion="1000" blocktype="solid" script="ak_ammo.lua"/> E em "ak_ammo.lua" da pasta scripts de spells, adicione o script abaixo: Spoiler local arma = 2088 local bullets = 2298 local chumbos = 2299 local storage = 30012 local msg = "Equipe a %s na mao esquerda e a municao na mae direita para poder atirar." local attackmin, attackmax = 600, 900 -- attack minimo, attack maximo function onCastSpell(cid, var) local left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid local shoot = getPlayerItemCount(cid, bullets) local shoot2 = getPlayerItemCount(cid, chumbos) local permissao = getPlayerStorageValue(cid, storage) local target = getCreatureTarget(cid) local hit = (math.random(attackmin,attackmax) + getPlayerSkillLevel(cid, SKILL_DISTANCE) / 3) if isInArray({left}, arma) then else return doPlayerSendCancel(cid, msg:format(getItemNameById(arma))) end if (permissao == 1) then if (shoot <= 0) then return doPlayerSendCancel(cid, 'Voce precisa de bullets para usar sua AK-47.') else if (target <= 0) then return doPlayerSendCancel(cid, 'Selecione um alvo.') else doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -hit, -hit, CONST_ME_MORTAREA) doSendDistanceShoot(getCreaturePos(cid), getCreaturePos(target), 15) doPlayerRemoveItem(cid, bullets, 1) end end else if (shoot2 <= 0) then return doPlayerSendCancel(cid, 'Voce precisa de chumbos para usar sua AK-47.') else if (target <= 0) then return doPlayerSendCancel(cid, 'Selecione um alvo.') else doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -hit, -hit, CONST_ME_MORTAREA) doSendDistanceShoot(getCreaturePos(cid), getCreaturePos(target), 15) doPlayerRemoveItem(cid, chumbos, 1) end end end return TRUE end
Ak gold em TALKACTION: <talkaction words="!ak" event="script" value="ak_ammo.lua"/> Agora crie um arquivo chamado "ak_ammo.lua" em scripts e adicione o código abaixo: local storage = 30012 function onSay(cid, words, param) if getPlayerStorageValue(cid, storage) == 1 then setPlayerStorageValue(cid, storage, 2) doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Agora sua Ak-47 pode atirar chumbos.") else setPlayerStorageValue(cid, storage, 1) doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Agora sua Ak-47 pode atirar bullets.") end return true end