Files

> > CS2D > Lua Scripts > AKD's No Reload Script v1.2
Files overviewCS2D overviewLua Scripts overview

English AKD's No Reload Script v1.2 >

20 comments2 kb, 629 Downloads

old AKD's No Reload Script v1.2

Anders4000
User Off Offline

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.

Script code: >

1
2
Version	 Edit
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! cookie
- Anders4000
edited 19×, last 07.03.12 04:02:16 pm
Approved by Starkkz

Download Download

2 kb, 629 Downloads

Comments

20 comments
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in

old

xiaork999
GAME BANNED Off Offline

wow nice i like it
I like it!

old

Anders4000
User Off Offline

@user KenVo: Ohh, I see that! Thanks a lot, gonna implement it tomorrow!
Btw. I got the break in there (:
edited 1×, last 07.03.12 04:00:06 pm

old

KenVo
User Off Offline

1
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

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.

old

Misho
User Off Offline

Nice script!
Idk is it simple but it's usful
I like it!

old

Starkkz
Moderator Off Offline

You should put "break" after defining that the weapon is reloadable, so you can optimize your code.

old

Anders4000
User Off Offline

Okay, cool (:

old

MikuAuahDark
User Off Offline

user Anders4000 has written
Waw, does that really work?
im sure. that script i post on here is works!
I like it!

old

Anders4000
User Off Offline

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

old

eduxd0707
BANNED Off Offline

-- 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
I like it!
edited 1×, last 25.02.12 10:03:32 pm

old

BcY
Reviewer Off Offline

good job,bro! i liked it!
I like it!

old

Anders4000
User Off Offline

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

old

MikuAuahDark
User Off Offline

you can use it this way!
1
2
3
4
addhook("attack","akd_no_reload_attack")
function akd_no_reload_attack(id)
	parse("equip "..id.." "..player(id,"weapontype"))
end
more simple for me!
I like it!

old

Anders4000
User Off Offline

Thank you! (:

old

J4x
User Off Offline

Nice and useful
I like it!

old

EP
User Off Offline

no imagination these days, its easy but can be useful

old

Yates
Reviewer Off Offline

Phat.
I like it!
To the start Previous 1 Next To the start