AKD's No Reload Script v1.2 
20 comments AKD No Reload:
AKD No Reload is a simple piece of code, that you can add to your own mods, that will refill "reloadable" weapons's ammo whenever you shoot the gun.
What you fill find in this upload:
An array list of weapons that are considered reloadable. You can use this array to remove weapons from being "Fast-reloaded". In other words, all weapons in the array will get full ammo on attack/fire.
A file of IIDs (Item IDs), so that you can easily find the weapon that you want to block Fast-reload for.
Of course the attack hook, where all the magic happens! 
Additional information:
Name: AKD No Reload v1.0
Made by: Anders4000
Copyright © 2012 Anders Kjær Damgaard
Date(dd/mm/yyyy): 22/02/2012
The script is copyrighted, and I want you to either give me credits if you copy-paste the code into your own mod, or make a dofile("sys/lua/AKD_No_Reload.lua") call.
Please leave suggestions or bugs so I can add/fix them.
Let me know if i overlooked any reloadable weapons too, thanks!
- Anders4000
AKD No Reload is a simple piece of code, that you can add to your own mods, that will refill "reloadable" weapons's ammo whenever you shoot the gun.
What you fill find in this upload:




Additional information:




The script is copyrighted, and I want you to either give me credits if you copy-paste the code into your own mod, or make a dofile("sys/lua/AKD_No_Reload.lua") call.
Code:
1
2
2
Version Edit
1.2 Added a break tag in the Weaponcheck loop.
1.2 Added a break tag in the Weaponcheck loop.
Please leave suggestions or bugs so I can add/fix them.
Let me know if i overlooked any reloadable weapons too, thanks!

- Anders4000
edited 19×, last 07.03.12 04:02:16 pm

Comments
20 comments



Log in!
You need to log in to be able to write comments!Log in
@
KenVo: Ohh, I see that! Thanks a lot, gonna implement it tomorrow!
Btw. I got the break in there (:


Btw. I got the break in there (:
edited 1×, last 07.03.12 04:00:06 pm
Code:
1
2
3
4
5
6
2
3
4
5
6
for i = 0, #bulletWeapons do
if currentWpn == bulletWeapons[i] then
reloadable = true
break -- The loop will stop after reloadable is true
end
end
if currentWpn == bulletWeapons[i] then
reloadable = true
break -- The loop will stop after reloadable is true
end
end
Putting 'break' in your loop will make your loop execute much faster because let's say you are using a weapon id 1. When you use the weapon, your function will loop the whole 'bulletweapons' table no matter what. However, if you put break in your loop, the loop will stop right after reloadable = true and it won't loop the whole table everytime you use 'attack' function.


Waw, does that really work?
I see why you would want that, although this script was made for reloadable weapons (;
Glad you liked is anyways!
Glad you liked is anyways!

-- my version
-- No Reload and Unlimited Ammo
--
-- By eduxd0797
--
wat = "51 52 53 54 72 73 75 76 77 86" -- Grenades
addhook ("attack","noreload")
function noreload(p)
w = player(p,"weapontype")
if (w~=0) then parse("equip "..p.." "..w) end
end
addhook("projectile","noreload1")
function noreload1(p,w)
if (string.find(wat,w)~=nil) then
parse("equip "..p.." "..w)
parse("setweapon "..p.." "..w)
end
end
-- No Reload and Unlimited Ammo
--
-- By eduxd0797
--
wat = "51 52 53 54 72 73 75 76 77 86" -- Grenades
addhook ("attack","noreload")
function noreload(p)
w = player(p,"weapontype")
if (w~=0) then parse("equip "..p.." "..w) end
end
addhook("projectile","noreload1")
function noreload1(p,w)
if (string.find(wat,w)~=nil) then
parse("equip "..p.." "..w)
parse("setweapon "..p.." "..w)
end
end
edited 1×, last 25.02.12 10:03:32 pm
Waw, does that really work? I need to test that (:
Although, i still like my code better; To just equip a weapon that's already equiped seems kind of sketchy. It's almost like an unfixed bug
Although, i still like my code better; To just equip a weapon that's already equiped seems kind of sketchy. It's almost like an unfixed bug




