Ir para conteúdo

Featured Replies

Postado
24 minutos atrás, Neox3042 disse:

 

Estou tentando criar um sistema de que a arma (action) aumente o dano de acordo com o level

 

 mas a Função getPlayerLevel não funciona na pasta Actions

 

como fazer isso?



 

 

 

 

Posta o script!

 

Postado
  • Autor
local need_target = true 
local bullet_id = 2543
local shots_amount = 1
local exhaustion_time = -0.1
local exhaust = 19302 
local dmg_min, dmg_max = -600, -620
local shot_effect = 17
local shot_distance_effect = 7
local damage_type = COMBAT_PHYSICALDAMAGE
local shots_delay = 330
local slots = {CONST_SLOT_LEFT, CONST_SLOT_RIGHT} 
local control = 0 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    for a, b in ipairs(slots) do
        if getPlayerSlotItem(cid, b).uid ~= item.uid then
            control = control + 1
        end
    end
    if control == slots then
        return doPlayerSendCancel(cid, "Coloque a arma no slot correto.")
    end
    if need_target then
        if getCreatureTarget(cid) <= 0 then
            return doPlayerSendCancel(cid, "Selecione um alvo primeiro.")
        elseif getPlayerItemCount(cid, bullet_id) < shots_amount then
            return doPlayerSendCancel(cid, "Você não possui munição.")
        elseif exhaustion.check(cid, exhaust) then
            return doPlayerSendCancel(cid, "Aguarde "..(exhaustion.get(uid, exhaust)).." segundos para usar a arma novamente.")
        end
        
        exhaustion.set(cid, exhaust, exhaustion_time)
        for i = 0, shots_amount-1 do
            addEvent(function()
                if getCreatureTarget(cid) <= 0 then
                    return true
                elseif getPlayerItemCount(cid, bullet_id) < 1 then
                    return doPlayerSendCancel(cid, "Você não possui munição.")
                end
                doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(getCreatureTarget(cid)), shot_distance_effect)
                doTargetCombatHealth(cid, getCreatureTarget(cid), damage_type, dmg_min, dmg_max, shot_effect)
                doPlayerRemoveItem(cid, bullet_id, 1)
            end, shots_delay*i)
        end
    else
        if not isCreature(itemEx.uid) then
            return doPlayerSendCancel(cid, "Selecione um alvo primeiro.")
        elseif getPlayerItemCount(cid, bullet_id) < shots_amount then
            return doPlayerSendCancel(cid, "Você não possui munição.")
        elseif exhaustion.check(cid, exhaust) then
            return doPlayerSendCancel(cid, "Aguarde "..(exhaustion.get(cid, exhaust)).." segundos para usar a arma novamente.")
        end
        
        exhaustion.set(cid, exhaust, exhaustion_time)
        for i = 0, shots_amount-1 do
            addEvent(function()
                if not isCreature(itemEx.uid) then
                    return true
                elseif getPlayerItemCount(cid, bullet_id) < 1 then
                    return doPlayerSendCancel(cid, "Você não possui munição.")
                end
                doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(itemEx.uid), shot_distance_effect)
                doTargetCombatHealth(cid, itemEx.uid, damage_type, dmg_min, dmg_max, shot_effect)
                doPlayerRemoveItem(cid, bullet_id, 1)
            end, shots_delay*i)
        end
    end
    return true

end
4 minutos atrás, KOLISAO disse:

Posta o script!

 

No caso ai é o Script sem o sistema de aumentar o dano por Level.

Postado
local need_target = true 
local bullet_id = 2543
local shots_amount = 1
local exhaustion_time = -0.1
local exhaust = 19302 
local dmg_min, dmg_max = ((getPlayerLevel(cid)*3)/2), ((getPlayerLevel(cid)*3.5)/2)
local shot_effect = 17
local shot_distance_effect = 7
local damage_type = COMBAT_PHYSICALDAMAGE
local shots_delay = 330
local slots = {CONST_SLOT_LEFT, CONST_SLOT_RIGHT} 
local control = 0 


