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 2163 164 165338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
Flametail has written
ok, how do I make it so that players can only join one team? Like, players can only join as terrorists (or spectators), and the admins can be Counter-Terrorists only becuase they can use the makect command.

Try this in standard mode(I`m not so sure it works :/)
1
2
3
4
5
6
7
8
9
_usgn = [b]ENTERADMINUSGNHERE[/b]
addhook("startround","adminteam")
function adminteam(id)
if player(id,"usgn") == _usgn then
parse("makect "..id)
else
parse("maket "..id)
end
end

old Re: Lua Scripts/Questions/Help

Flametail
User Off Offline

Quote
redefinder has written
Flametail has written
ok, how do I make it so that players can only join one team? Like, players can only join as terrorists (or spectators), and the admins can be Counter-Terrorists only becuase they can use the makect command.

Try this in standard mode(I`m not so sure it works :/)
1
2
3
4
5
6
7
8
9
_usgn = [b]ENTERADMINUSGNHERE[/b]
addhook("startround","adminteam")
function adminteam(id)
if player(id,"usgn") == _usgn then
parse("makect "..id)
else
parse("maket "..id)
end
end


can it be done without the usgn requirement?


Everyone will join as a terrorist, any attempt to join as a CT will fail. Once in-game, admin or someone with RCon can use makect to join the CT. Like in several of the servers out there, people could only join as a terrorist, yet occassionalally, one could see a player join the CT. I asked about it once and the admin said he had it scripted so only the admins could join CT by using the makect command. He had to leave after that so I couldn't get the script outta him.

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
admin_usgn = {ENTERADMINUSGNHERE} -- you can use the sign "," to add more accounts USGN
addhook("startround","adminteam") 
function adminteam(id) 
	for i = 1,#admin_usgn do
		if player(id,"usgn") == admin_usgn[i] then 
			parse("makect "..id) 
		else 
			parse("maket "..id) 
		end
	end
end

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Hey, you're forgetting that the startround hook doesn't call the lua function with an 'id' parameter.
You have to loop thru the players by yourself
1
2
3
4
5
6
7
8
9
10
11
12
13
14
admin_usgn = {ENTERADMINUSGNHERE}

addhook("startround","adminteam")
function adminteam(id)
	for indx,id in ipairs(player(0,"table"))
		for i = 1,#admin_usgn do
			if player(id,"usgn") == admin_usgn[i] then
				parse("makect "..id)
			else
				parse("maket "..id)
			end
		end
	end
end

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
sry, i forgot, the hook is team not startround.

1
2
3
4
5
6
7
8
9
10
11
admin_usgn = {ENTERADMINUSGNHERE}
addhook("team","adminteam") 
function adminteam(id) 
	for i = 1,#admin_usgn do 
		if player(id,"usgn") == admin_usgn[i] then 
			parse("makect "..id) 
		else 
			parse("maket "..id) 
		end 
	end 
end

old Re: Lua Scripts/Questions/Help

Flametail
User Off Offline

Quote
like I said, any way to do it without the USGN requirement?

pretty much, no one can join CT(when they start the game or when they use the change teams button) period. not even an admin can join CT by using those buttons.

old Re: Lua Scripts/Questions/Help

GSG9
User Off Offline

Quote
Can someone create a script to display the date and time at the top of the screen? Thanks
edited 2×, last 14.02.10 11:10:39 pm

old Re: Lua Scripts/Questions/Help

Flametail
User Off Offline

Quote
Starkkz has written
sry, i forgot, the hook is team not startround.

1
2
3
4
5
6
7
8
9
10
11
admin_usgn = {ENTERADMINUSGNHERE}
addhook("team","adminteam") 
function adminteam(id) 
	for i = 1,#admin_usgn do 
		if player(id,"usgn") == admin_usgn[i] then 
			parse("makect "..id) 
		else 
			parse("maket "..id) 
		end 
	end 
end


srry peeps, but i doesn't work. it didnt keep anyone from joining CT

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
try this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
admin_usgn = {ENTERADMINUSGNHERE}

addhook("team","adminteam")
function adminteam(id,team)
	if team == 2 then --if ct
		for indx,USGN in ipairs(admin_usgn) do
			if player(id,"usgn") == USGN then
				return 0 --let the admin in
			else
				return 1 --do no let the player enter ct
			end
		end
	end
end

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
GSG9 has written
Can someone create a script to display the date and time at the top of the screen? Thanks


I thought it would be something like this.. But it don't work. I think some of the pro's can help :p
1
2
3
4
5
6
7
addhook("always","time_and_date_hook")
function time_and_date_hook()

