Jump to content

Weapon Reload


Recommended Posts

  • 3 weeks later...
Olá galera, estou com problema com o reload do meu servidor.. Até achei um script na internet, porém não funciona. Alguém teria esse script pra me ajudar?

Server:

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 
) 

Client:

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") 

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...