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 2236 237 238338 339 Next To the start

old help?

Stormtrooper595
User Off Offline

Quote
hey guys i have this account id code (it works with unrealsoftware ids) that makes one team only admins and it works but i need it to work with CT admins not T and I don't know how to modify it. I tried but it just broke the script. can someone modify it for me? Thanks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
admin_usgn = {8087, 24395,} 

addhook("team","adminteam") 
function adminteam(id,team) 
	if team == 1 then --if t
		for index,USGN in ipairs(admin_usgn) do 
			if player(id,"usgn") == 8708 or player(id,"usgn") == 14099 then 
				return 0
			else 
				return 1
			end 
		end 
	end 
end

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Stormtrooper595 has written
hey guys i have this account id code (it works with unrealsoftware ids) that makes one team only admins and it works but i need it to work with CT admins not T and I don't know how to modify it. I tried but it just broke the script. can someone modify it for me? Thanks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
admin_usgn = {8087, 24395,} 

addhook("team","adminteam") 
function adminteam(id,team) 
	if team == 1 then --if t
		for index,USGN in ipairs(admin_usgn) do 
			if player(id,"usgn") == 8708 or player(id,"usgn") == 14099 then 
				return 0
			else 
				return 1
			end 
		end 
	end 
end


just change
1
if team == 2
that its, 2 for CT 1 for T

old Re: Lua Scripts/Questions/Help

Mr_God
User Off Offline

Quote
hi all
the script is error
help me to fix script

attempt to call glotbal 'totable' (a nil value)

Code:
function load(id)
usgn = player(id,"usgn")
if (usgn > 0) then
local usgn = player(id, "usgn")
files = io.open("sys/lua/scelldata/"..usgn..".txt","r")
if(files~=nil) then
msg2(id,"©000255000Your save file found!@C")
msg2(id,"©160160255Your U.S.G.N ID: "..usgn.."@C")
parse('hudtxt2 '..id..' 7 "©000255000Login as: '..usgn..'" 40 415')
for line in io.lines("sys/lua/scelldata/"..usgn..".txt","r") do
local parses = totable(line)
if (tonumber(parses[1])>0) then
yourmon[id] = tonumber(parses[1])
license[id] = tonumber(parses[2])
break
end
end
else
msg2(id,"©255000000Failed to load save!@C")
msg2(id,"©255000000Please check your U.S.G.N account settings!@C")
parse('hudtxt2 '..id..' 7 "©255000000Failed to Load Save" 40 415')
end
end
end

addhook("leave","save")
function save(id)
if (player(id, "usgn") > 0) then
save_data = license[id].." "..yourmon[id]
file = assert(io.open("sys/lua/scelldata/"..usgn..".txt","w"))
file:write(save_data)
file:close()
msg2(id,'©000255001Save Data Successfull!@C')
else
msg2(id,"©255000000Failed to Save!@C")
end
end

old Re: Lua Scripts/Questions/Help

CeLiL_CaN
User Off Offline

Quote
Flacko has written
The easiest thing would be to put them into a table
1
2
3
--not tested
t = {1,3,5}
a = t[math.random(1,3)]

thank u flacko.

i maked a random building spawn script.But a have a problem.
Spoiler >

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
how i do?

old Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Quote
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.

old Re: Lua Scripts/Questions/Help

CeLiL_CaN
User Off Offline

Quote
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?

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
murilogc has written
hi , again i want 2 commands , !bring and !goto , if only cts , !goto ct go to the tt , !bring tt come to the ct


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
function string.split(t, b)
     local cmd = {}
     local match = "[^%s]+"
     if b then
          match = "%w+"
     end
     if type(b) == "string" then match = "[^"..b.."]+" end
     if not t then return invalid() end
     for word in string.gmatch(t, match) do
          table.insert(cmd, word)
     end
     return cmd
end

