Jump to content

reload a specific weapon


icarus

Recommended Posts

I made this but for idk why it doesnt work, it doesnt even output a debugscript message, can u help ?

---Clientside 
function reloadtazerclient () 
if getPedWeapon ( getLocalPlayer())== 23 then 
triggerServerEvent ("ontazershoot", getLocalPlayer()) 
end 
end 
addEventHandler ("onClientPedWeaponFire", getRootElement(), reloadtazerclient) 
  

---Serverside 
addEvent ("ontazershoot", true) 
  
function tazershootserverside(sourcePlayer) 
reloadPedWeapon ( sourcePlayer ) 
end 
addEventHandler("ontazershoot", getRootElement(),tazershootserverside) 

(i already tryed "(source)" insted of "(sourcePlayer)", and "weapon == 23" insted of " getPedWeapon ( getLocalPlayer())== 23", and didnt work.

Link to post

-- client side:

function reloadtazerclient ( weapon ) 
    if ( weapon == 23 ) then 
        triggerServerEvent ( "ontazershoot", localPlayer ) 
    end 
end 
addEventHandler ( "onClientPlayerWeaponFire", localPlayer, reloadtazerclient ) 

-- server side:

function tazershootserverside ( ) 
    reloadPedWeapon ( source ) 
end 
addEvent ( "ontazershoot", true ) 
addEventHandler ( "ontazershoot", root, tazershootserverside ) 

That should work.

Link to post

yeah lol, this must be simplier, but still cant work with it

---clientside 
function tazerreload( startedRes ) 
setWeaponProperty ( 23, "maximum_clip_ammo", 1 ) 
end 
addEventHandler( "onClientResourceStart", getLocalPlayer( ),tazerreload) 

Link to post

actually, it's a resource, so try this:

---clientside 
function tazerreload( startedRes ) 
setWeaponProperty ("silenced_pistol" ,"poor", "maximum_clip_ammo", 1 ) 
end 
addEventHandler( "onResourceStart", resourceRoot,tazerreload) 

Edited by Guest
Link to post

Server:

function tazerreload( startedRes ) 
    setWeaponProperty ( 23, "poor", "maximum_clip_ammo", 1 ) 
    setWeaponProperty ( 23, "std", "maximum_clip_ammo", 1 ) 
    setWeaponProperty ( 23, "pro", "maximum_clip_ammo", 1 ) 
end 
addEventHandler( "onResourceStart", resourceRoot,tazerreload) 

Link to post

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