nic062 Posted September 4, 2013 Posted September 4, 2013 Hello Everybody, I think there is a problem with the function getWeaponAmmo when it's used with a custom weapon created with createWeapon. It seems that the function always return 0. Here is an example : local theWeapon addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() theWeapon = createWeapon("m4", 1, 1, 3) setWeaponOwner(theWeapon, localPlayer) setWeaponClipAmmo(theWeapon, 10) setWeaponAmmo(theWeapon, 90) end) function handleCustomWeapon() if getKeyState("mouse1") then setWeaponState(theWeapon, "firing") else setWeaponState(theWeapon, "ready") end dxDrawText("getWeaponClipAmmo = "..getWeaponClipAmmo(theWeapon).."\ngetWeaponAmmo = "..getWeaponAmmo(theWeapon), 100, 200) setControlState("fire", false) end addEventHandler("onClientPreRender", getRootElement(), handleCustomWeapon) Can you confirm me or explain why my script doesn't work. Cordialy. ps : I use
WASSIm. Posted September 7, 2013 Posted September 7, 2013 addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() theWeapon = createWeapon("m4", 1, 1, 3) setWeaponOwner(theWeapon, localPlayer) setWeaponClipAmmo(theWeapon, 10) setWeaponAmmo(theWeapon, 90) end) function handleCustomWeapon() if getKeyState("mouse1") then setWeaponState(theWeapon, "firing") else setWeaponState(theWeapon, "ready") end dxDrawText("getWeaponClipAmmo = "..getWeaponClipAmmo(theWeapon).." \n getWeaponAmmo = "..getWeaponAmmo(theWeapon), 100, 200) setControlState("fire", false) end addEventHandler("onClientPreRender", getRootElement(), handleCustomWeapon)
TAPL Posted September 7, 2013 Posted September 7, 2013 setWeaponAmmo is server side........ Server side for player weapon, but client side for custom weapon.
nic062 Posted September 7, 2013 Author Posted September 7, 2013 @WASSIm the space after the \n is not important but thank's for help @GamerDeMTA Yes client side for custom weapon, thank's too. I think is a real bug, I will report this bug this week on the bugtracker
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now