function Array(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

px = Array(32)
py = Array(32)
ix = Array(32)
iy = Array(32)

addhook("say","admin_commands_say")
function admin_commands_say(id,txt)
tab = string.split(txt,' ')
t1 = tab[1]
t2 = tab[2]
	if t1 == "!bring" and (player(id,"team") == 2) then
		if (player(t2,"exists")) and (player(id,"health")>0) then
			ix[id]=player(id,"x")
			iy[id]=player(id,"y")
			parse("setpos "..t2.." "..ix[id].." "..iy[id])
			msg2(id,"©000255000Youve teleported "..player(t2,"name").." to your self")
			return 1
		else
			msg2(id,"©255000000Player Dosent exists/Your dead")
			return 1
		end
	end
	return 1
end

addhook("say","say_goto")
function say_goto(id,txt)
tab = string.split(txt,' ')
t1 = tab[1]
t2 = tab[2]
	if t1 == "!goto" and (player(id,"team") == 2) then
		if (player(t2,"exists")) and (player(id,"health")>0) then
			px[id]=player(t2,"x")
			py[id]=player(t2,"y")
			parse("setpos "..id.." "..px[id].." "..py[id])
			msg2(id,"©000255000Youve teleported your self to"..player(t2,"name"))
			return 1
		else
			msg2(id,"©255000000Player Dosent exists/Your dead")
			return 1
		end
	end
	return 1
end

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
MSek has written
plz say me how to make it:
if i die all my buildings is destroyed.

if its impossible say too


Its possible,

1
2
3
4
5
6
7
8
9
10
addhook("die","check")
function check(id)
	if (player(id,"team") == 2) then
		parse("maket "..id)
		parse("makect "..id)
	elseif (player(id,"team") == 1) then
		parse("makect "..id)
		parse("maket "..id)
	end
end

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
tiiger87 has written
tiiger87 has written
how can i make that only if i say "!pass cheeze" , i can join ct?


any1 noticed this?


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
function string.split(t, b)
     local cmd = {}
     local match = "[^%s]+"
     if b then
          match = "%w+"
     end
     if type(b) == "string" then match = "[^"..b.."]+" end
     if not t then return invalid() end
     for word in string.gmatch(t, match) do
          table.insert(cmd, word)
     end
     return cmd
end

function Array(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

isct = Array(32)
pass = "cheeze" -- Dont remove the " " , Change cheeze to your password

addhook("say","admin_commands_say")
function admin_commands_say(id,txt)
tab = string.split(txt,' ')
t1 = tab[1]
t2 = tab[2]
	if t1=="!pass" then
		if t2==pass then
			isct[id]=1
			parse("makect "..id)
			msg2(id,"©000255000Password correct, Transfering to CT")
			return 1
		else
			msg2(id,"©255000000Password not correct")
			return 1
		end
	end
end

addhook("team","ctpass_team")
function ctpass_team(id,team)
	if team==2 then
		if isct[id]==1 then
			--
		else
			msg2(id,"©255000000You aint an CT")
			return 1
		end
	end
end

old .YeaH.

FiiD
User Off Offline

Quote
Thank you Bekerchen...I want that all have inf. ammo...know...so I get infinite ammo but need to reload...if its so than I use that script...thanks...

old Re: Lua Scripts/Questions/Help

Surplus
User Off Offline

Quote
thx again hare, u rock

Edit:
Is it possible to make that no1 cant see that message?
usualy if i write it every1 can see it.

old Re: Lua Scripts/Questions/Help

CeLiL_CaN
User Off Offline

Quote
i maked a random building spawn script.But a have a problem.
Spoiler >

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
how i do?

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?

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
tiiger87 has written
thx again hare, u rock

Edit:
Is it possible to make that no1 cant see that message?
usualy if i write it every1 can see it.


It shouldnt show up

but change the
1
2
3
end
     end
end

to

1
2
3
4
end
          return 1
     end
end

/edit:

TO make it easier just change

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("say","admin_commands_say")
function admin_commands_say(id,txt)
tab = string.split(txt,' ')
t1 = tab[1]
t2 = tab[2]
     if t1=="!pass" then
          if t2==pass then
               isct[id]=1
               parse("makect "..id)
               msg2(id,"©000255000Password correct, Transfering to CT")
               return 1
          else
               msg2(id,"©255000000Password not correct")
               return 1
          end
     end
end

to

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("say","admin_commands_say")
function admin_commands_say(id,txt)
tab = string.split(txt,' ')
t1 = tab[1]
t2 = tab[2]
     if t1=="!pass" then
          if t2==pass then
               isct[id]=1
               parse("makect "..id)
               msg2(id,"©000255000Password correct, Transfering to CT")
               return 1
          else
               msg2(id,"©255000000Password not correct")
               return 1
          end
          return 1
     end
end
To the start Previous 1 2236 237 238338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview