undefined Posted June 15, 2015 Posted June 15, 2015 While the weapon bullets 0, weapons disappear. How can I prevent it?
HUNGRY:3 Posted June 15, 2015 Posted June 15, 2015 can you give us more info what do you want to do ? when the weapon bullets is 0 ....it disappear...so he want to keep the weapon with the player when the weapon bullets is 0
3B00DG4MER Posted June 15, 2015 Posted June 15, 2015 setElementData can do it SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
Walid Posted June 15, 2015 Posted June 15, 2015 just you need to check everytime when they use the weapon to see if the ammo is 1, if yes just disable the fire control. Note : you need to do the same thing when they switch weapons. So all what you need is onClientPlayerWeaponFire onClientPlayerWeaponSwitch getPedTotalAmmo() toggleControl() Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Anubhav Posted June 16, 2015 Posted June 16, 2015 just you need to check everytime when they use the weapon to see if the ammo is 1, if yes just disable the fire control.Note : you need to do the same thing when they switch weapons. So all what you need is onClientPlayerWeaponFire onClientPlayerWeaponSwitch getPedTotalAmmo() toggleControl() Why when 1 ammo? Just check when the weapon is gone, client side with onClientRender. ToggleControl -> add ammo for that weapon. Pretty simple and better. See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Walid Posted June 16, 2015 Posted June 16, 2015 Why you need to use "onClientRender" event simply it can be done using this two events "onClientPlayerWeaponFire" and "onClientPlayerWeaponSwitch" . -- Example addEventHandler ( "onClientPlayerWeaponFire", localPlayer, function ( weapon ) if ( getPedTotalAmmo ( localPlayer ) == 1 ) then toggleControl ( "fire", false ) end end ) addEventHandler ( "onClientPlayerWeaponSwitch", localPlayer, function ( ) toggleControl ( "fire", true ) if ( getPedTotalAmmo ( localPlayer ) == 1 ) then toggleControl ( "fire", false ) end end ) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Moderators IIYAMA Posted June 16, 2015 Moderators Posted June 16, 2015 Doesn't work with all weapons, some weapons (minigun/spray can) do have a fire rate of 1 bullet per frame. They will always fire 1 more bullet ahead of the toggleControl block. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Dealman Posted June 16, 2015 Posted June 16, 2015 Why when 1 ammo? Just check when the weapon is gone, client side with onClientRender. ToggleControl -> add ammo for that weapon. Pretty simple and better. Yeah, better to run it 30-60 times per second than once every time he tries to fire. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
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