Jump to content

Hey how can I do that


Hero192

Recommended Posts

Reload is just a resource in your server resources folder, you could edit it and make an exception for your script.

I am really confused , I don't know what I've to edit in this case, can you give me a hand please

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 
  
addEvent("onPlayerReload",true) 
addEventHandler("onPlayerReload",getRootElement(), 
    function() 
        reloadPedWeapon (source) 
    end) 

--client of reload resource:

addCommandHandler("Reload weapon", 
    function() 
        triggerServerEvent("onPlayerReload",getLocalPlayer()) 
    end)  
bindKey("r","down","Reload weapon") 

Link to comment
local thePlayer = getLocalPlayer() 
function checkSilenced ( ) 
local weapon = getPedWeapon ( thePlayer ) 
if weapon == 23 then 
toggleControl ( "fire", false ) 
toggleControl ( "aim_weapon", false ) 
end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), checkSilenced )  

Link to comment

Yes, but I already explained to solidsnake that this function "toggleControl" "fire", force the player to reload after the end of the timer.

and he recommend me to edit this reload resource which it in my server,

If you know how please help me

function forceReload(player) 
    reloadPedWeapon (player) 
end 
addCommandHandler("Reload weapon",forceReload) 
  
function bindPlayerReloadKey(player) 
    bindKey(player,"r","down","Reload weapon") 
end 
  
function bindReloadForAllPlayers() 
    for  index, player  in  ipairs(getElementsByType("player")) do 
        bindPlayerReloadKey(player) 
    end 
end 
  
addEvent("onPlayerReload",true) 
addEventHandler("onPlayerReload",getRootElement(), 
function() 
       reloadPedWeapon (source) 
end) 

Link to comment
Im sorry i didnt understand what u mean ..

Listen, I agree with using toggelControl function but when I use it, I set a Timer to the shooter and When the timer ends the player can't shoot again normaly, He need to "RELOAD" the weapon by pressing "R" key to shoot.

And it's kinda annoying I want it to shoot after the timer ends without any reload..

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