Wisam Posted April 19, 2014 Share Posted April 19, 2014 Hello.. Im just starting to learn lua and i wanted to make a small script its when you kill a player you get extra amount of ammo for the weapon that killed him and each weapon get different amount of ammo (e.g M4 50 rounds for a kill, Sniper 10 rounds for a kill) I tryed to make it that each weapon gives different amount but i failed and made that it gives a random amount whatever the weapon was please help me Here's the script: Thanks to Mr.Miracle addEventHandler("onPlayerWasted",root,function(ammo,killer,wep) if getElementType(killer) == "player" and killer ~= source and wep > 9 then setWeaponAmmo(killer,wep,ammo+math.random(10,30)) end end) Link to comment
TAPL Posted April 19, 2014 Share Posted April 19, 2014 local weaponA = { [31] = 50, -- M4 [34] = 10 -- Sniper } function playerWasted(_, attacker, weapon) if attacker and attacker ~= source and getElementType(attacker) == "player" then if weaponA[weapon] then giveWeapon(attacker, weapon, weaponA[weapon]) end end end addEventHandler("onPlayerWasted", root, playerWasted) Link to comment
Wisam Posted April 19, 2014 Author Share Posted April 19, 2014 (edited) Thanks alot man.. what could we do without you TAPL Shukran Edited April 19, 2014 by Guest Link to comment
Wisam Posted April 19, 2014 Author Share Posted April 19, 2014 .. and i forgot to mention somthing.. when the player kills and gets the ammo a small dxdrawtext above his head will appear writing (ammo+) that would be great Link to comment
TAPL Posted April 19, 2014 Share Posted April 19, 2014 .. and i forgot to mention somthing.. when the player kills and gets the ammo a small dxdrawtext above his head will appear writing (ammo+) that would be great We're here to help only, try to make it yourself. Things you'll need: -- server side triggerClientEvent -- client side addEvent addEventHandler getPedBonePosition dxDrawText isTimer setTimer killTimer removeEventHandler Link to comment
Wisam Posted April 19, 2014 Author Share Posted April 19, 2014 .. and i forgot to mention somthing.. when the player kills and gets the ammo a small dxdrawtext above his head will appear writing (ammo+) that would be great We're here to help only, try to make it yourself. Things you'll need: -- server side triggerClientEvent -- client side addEvent addEventHandler getPedBonePosition dxDrawText isTimer setTimer killTimer removeEventHandler I tryed everything and nothing worked im dont know alot about lua! Link to comment
Wisam Posted April 19, 2014 Author Share Posted April 19, 2014 Post what you've tried. I deleted it because it didnt work.. Can you help me?! Link to comment
-.Paradox.- Posted April 19, 2014 Share Posted April 19, 2014 Just say that you didn't tried ^^ Link to comment
Wisam Posted April 19, 2014 Author Share Posted April 19, 2014 Just say that you didn't tried ^^ Man i suck at lua.. i just writed the functions and events tapl gave me it didnt work with me.. i wish i knew lua like tapl Link to comment
-.Paradox.- Posted April 19, 2014 Share Posted April 19, 2014 I would do it for you if i had time, But without attaching the text to the player head, because it's pretty hard to make it... Link to comment
Wisam Posted April 19, 2014 Author Share Posted April 19, 2014 I would do it for you if i had time, But without attaching the text to the player head, because it's pretty hard to make it... Its ok man i dont need it now.. but there is another problem i have check its here: viewtopic.php?f=91&t=74450 Its not hard its just a small bug Link to comment
Wisam Posted April 19, 2014 Author Share Posted April 19, 2014 I would do it for you if i had time, But without attaching the text to the player head, because it's pretty hard to make it... Its ok man i dont need it now.. but there is another problem i have check its here: viewtopic.php?f=91&t=74450 Its not hard its just a small bug 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