function onUse(cid, item, fromPosition, itemEx, toPosition)
    for a, b in ipairs(slots) do
        if getPlayerSlotItem(cid, b).uid ~= item.uid then
            control = control + 1
        end
    end
	
    if control == slots then
        return doPlayerSendCancel(cid, "Coloque a arma no slot correto.")
    end
	
    if need_target then
        if getCreatureTarget(cid) <= 0 then
            return doPlayerSendCancel(cid, "Selecione um alvo primeiro.")
		elseif getPlayerItemCount(cid, bullet_id) < shots_amount then
            return doPlayerSendCancel(cid, "Você não possui munição.")        
		elseif exhaustion.check(cid, exhaust) then
            return doPlayerSendCancel(cid, "Aguarde "..(exhaustion.get(uid, exhaust)).." segundos para usar a arma novamente.")
        end
        exhaustion.set(cid, exhaust, exhaustion_time)
        
		for i = 0, shots_amount-1 do
            addEvent(function()
                if getCreatureTarget(cid) <= 0 then
                    return true
                elseif getPlayerItemCount(cid, bullet_id) < 1 then
                    return doPlayerSendCancel(cid, "Você não possui munição.")
                end
                doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(getCreatureTarget(cid)), shot_distance_effect)
                doTargetCombatHealth(cid, getCreatureTarget(cid), damage_type, dmg_min, dmg_max, shot_effect)
                doPlayerRemoveItem(cid, bullet_id, 1)
            end, shots_delay*i)
        end
    else
        if not isCreature(itemEx.uid) then
            return doPlayerSendCancel(cid, "Selecione um alvo primeiro.")
        elseif getPlayerItemCount(cid, bullet_id) < shots_amount then
            return doPlayerSendCancel(cid, "Você não possui munição.")
        elseif exhaustion.check(cid, exhaust) then
            return doPlayerSendCancel(cid, "Aguarde "..(exhaustion.get(cid, exhaust)).." segundos para usar a arma novamente.")
        end
        
        exhaustion.set(cid, exhaust, exhaustion_time)
        for i = 0, shots_amount-1 do
            addEvent(function()
                if not isCreature(itemEx.uid) then
                    return true
                elseif getPlayerItemCount(cid, bullet_id) < 1 then
                    return doPlayerSendCancel(cid, "Você não possui munição.")
                end
                doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(itemEx.uid), shot_distance_effect)
                doTargetCombatHealth(cid, itemEx.uid, damage_type, dmg_min, dmg_max, shot_effect)
                doPlayerRemoveItem(cid, bullet_id, 1)
            end, shots_delay*i)
        end
    end
    return true
end

Não cheguei a testar...

Formula: linha 6

 

Postado
  • Autor
20 minutos atrás, KOLISAO disse:

local need_target = true 
local bullet_id = 2543
local shots_amount = 1
local exhaustion_time = -0.1
local exhaust = 19302 
local dmg_min, dmg_max = ((getPlayerLevel(cid)*3)/2), ((getPlayerLevel(cid)*3.5)/2)
local shot_effect = 17
local shot_distance_effect = 7
local damage_type = COMBAT_PHYSICALDAMAGE
local shots_delay = 330
local slots = {CONST_SLOT_LEFT, CONST_SLOT_RIGHT} 
local control = 0 


function onUse(cid, item, fromPosition, itemEx, toPosition)
    for a, b in ipairs(slots) do
        if getPlayerSlotItem(cid, b).uid ~= item.uid then
            control = control + 1
        end
    end
	
    if control == slots then
        return doPlayerSendCancel(cid, "Coloque a arma no slot correto.")
    end
	
    if need_target then
        if getCreatureTarget(cid) <= 0 then
            return doPlayerSendCancel(cid, "Selecione um alvo primeiro.")
		elseif getPlayerItemCount(cid, bullet_id) < shots_amount then
            return doPlayerSendCancel(cid, "Você não possui munição.")        
		elseif exhaustion.check(cid, exhaust) then
            return doPlayerSendCancel(cid, "Aguarde "..(exhaustion.get(uid, exhaust)).." segundos para usar a arma novamente.")
        end
        exhaustion.set(cid, exhaust, exhaustion_time)
        
		for i = 0, shots_amount-1 do
            addEvent(function()
                if getCreatureTarget(cid) <= 0 then
                    return true
                elseif getPlayerItemCount(cid, bullet_id) < 1 then
                    return doPlayerSendCancel(cid, "Você não possui munição.")
                end
                doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(getCreatureTarget(cid)), shot_distance_effect)
                doTargetCombatHealth(cid, getCreatureTarget(cid), damage_type, dmg_min, dmg_max, shot_effect)
                doPlayerRemoveItem(cid, bullet_id, 1)
            end, shots_delay*i)
        end
    else
        if not isCreature(itemEx.uid) then
            return doPlayerSendCancel(cid, "Selecione um alvo primeiro.")
        elseif getPlayerItemCount(cid, bullet_id) < shots_amount then
            return doPlayerSendCancel(cid, "Você não possui munição.")
        elseif exhaustion.check(cid, exhaust) then
            return doPlayerSendCancel(cid, "Aguarde "..(exhaustion.get(cid, exhaust)).." segundos para usar a arma novamente.")
        end
        
        exhaustion.set(cid, exhaust, exhaustion_time)
        for i = 0, shots_amount-1 do
            addEvent(function()
                if not isCreature(itemEx.uid) then
                    return true
                elseif getPlayerItemCount(cid, bullet_id) < 1 then
                    return doPlayerSendCancel(cid, "Você não possui munição.")
                end
                doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(itemEx.uid), shot_distance_effect)
                doTargetCombatHealth(cid, itemEx.uid, damage_type, dmg_min, dmg_max, shot_effect)
                doPlayerRemoveItem(cid, bullet_id, 1)
            end, shots_delay*i)
        end
    end
    return true
end

Não cheguei a testar...

Formula: linha 6

 

Quando aperta o botão pra dar USE na creature aparece "You cannot use this object"

 

Quando digita getPlayerName não aparece como uma função utilizável igual as outras.

Editado por Neox3042 (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo