Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2101 102 103338 339 Next To the start

old Re: Lua Scripts/Questions/Help

h4uja2
User Off Offline

Quote
I change it but it still doesnt work
Spoiler >

And if i choose 9 class, then choose another class i will be a vampire but with m4a1 or smth else

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("hit","hitt")
function hitt(vic,id)
	if sample.classes.class[id] == 9 then
		parse("sethealth "..id.." "..(player(id,"health")+1))
	end
end

addhook("kill","kil")
function kil(id)
	if (sample.classes.class[id] == 9) then
		parse("sethealth "..id.." "..(player(id,"health")+1))
	end
end
Wilson, read this
http://apache.dataloss.nl/~peter/www.lua.org/pil/11.6.html
And try to learn how to use concatenation.

EDIT:
Read this too
http://lua-users.org/wiki/StringsTutorial
edited 1×, last 25.11.09 10:06:06 pm

old Re: Lua Scripts/Questions/Help

h4uja2
User Off Offline

Quote
Thank u!!! But i can hit a friend to get hp

Spoiler >

What im doing wrong?
edited 3×, last 25.11.09 10:33:06 pm

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
addhook("hit","hitt")
function hitt(vic,id)
	if sample.classes.class[id] == 9 then
		local oldhealth = player(id,"health")
		if (player(id;"health")==player(id,maxhealth)) then
			parse("setmaxhealth "..id.." "..(player(id,"health")+2))
		end
	parse("sethealth "..id.." "..(oldhealth+2))
	end
end

Try that.
And you should really consider telling us about debugging errors (console). It does really help us to help you

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
O-M-F-G
More silly errors :@
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
42
43
44
45
46
47
function array(size,value)
     local asd = {}
     for i=1, size do
          asd[i] = value
     end
     return asd --LOL
end

function getslotweps(id,slot)
     local myweapons = playerweapons(id)
     local rt = {}
     for i,v in ipairs(myweapons) do
          if itemtype(v,"slot") == slot then
               table.insert(rt,v)
          end
     end
     return rt
end

--Global table to save what weapons did each player have
a_table = array(
     32,
     {
          prim={},
          sec={},
          melee={}, --We won't use this
          nades={} --neither this
     }
)

addhook("startround","omg")
function omg()
     for i=1,32 do
          if(player(i,"exists")) then
               if(player(i,"team")>=1) then
                    a_table[i].prim=getslotweps(i,1)
                    for a=1,#a_table[i].prim do
                         parse("strip "..i.." "..a)
                    end     
                    a_table[i].sec=getslotweps(i,2)
                    for m=1,#a_table[i].sec do
                         parse("strip "..i.." "..m)
                    end
               end
          end
     end
end

Edit: wtf no tabs again?

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
thanks i'll try it in a minute.
tabs when you copy and then paste tabs are deleted :S
EDIT:
same problem:
nothing happens,no errors in console

old Re: Lua Scripts/Questions/Help

jackisokay2
User Off Offline

Quote
-WiLSoN- has written
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function zombiemenu(id)
	menu(id,"Zombies Menu,Zombie1,Zombie2")-- zombie classes here
end
addhook("team","teamm")
function teamm(id,team)
	if (team == 1) then
		zombiemenu(id) -- opens zombie class menu
	end
end
addhook("serveraction","svac")
function svac(id,ac)
	if (player(id,"team")==1) then
		if (ac == 1) then
			zombiemenu(id) -- opens zombie menu if you press F2
		end
	end
end
that should work. but you need to do the menu thing now.


heh, now i must ask, where would i put this in my script?

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
@jackisokay2
are you creating a new script ?
or just modifying a sample script ??
if you are creating a new one.
put that on (any ? xD) part
if you are modyfing classes sample:
Spoiler >

If you're having more problems just tell us

old Re: Lua Scripts/Questions/Help

jackisokay2
User Off Offline

Quote
ok, another problem, every time i start a map, then click on zombies, or counter terrorists, it QUITS OUT OF THE WHOLE GAME. why?

Spoiler >


also, thanks for all your help

old Re: Lua Scripts/Questions/Help

jackisokay2
User Off Offline