parse([[hudtxt2 ]]..id..[[ 10 "©000255000Time: ]]os.date("%I:%M %p")[[" 200 200]])
parse([[hudtxt2 ]]..id..[[ 10 "©000255000Date: ]]os.date("%A, %d %b %Y")[[" 200 213]])

end
edited 2×, last 15.02.10 02:42:43 pm

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
He asked me this in PM.
I already sent right example before 4 hours...

1
2
3
4
5
addhook("second","sec")
function sec()
	parse('hudtxt 0 "'..os.date("%I:%M:%S %p")..'" 320 15 1')
	parse('hudtxt 1 "'..os.date("%A, %d %b %Y")..'" 320 30 1')
end

old Re: Lua Scripts/Questions/Help

Flametail
User Off Offline

Quote
Flacko has written
try this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
admin_usgn = {ENTERADMINUSGNHERE}

addhook("team","adminteam")
function adminteam(id,team)
	if team == 2 then --if ct
		for indx,USGN in ipairs(admin_usgn) do
			if player(id,"usgn") == USGN then
				return 0 --let the admin in
			else
				return 1 --do no let the player enter ct
			end
		end
	end
end


sorry, doesnt work. have any of you actually tested these before you give them to me?

it adds the hook, but thats all.

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
ADMINS.S = {values}
ADMINS.SS = {value}

addhook("team","Team1")
function Team1(id,team)
     for index, value in ipairs(ADMINS.S) do
		for index, value2 in ipairs(ADMIN.Ips) do--We loop before we even check
          if (team == 1) then                
if (player(id,"usgn") == value or player(id,"ip") == value2) then
	return 0
               end
          end
	 end
	end
	 if team == 1 and player(id,"usgn") ~= value then
	 parse("makect "..id)
	 return 1
	 end
end
Try this, It's kinda weird how it works, this is my old version of it, I added a new one with logic, but this one works. Add one USGN to the top, Say, yours, and then add the rest in ADMIN.S

old Re: Lua Scripts/Questions/Help

Flametail
User Off Offline

Quote
Homer has written
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
ADMINS.S = {values}
ADMINS.SS = {value}

addhook("team","Team1")
function Team1(id,team)
     for index, value in ipairs(ADMINS.S) do
		for index, value2 in ipairs(ADMIN.Ips) do--We loop before we even check
          if (team == 1) then                
if (player(id,"usgn") == value or player(id,"ip") == value2) then
	return 0
               end
          end
	 end
	end
	 if team == 1 and player(id,"usgn") ~= value then
	 parse("makect "..id)
	 return 1
	 end
end
Try this, It's kinda weird how it works, this is my old version of it, I added a new one with logic, but this one works. Add one USGN to the top, Say, yours, and then add the rest in ADMIN.S


I guess im missing someting
1
[10:53:28] LUA ERROR: maps/Jamie_beta3.lua:43: attempt to index global 'ADMINS' (a nil value)

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
Umm, I forgot to take out the ADMIN.Ips so you can just remove the for index, value2 in ipairs(ADMIN.Ips) do and remove and end and remove the comparision looking for the Ips.

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Flametail has written
sorry, doesnt work. have any of you actually tested these before you give them to me?

it adds the hook, but thats all.


No, I didn't test it.
And I don't want to test it neither, because I rarely test the scripts I post here.
Why would I make an exception because of you? I don't think you're worth the effort because you just came here and said "I want a script that prevents noobs from joining CT, and no, there's no way I'm saying 'please' ".
I just made an attempt to help you because the guys were trying to.

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
Flametail has written
sorry, doesnt work. have any of you actually tested these before you give them to me?

it adds the hook, but thats all.

It works now,I think Flacko made a mistake at index
1
2
3
4
5
6
7
8
9
10
11
12
13
14
admin_usgn = {ENTERADMINUSGNHERE}

addhook("team","adminteam")
function adminteam(id,team)
     if team == 2 then --if ct
          for [b]index[/b],USGN in ipairs(admin_usgn) do
               if player(id,"usgn") == USGN then
                    return 0 --let the admin in
               else
                    return 1 --do no let the player enter ct
               end
          end
     end
end

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
Blazzingxx has written
He asked me this in PM.
I already sent right example before 4 hours...

1
2
3
4
5
addhook("second","sec")
function sec()
	parse('hudtxt 0 "'..os.date("%I:%M:%S %p")..'" 320 15 1')
	parse('hudtxt 1 "'..os.date("%A, %d %b %Y")..'" 320 30 1')
end


Ohh.. :p
- I think it is funny people are asking you pm ..Cause' they know you can answer their lua-questions

----------------------------------------------------

Q: Anyone knows what the player(id,"rot") does? (:
edited 1×, last 15.02.10 06:47:12 pm
To the start Previous 1 2163 164 165338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview