Forum

> > CS2D > Scripts > Where is the error?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Where is the error?

2 replies
To the start Previous 1 Next To the start

moved Where is the error?

4Vendetta
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
addhook("second","hudtxt")
function hudtxt()

	for id=1,32 do
		parse('hudtxt2 '..id..' 2 "©100100100Frag: '..player(id,"score")..' " 13 129')
		parse('hudtxt2 '..id..' 3 "©100100100Deaths: '..player(id,"deaths")..' " 13 141')
		parse('hudtxt2 '..id..' 8 "©100100100Team: '..player(id,"team")..' " 13 165')
		parse('hudtxt2 '..id..' 7 "©100100100Ping: '..player(id,"ping")..' " 13 153')
	end
end

Admin/mod comment

use the scripting forum next time! moved! /DC

old Re: Where is the error?

MikuAuahDark
User Off Offline

Quote
1
for id = 1,32 do
if you use the code above to get player id, add:
1
if player(id,"exists") then
or just replace the for id = 1,32 do to
1
for _, id in ipairs(player(0,"table")) do
the code
1
2
3
4
5
6
7
8
9
addhook("second","hudtxt")
function hudtxt()
	for _, id in ipairs(player(0,"table")) do
		parse('hudtxt2 '..id..' 2 "©100100100Frag: '..player(id,"score")..' " 13 129')
		parse('hudtxt2 '..id..' 3 "©100100100Deaths: '..player(id,"deaths")..' " 13 141')
		parse('hudtxt2 '..id..' 8 "©100100100Team: '..player(id,"team")..' " 13 165')
		parse('hudtxt2 '..id..' 7 "©100100100Ping: '..player(id,"ping")..' " 13 153')
	end
end

old Re: Where is the error?

4Vendetta
User Off Offline

Quote
user MikuAuahDark has written
1
for id = 1,32 do
if you use the code above to get player id, add:
1
if player(id,"exists") then
or just replace the for id = 1,32 do to
1
for _, id in ipairs(player(0,"table")) do
the code
1
2
3
4
5
6
7
8
9
addhook("second","hudtxt")
function hudtxt()
	for _, id in ipairs(player(0,"table")) do
		parse('hudtxt2 '..id..' 2 "©100100100Frag: '..player(id,"score")..' " 13 129')
		parse('hudtxt2 '..id..' 3 "©100100100Deaths: '..player(id,"deaths")..' " 13 141')
		parse('hudtxt2 '..id..' 8 "©100100100Team: '..player(id,"team")..' " 13 165')
		parse('hudtxt2 '..id..' 7 "©100100100Ping: '..player(id,"ping")..' " 13 153')
	end
end


Thank you!
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview