English Weapon unlock script

8 replies
Goto Page
To the start Previous 1 Next To the start
11.05.13 01:51:39 pm
Up
Suprise
BANNED
Offline Off
Hello guys,
i need a sample script. When you level up you unlock a weapon that you can set somewhere.
Example:
You reach level 10 you unlock Galil
You reach level 12 you unlock Ak-47
etc.
Thanks!
11.05.13 01:54:08 pm
Up
Alistaire
User
Offline Off
Not easy tbh
IMG:http://i.imgur.com/5zhwOTP.png
11.05.13 05:05:24 pm
Up
Gajos
BANNED
Offline Off
Easy, but in ...?
menu...? idk
Banned for Hacking/Cheating in CS2D /DC
11.05.13 05:11:49 pm
Up
Avo
User
Offline Off
He's asking for something like in the Looser's Call of Duty mod.
11.05.13 06:10:50 pm
Up
Suprise
BANNED
Offline Off
@user Gajos: Yes,,
even without menu is okay.
11.05.13 06:24:36 pm
Up
sheeL
User
Offline Off
not tested

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function array(m,v)
     local array = {}
     for i = 1, m do
          array[i]=v
     end
     return array
end

level=array(32,1)     --1 is start level
kills=array(32,0)
levelup=10          --levelup every 10 kills
weapons={24,32,47}          --24(ump45)for 1st lvl, 32(m4a1) for 2nd lvl, 47(rpg) for 3rd lvl etc...

addhook("kill","onkill")
function onkill(killer,victim)
     if killer~=victim then
          kills[killer]=kills[killer]+1     --you won't get points for killing yourself!
     end
     if kills==levelup[lvl] then
          level[killer]=level[killer]+1
          kills[killer]=0
          msg2(killer,"================>Level up to level: "..level[killer].." !!!")
     end
end

addhook("spawn","onspawn")
function onspawn(id)
     local lvl=level[id]
     local max=#weapons
     if weapons[id]==nil then
          parse("equip "..id.." "weapons[max])     --weapon of max level if player has got higher level than max index of weapons table
     else
          parse("equip "..id.." "weapons[lvl])
     end
end

addhook("leave","onleave")
function onleave(id)
     level[id]=0
     kills[id]=0
end
11.05.13 06:33:48 pm
Up
Suprise
BANNED
Offline Off
not working. also it would just show your level when you level up not the weapon you unlocked.

Another idea?
11.05.13 09:21:15 pm
Up
EP
User
Offline Off
how would you like to level up? experience or per kill?
11.05.13 09:23:20 pm
Up
Suprise
BANNED
Offline Off
user EP has written:
how would you like to level up? experience or per kill?


Experience

edit: Anybody plz?
edited 2×, last 12.05.13 11:28:33 am
To the start Previous 1 Next To the start