Forum
CS2D Scripts Lua Scripts/Questions/HelpWhat is wrong in this script ? Everything works except for healing and hurting stuff...
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function initArray(m) 	local array = {} 	for i = 1, m do 		array[i]=0 	end 	return array end for id=1,32 do reheal = initArray(32) energy1 = initArray(32) energy2 = initArray(32) addhook("serveraction","speed") function speed(id,act) 	if (act<=1) then parse("speedmod "..id.." 30") parse("sv_msg2 "..id.." You are now running !") energy1[id] = 1 energy2[id] = 0 reheal[id] = 0 end 	if (act==2) then parse("speedmod "..id.." 70") parse("sv_msg2 "..id.." You are now running in your full power!") energy1[id] = 0 energy2[id] = 1 reheal[id] = 0 end 	if (act==3) then parse("speedmod "..id.." 0") parse("sv_msg2 "..id.." You are now walking normal!") energy1[id] = 0 energy2[id] = 0 reheal[id] = 1 end end addhook("second","energy1") function energy1() 	for p =1,32 do 		if (energy1[p]==1) then 			local hurt1 = player(p,"health")-2 			parse("sethealth "..p.." "..hurt1) 		end 	end end addhook("second","energy2") function energy2() 	for p =1,32 do 		if (energy2[p]==1) then 			local hurt2 = player(p,"health")-3 			parse("sethealth "..p.." "..hurt2) 		end 	end end addhook("second","reheal") function reheal() 	for p =1,32 do 		if (reheal[p]==1) then 			local heal = player(p,"health")+1 			parse("sethealth "..p.." "..heal) 		end 	end end addhook("spawn","start") function start(id) parse("setmaxhealth "..id.." 250") reheal[id] = 1 energy1[id] = 0 energy2[id] = 0 end end
The problem is that octal2 can only convert (correctly) until a number is so big.
Edit
Nvm there is nothing wrong I was only using a number tht is not Octal. 018
Edit
Though it is still inaccurate.
edited 2×, last 22.08.10 02:59:27 am
CeLiL_CaN has written
i maked a random building spawn script.But a have a problem.
this make random building spawn in random tile.if it make 100 spawns it stop..But a have error..
how i do?
i test it now big map...But same...
in my opinion buildings are not spawn same tile..
how i make like this:
if x,y occupied not spawn x,y
its my opinion. true?
this make random building spawn in random tile.if it make 100 spawns it stop..But a have error..
1
ERROR: spawnobject wrong tile properties
loooser has written
i think the map is to small if your map has 100 tiles x and 100 tiles y your maximum is 99 and not 100 , because map starts with tile 0.
i test it now big map...But same...
in my opinion buildings are not spawn same tile..
how i make like this:
if x,y occupied not spawn x,y
its my opinion. true?
Help me pls...
HaRe has written
@DaKnOb:
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
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
if menu==nil then menu={} end menu={} addhook("say", "menu.say") function menu.say(p, txt) 	if(txt=="!menu") then 		function menu.func(id) 	end end function menu.func(id) 	menu(id,"Title,Button 1,Button 2,Button 3") end addhook("menu","menu.menu") function menu.menu(id,title,button) 	if title=="Title" then 		if button==1 then 			-- what ever 		elseif button==2 then 			-- what ever 2 		elseif button==3 then 			-- what ever 3 		end 	end end
can you make it only for ct's? (ct private menu)
and button 1, i will tell later..
button 2 gives The Ct superarmor and laser,deagle
button 3 opens new menu where Ct's can slay ppl
button 4 where Ct's can teleport players to themselfes...
edited 2×, last 22.08.10 01:32:20 pm
tiiger87 has written
can you make it only for ct's? (ct private menu)
and button 1, i will tell later..
button 2 gives The Ct superarmor and laser,deagle
button 3 opens new menu where Ct's can slay ppl
button 4 where Ct's can teleport players to themselfes...
HaRe has written
@DaKnOb:
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
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
if menu==nil then menu={} end menu={} addhook("say", "menu.say") function menu.say(p, txt) 	if(txt=="!menu") then 		function menu.func(id) 	end end function menu.func(id) 	menu(id,"Title,Button 1,Button 2,Button 3") end addhook("menu","menu.menu") function menu.menu(id,title,button) 	if title=="Title" then 		if button==1 then 			-- what ever 		elseif button==2 then 			-- what ever 2 		elseif button==3 then 			-- what ever 3 		end 	end end
can you make it only for ct's? (ct private menu)
and button 1, i will tell later..
button 2 gives The Ct superarmor and laser,deagle
button 3 opens new menu where Ct's can slay ppl
button 4 where Ct's can teleport players to themselfes...
change
1
2
3
4
5
6
2
3
4
5
6
addhook("say", "menu.say") function menu.say(p, txt) if(txt=="!menu") then function menu.func(id) end end
to
1
2
3
4
5
6
2
3
4
5
6
addhook("say", "menu.say") function menu.say(p, txt) if(txt=="!menu") and (player(id,"team") == 2) then function menu.func(id) end end
And yes i will help you later with the menu if you have skype pm me it so we can talk / if you dont have please get one
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
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
function initArray(m) local array = {} 	for i = 1, m do 		array[i]=0 	end 	return array end license=initArray(32) addhook("say","givel") function givel(id,txt) 	if(player(id,"team")==2)then 		if(!givelicense==string.sub(txt,1,12))then 		tt=tonumber(string.sub(txt,13,14)) 			license[tt]=1 			msg2(tt,"©000255000You got a license!") 			msg2(id,"©000255000Player "..(player(tt,"name")).." have got a license!") 			return 1 		end 	end end addhook("buildattempt","onlylicense") function onlylicense(id,type,x,y) 	if(player(id,"team")==1)then 		if(license[id]==0)then 			msg2(id,"©255000000You need a license to build!") 			return 1 		end 	end end
code:
rp={}
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
myclass=initArray(32)
shopowners=initArray(1)
medics=initArray(1)
hotelowners=initArray(1)
addhook("say","class_sel")
function class_sel(id,txt)
if(txt=="!goshop")then
if(myclass[id]==0)then
if(shopowners[1]<5)then
shopowners[1]=shopowners[1]+1
myclass[id]=1
msg2(id,"©255255255Congratulations you are a shop owner now!")
msg("©255255000"..(player(id,"name")).." is a shop-owner now!")
msg("©000255255Shop-Owners: "..shopowners[1].."/5")
msg("©000255255Hotel-Owners: "..hotelowners[1].."/1")
msg("©000255255Medics: "..medics[1].."/1")
return 1
else
msg2(id,"©255255255There are already "..shopowners[1].." Shop Owners!")
return 1
end
else
msg2(id,"©255255255You are already a in a class!")
return 1
end
end
if(txt=="!gomedic")then
if(myclass[id]==0)then
if(medics[1]<1)then
medics[1]=medics[1]+1
myclass[id]=2
msg2(id,"©255255255Congratulations you are a Medic now!")
msg("©255255000"..(player(id,"name")).." is a medic now!")
msg("©000255255Shop-Owners: "..shopowners[1].."/5")
msg("©000255255Hotel-Owners: "..hotelowners[1].."/1")
msg("©000255255Medics: "..medics[1].."/1")
return 1
else
msg2(id,"©255255255There are already "..medics[1].." Medics!")
return 1
end
else
msg2(id,"©255255255You are already a in a class!")
return 1
end
end
if(txt=="!gohotel")then
if(myclass[id]==0)then
if(hotelowners[1]<1)then
hotelowners[1]=hotelowners[1]+1
myclass[id]=3
msg2(id,"©255255255Congratulations you are a hotel owner now!")
msg("©255255000"..(player(id,"name")).." is a hotel-owner now!")
msg("©000255255Shop-Owners: "..shopowners[1].."/5")
msg("©000255255Hotel-Owners: "..hotelowners[1].."/1")
msg("©000255255Medics: "..medics[1].."/1")
return 1
else
msg2(id,"©255255255There are already "..hotelowners[1].." hotel owners!")
return 1
end
else
msg2(id,"©255255255You are already a in a class!")
return 1
end
end
if(txt=="!info")then
if(myclass[id]==1)then
msg2(id,"©255255255You are a shop owner!")
return 1
elseif(myclass[id]==2)then
msg2(id,"©255255255You are a Medic!")
return 1
elseif(myclass[id]==3)then
msg2(id,"©255255255Yoau are a hotel owner!")
return 1
else
msg2(id,"©255255255You are a player!")
return 1
end
end
if(txt=="!resetclass")then
if(myclass[id]==0)then
msg2(id,"©255255255You aren't in a class")
return 1
elseif(myclass[id]==1)then
msg2(id,"©255255255Your class is reseted")
msg("©255255000There is a shop-owner-class avaible again!")
msg("©000255255Shop-Owners: "..(shopowners[1]-1).."/5")
msg("©000255255Hotel-Owners: "..hotelowners[1].."/1")
msg("©000255255Medics: "..medics[1].."/1")
myclass[id]=0
shopowners[1]=shopowners[1]-1
return 1
elseif(myclass[id]==2)then
msg2(id,"©255255255Your class is reseted")
msg("©255255000There is a medic-class avaible again!")
msg("©000255255Shop-Owners: "..shopowners[1].."/5")
msg("©000255255Hotel-Owners: "..hotelowners[1].."/1")
msg("©000255255Medics: "..(medics[1]-1).."/1")
myclass[id]=0
return 1
elseif(myclass[id]==3)then
msg2(id,"©255255255Your class is reseted")
msg("©255255000There is a hotel-owner-class avaible again!")
msg("©000255255Shop-Owners: "..shopowners[1].."/5")
msg("©000255255Hotel-Owners: "..(hotelowners[1]-1).."/1")
msg("©000255255Medics: "..medics[1].."/1")
myclass[id]=0
return 1
end
end
end
edited 4×, last 22.08.10 09:44:31 pm
Info
MLF = Mark Up Language FIle
!_DNW_! = No tags
sry I dont know if I understand you to 100% (Iam German :D). You want that you choose you class that you get teleported to a special place for edics, for otel owners and for shop owners? Am I right or did I misunderstand you?
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
function returnt () 	t = {12,34,"1312",{12}} 	return t end t = {} t["a"] = returnt() print(t.a[1])
the script is error
help me to fix script
attempt to call glotbal 'totable' (a nil value)
by weiwen
edited 3×, last 23.08.10 08:46:59 am
Admin/mod comment
Please use the code and/or spoiler tags in future. Did it for you! /TheKilledDeathplz help me!
how to make leader (like in gun-game) for this script!
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
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
function initArray(m) 	local array = {} 	for i = 1, m do 		array[i]=0 	end 	return array end level=initArray(32) exp=initArray(32) function level_hud(id) 	parse('hudtxt2 '..id..' 1 "©000100255Level: '..level[id]..' " 13 117') end function exp_hud(id) 	parse('hudtxt2 '..id..' 2 "©000100255Exp: '..exp[id]..'/8 " 13 129') end addhook("kill","ms_kill") function ms_kill(id) 	exp[id]=exp[id]+1 	exp_hud(id) 	if exp[id] == 8 then 		exp[id]=0 		level[id]=level[id]+1 		msg2(id,"©000255000Level up!@C") 		exp_hud(id) 		level_hud(id) 	end end addhook("spawn","ms_spawn") function ms_spawn(id) 	level_hud(id) 	exp_hud(id) end
If Terrorist(predator) Kill CT(Marine)
parse sv_sound
edited 1×, last 23.08.10 06:53:28 pm