Quote
this is all it says,
[06:40:44] Prepare To Fight!
[06:40:45] U.S.G.N.: Sending serverlist DELETE-request... (85.214.102.60:36963)
[06:40:45] U.S.G.N.: Server removed from serverlist
[06:40:45] ----- Disconnected -----

[06:40:45] M-NET: received unexpected msg (39, 93.100.59.206:36963)
[06:40:46] M-NET: received unexpected msg (134, 95.32.54.137:4146)
[06:40:46] M-NET: received unexpected msg (41, 220.255.180.51:36963)
[06:40:46] M-NET: received unexpected msg (116, 220.255.180.51:36963)
[06:40:46] U.S.G.N.: Ping/State 'not playing' (200 ms)
[06:40:46] M-NET: received unexpected msg (93, 90.22.125.191:2362)
[06:40:46] M-NET: received unexpected msg (116, 90.22.125.191:2362)
[06:40:46] M-NET: received unexpected msg (33, 90.151.2.19:36963)
[06:40:46] M-NET: received unexpected msg (116, 90.151.2.19:36963)
[06:40:47] M-NET: received unexpected msg (115, 189.19.112.87:60948)
[06:40:48] M-NET: received unexpected msg (219, 79.240.179.215:1282)
[06:40:48] M-NET: received unexpected msg (116, 79.240.179.215:1282)
[06:40:49] M-NET: received unexpected msg (83, 95.32.54.137:4146)
[06:40:49] M-NET: received unexpected msg (245, 220.255.180.51:36963)
[06:40:49] M-NET: received unexpected msg (116, 220.255.180.51:36963)
[06:40:49] M-NET: received unexpected msg (23, 90.22.125.191:2362)
[06:40:49] M-NET: received unexpected msg (116, 90.22.125.191:2362)
[06:40:49] M-NET: received unexpected msg (9, 59.6.241.102:61550)
[06:40:49] M-NET: received unexpected msg (116, 59.6.241.102:61550)
[06:40:49] M-NET: received unexpected msg (238, 90.151.2.19:36963)
[06:40:49] M-NET: received unexpected msg (116, 90.151.2.19:36963)
[06:40:49] M-NET: received unexpected msg (116, 79.133.136.42:56437)
[06:40:49] M-NET: received unexpected msg (23, 79.133.136.42:56437)
[06:40:51] M-NET: received unexpected msg (157, 79.240.179.215:1282)
[06:40:51] M-NET: received unexpected msg (116, 79.240.179.215:1282)
[06:40:52] M-NET: received unexpected msg (116, 220.255.180.51:36963)
[06:40:52] M-NET: received unexpected msg (174, 220.255.180.51:36963)
[06:40:52] M-NET: received unexpected msg (208, 90.151.2.19:36963)
[06:40:52] M-NET: received unexpected msg (116, 79.133.136.42:56437)
[06:40:52] M-NET: received unexpected msg (216, 79.133.136.42:56437)
[06:40:52] M-NET: received unexpected msg (116, 90.151.2.19:36963)
[06:40:55] M-NET: received unexpected msg (116, 220.255.180.51:36963)
[06:40:55] M-NET: received unexpected msg (155, 79.133.136.42:56437)
[06:40:55] M-NET: received unexpected msg (116, 79.133.136.42:56437)
[06:40:58] M-NET: received unexpected msg (116, 220.255.180.51:36963)

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
Check Bold text
Spoiler >

old Re: Lua Scripts/Questions/Help

jackisokay2
User Off Offline

Quote
-WiLSoN- has written
Check Bold text
Spoiler >


thanks, but what do i change with the bold text? :p lol im such a n00b

old Re: Lua Scripts/Questions/Help

jackisokay2
User Off Offline

Quote
Vectar666 has written
I think you must change all sample.classes.team to sample.zombie.team


holy cow! it worked! thank you SOOOO much! now, how do i make it so when you change class it will change next time you spawn? instead of instantly killing you?

also, when you change back to survivor it keeps you with the "zombie" class, but you cant change to normal. how would i change that,so that it makes you just a normal survivor?

Spoiler >
edited 2×, last 26.11.09 05:04:12 am
To the start Previous 1 2101 102 103338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview