Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2163 164 165338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Zitieren
Flametail hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

Flametail
User Off Offline

Zitieren
redefinder hat geschrieben
Flametail hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Flametail
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

GSG9
User Off Offline

Zitieren
Can someone create a script to display the date and time at the top of the screen? Thanks
2× editiert, zuletzt 14.02.10 23:10:39

alt Re: Lua Scripts/Questions/Help

Flametail
User Off Offline

Zitieren
Starkkz hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
GSG9 hat geschrieben
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
2× editiert, zuletzt 15.02.10 14:42:43

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Flametail
User Off Offline

Zitieren
Flacko hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Flametail
User Off Offline

Zitieren
Homer hat geschrieben
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)

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Flametail hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Zitieren
Flametail hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
Blazzingxx hat geschrieben
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? (:
1× editiert, zuletzt 15.02.10 18:47:12
Zum Anfang Vorherige 1 2163 164 165338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht