Sign in to follow this  
icarus

reload a specific weapon

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.

Share this post


Link to post

yeah lol, but still i changed that, in jay's version and my version, still doesnt work

Share this post


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.

Share this post


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) 

Share this post


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

Share this post


Link to post

still not working, omg, just a simple thing gives more work that a bunch of bigger things.

Share this post


Link to post

still not working DEBUGSCRIPT MESSAGE: ERROR:\client.lua:3:attempt to call global 'setWeaponPropriety' (a nil value)

Share this post


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) 

Share this post


Link to post

lol, thanks works, i tryed this but only in "poor" mode maybe thats why it didnt work, thanks

Share this post


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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.