Jump to content

Recommended Posts

Boa tarde pessoal,

estou montando um servidor de Day Z e me deparei com o seguinte problema: Quando estou atirando e tento recarregar a arma , simplemente ela não recarrega. Vou passar para vocês os scripts que veio junto ao server. Galera se puderem me ajudar fico muito agradecido.

Vlw!

reload.lua

function forceReload(p) 
    reloadPedWeapon (p) 
end 
addCommandHandler("Reload weapon",forceReload) 
  
function bindPlayerReloadKey(p) 
    bindKey(p,"r","down","Reload weapon") 
end 
  
function bindReloadForAllPlayers() 
    for k,v in ipairs(getElementsByType("player")) do 
        bindPlayerReloadKey(v) 
    end 
end 
--addEventHandler("onResourceStart",getResourceRootElement(),bindReloadForAllPlayers) -- Enable when issue 4532 is fixed 
  
--Please remove the following when issue 4532 is fixt: 
  
addEvent("onPlayerReload",true) 
addEventHandler("onPlayerReload",getRootElement(), 
    function() 
        reloadPedWeapon (source) 
    end 
) 

reload_c.lua

addCommandHandler("Reload weapon", 
    function() 
        local task = getPedSimplestTask(localPlayer) 
        if ((task == "TASK_SIMPLE_JUMP" or task == "TASK_SIMPLE_IN_AIR") and not doesPedHaveJetPack(localPlayer)) then return end 
        triggerServerEvent("onPlayerReload", localPlayer) 
    end 
) 
  
bindKey("r","down","Reload weapon") 

meta.xml

  
<meta> 
    <info name="Reload" version="0.9" type="misc" author="Gamesnert" description="Script that allows you to reload your weapon by pushing the button for it"/> 
     
    <script src="reload.lua"/> 
    <script src="reload_c.lua" type="client"/> 
</meta> 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...