Jump to content

[HELP] Weapon reload


Galactix

Recommended Posts

Posted (edited)

Hello, I'm trying to make a script to reload weapons but I can't get it working

function weaponReload() 
local wep = getPlayerWeapon ( localPlayer )

	setWeaponClipAmmo(wep, 7)
end
addCommandHandler("reload", weaponReload)
 I tried this to reload my desert eagle but it outputs the following error :
 
Quote

Bad argument @ 'setWeaponClipAmmo' [Expected weapon at argument 1, got number '24']

I don't really see what else than the weapon ID I could use that expected weapon error

 
Anyone knows how to fix it?
 
EDIT: After further research it turns out there was a built-in resource in the MTA files, problem solved
Edited by Galactix

If I helped you, make sure you click the reaction button on the right to support me!
It will grant me more visibility and will help me to help others!

If you have any kind of request or subject you would like to discuss about with me,
don't hesitate to send me a private message about it!

 

Posted

Yeah I agree, but I was going to bind the command to a key at resource start, so results would’ve been the same.

On 13/06/2018 at 15:57, _Evo_ said:

reloading with R key is more fast than "reload" command no?

Thanks, that’s pretty useful!

On 12/06/2018 at 09:16, Patrick2562 said:

 

If I helped you, make sure you click the reaction button on the right to support me!
It will grant me more visibility and will help me to help others!

If you have any kind of request or subject you would like to discuss about with me,
don't hesitate to send me a private message about it!

 

Posted

i have no idea what you going to do but, the default reload resource will save your time 

On 6/15/2018 at 02:40, Galactix said:

Yeah I agree, but I was going to bind the command to a key at resource start, so results would’ve been the same.

Thanks, that’s pretty useful!

 

 

Posted
On ‎12‎/‎06‎/‎2018 at 00:34, Galactix said:

EDIT: After further research it turns out there was a built-in resource in the MTA files, problem solved

Which is what I did ;)

If I helped you, make sure you click the reaction button on the right to support me!
It will grant me more visibility and will help me to help others!

If you have any kind of request or subject you would like to discuss about with me,
don't hesitate to send me a private message about it!

 

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