Zafire Posted July 27, 2011 Share Posted July 27, 2011 Its possible to make that?.. when somebody dont have more ammo, the weapon dont dissapear? Link to comment
Jaysds1 Posted July 27, 2011 Share Posted July 27, 2011 there's no such thing as "getWeaponAmmo". there's only giveWeaponAmmo or setWeaponAmmo. Link to comment
BabY Posted July 27, 2011 Share Posted July 27, 2011 You can get the weapon's .dff and .txd, stick it to the player's hand while loading the weapon's animation (hold) using that sticky bones script Link to comment
GodFather Posted July 27, 2011 Share Posted July 27, 2011 As far as I know there is an object for each weapon? So he don't need to get .dff and .txd just create an object in his hand. Link to comment
BabY Posted July 27, 2011 Share Posted July 27, 2011 As far as I know there is an object for each weapon? So he don't need to get .dff and .txd just create an object in his hand. I though It's damaged \ burned ...? Link to comment
H5N1 Posted July 27, 2011 Share Posted July 27, 2011 https://wiki.multitheftauto.com/wiki/Weapon - model ID. Link to comment
Castillo Posted July 27, 2011 Share Posted July 27, 2011 there's no such thing as "getWeaponAmmo".there's only giveWeaponAmmo or setWeaponAmmo. https://wiki.multitheftauto.com/wiki/GetPedTotalAmmo Link to comment
Jaysds1 Posted July 27, 2011 Share Posted July 27, 2011 ok, that's better... function(player) if (getPlayerAmmoInClip(player) == 0) then takeWeapon(player,getPedWeapon(player,current)) end end Link to comment
Castillo Posted July 28, 2011 Share Posted July 28, 2011 Jaysd1, he's asking how to STOP GTA to take the weapon when ammo is 0, not to take the weapon (again) when ammo is 0. Link to comment
Jaysds1 Posted July 28, 2011 Share Posted July 28, 2011 ohhhh, ok here: function(player) if (getPlayerAmmoInClip(player) == 0) then giveWeapon(player,getPedWeapon(player,current)) end end Link to comment
Zafire Posted July 28, 2011 Author Share Posted July 28, 2011 ohhhh, okhere: function(player) if (getPlayerAmmoInClip(player) == 0) then giveWeapon(player,getPedWeapon(player,current)) end end thxx.. but that function will give a player the weapon to the player with 0 ammo?.. Link to comment
Jaysds1 Posted July 28, 2011 Share Posted July 28, 2011 ohhh, you want to give the player the weapon with ammo? Link to comment
JR10 Posted July 28, 2011 Share Posted July 28, 2011 giveWeapon(player, weapon, ammo) Use the ammo argument Link to comment
Zafire Posted July 28, 2011 Author Share Posted July 28, 2011 ohhh, you want to give the player the weapon with ammo? no, i want when player have "0" ammo, gta sa dont DELETE the weapon, i want to the player have the weapon in his hand with 0 ammo.. he cant use it, but the weapon dont dissapear Link to comment
Jaysds1 Posted July 28, 2011 Share Posted July 28, 2011 I made the script, I don't think there's anyway to stop gta from taking the gun, but rather give abck the gun... Link to comment
GodFather Posted July 28, 2011 Share Posted July 28, 2011 ohhh, you want to give the player the weapon with ammo? no, i want when player have "0" ammo, gta sa dont DELETE the weapon, i want to the player have the weapon in his hand with 0 ammo.. he cant use it, but the weapon dont dissapear Then a good way to do that is using ♫ MI550 ♫ way. When he ran out of ammo put an weapon object of the same weapon in his hand. I don't think there is any other way. Link to comment
Maccer. Posted July 29, 2011 Share Posted July 29, 2011 There's no current way in MTA to disable GTA's automatic removal of an empty weapon, or make it show 0 - 0 at the moment. You could try setting the weapon to a negative ammo value, but I don't think that will work. You could try attaching the weapon model to the player's hand when the gun disappears using this resource's function. https://community.multitheftauto.com/index.php?p= ... ls&id=2540 Link to comment
Buffalo Posted July 29, 2011 Share Posted July 29, 2011 Oh just you stop with those attachments, will ye? there is great way to do it, work-around like always: Always give player 1 bullet more than it is needed. Also note that you have to make custom hud, or at least custom ammo showing with DX draw or GUI functions. And make it show one bullet less than it really has. gMe = getLocalPlayer() addEventHandler('onClientPlayerWeaponFire',gMe,function(weapon,ammo,inClip,hitX, hitY, hitZ, hitElement) if(weapon > 15 and weapon < 19) or weapon == 39 then return if(ammo == 1) then toggleControl('fire',false) --bindKey('fire','down',playTickSound) --also make a function to play empty clip sound for better playback end end) addEventHandler('onClientPlayerWeaponSwitch',gMe,function(prevSlot,currSlot) if(getPedTotalAmmo(prevSlot) == 1) then toggleControl('fire',true) end if(getPedTotalAmmo(currSlot) == 1) then toggleControl('fire',false) end end) Of course no guarantee if it will work perfectly, as i've edited a big piece of code. And make alternative ammo showing (at least) yourself. Disable old one using showPlayerHudComponent('ammo',false) Link to comment
qaisjp Posted July 29, 2011 Share Posted July 29, 2011 Remember to cancel the event @ line 7 (or does toggleControl already stop it?) Link to comment
Zafire Posted July 29, 2011 Author Share Posted July 29, 2011 Oh just you stop with those attachments, will ye? there is great way to do it, work-around like always:Always give player 1 bullet more than it is needed. Also note that you have to make custom hud, or at least custom ammo showing with DX draw or GUI functions. And make it show one bullet less than it really has. gMe = getLocalPlayer() addEventHandler('onClientPlayerWeaponFire',gMe,function(weapon,ammo,inClip,hitX, hitY, hitZ, hitElement) if(weapon > 15 and weapon < 19) or weapon == 39 then return if(ammo == 1) then toggleControl('fire',false) --bindKey('fire','down',playTickSound) --also make a function to play empty clip sound for better playback end end) addEventHandler('onClientPlayerWeaponSwitch',gMe,function(prevSlot,currSlot) if(getPedTotalAmmo(prevSlot) == 1) then toggleControl('fire',true) end if(getPedTotalAmmo(currSlot) == 1) then toggleControl('fire',false) end end) Of course no guarantee if it will work perfectly, as i've edited a big piece of code. And make alternative ammo showing (at least) yourself. Disable old one using showPlayerHudComponent('ammo',false) thxx it works perfect, but the tickSound dont works, i think its because is disabled control Fire.. but its fine.. Link to comment
qaisjp Posted July 30, 2011 Share Posted July 30, 2011 Read the commented out line, he says you need to make a function that plays a sound. See playSound Link to comment
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