Forum

> > CS2D > Scripts > Team score :d
Forums overviewCS2D overview Scripts overviewLog in to reply

English Team score :d

30 replies
Page
To the start Previous 1 2 Next To the start

old Team score :d

Suprise
BANNED Off Offline

Quote
Sorry for script question but now im learning! So :

I need a startround script! When start the server or map then the next write: Example:
Hudtxt blabla Counter terrorist: CTSCORES
Hudtxt blabla Terrorists: TSCORES

Or zombie;survivor!

Ty in advance :d

old Re: Team score :d

EngiN33R
Moderator Off Offline

Quote
1
2
3
4
5
6
7
addhook("startround","showscores")
function showscores()
	parse("hudtxt 1 \"©255000000T Score:"..game("score_t").."\" 200 5")
	parse("hudtxt 2 \"©000000255CT Score:"..game("score_ct").."\" 400 5")
end

showscores()

old Re: Team score :d

Big Bang Mafia
User Off Offline

Quote
user EngiN33R
i tested the script and it gives weird problem on line 1 lol

Console has written
LUA ERROR: sys/lua/build.lua:1: unexpected symbol near 'ï'


don't worry about the name 'build.lua' i just replaced a script with this one

old Re: Team score :d

EngiN33R
Moderator Off Offline

Quote
Well, for goodness' sake, what's the line 1? Specify the line text whenever you have an error with a line number.

old Re: Team score :d

EngiN33R
Moderator Off Offline

Quote
What the fuck is wrong with the errors people are getting? Honestly. Are you sure that's line 1?

old Re: Team score :d

Big Bang Mafia
User Off Offline

Quote
the whole code

1
2
3
4
5
6
7
addhook("startround" , "showscores")
function showscores()
     parse("hudtxt 1 \"©255000000T Score:"..game("score_t").."\" 200 5")
     parse("hudtxt 2 \"©000000255CT Score:"..game("score_ct").."\" 400 5")
end

showscores()

old Re: Team score :d

Hador
User Off Offline

Quote
something tells me that that is not the complete code. You gave an error message obviously stating a problem near an "i" in line one; however line 1 does not seem to contain a "i". Either you have not showed us the complete contents of the "build.lua" (or have not saved it), or there is some major problem with the lua engine in cs2d. I suspect the first.
edited 1×, last 05.03.12 10:19:03 pm

old Re: Team score :d

EngiN33R
Moderator Off Offline

Quote
I must agree with user Hador, nothing else seems possible aside from your not providing the whole code.

old Re: Team score :d

Big Bang Mafia
User Off Offline

Quote
i showed the complete script.. really i think there's a problem with cs2d lua engine.

EDIT: this is not the only script that get's that problem, some other script's have a problem at line 1 that im using

old Re: Team score :d

sheeL
User Off Offline

Quote
1
2
3
4
5
6
7
8
addhook ("startround", "showscores") 
função showscores () 
if player(id,"exists") then
parse ("hudtxt2 "..id.." 1 \ T Score ©255000000".. jogo (" score_t ") .." \ "200 5") 
parse ("hudtxt2 "..id.." 2 \ CT Score ©000000255".. jogo (" score_ct ") .." \ "400 5") 
end
end
showscores ()

old Re: Team score :d

EngiN33R
Moderator Off Offline

Quote
@user Anders4000: Actually, I do. The hook is startround - sometimes, the execution of a script is not the round beginning. To compensate for that, I call it directly in the script. One step ahead.

old Re: Team score :d

MikuAuahDark
User Off Offline

Quote
user EngiN33R has written
1
2
3
4
5
6
7
addhook("startround","showscores")
function showscores()
	parse("hudtxt 1 \"©255000000T Score:"..game("score_t").."\" 200 5")
	parse("hudtxt 2 \"©000000255CT Score:"..game("score_ct").."\" 400 5")
end

showscores()

your code is not work, it not showing the score, i test it. also if only called 1 time, im sure the score is stays, so the code below maybe work!
@user Suprise: maybe this works!
1
2
3
4
5
6
7
8
9
ts = 0
cts = 0
addhook("kill","lol")
function lol(id)
	if player(id,"team")==1 then ts = ts+1 end
	if player(id,"team")==2 then cts = cts+1 end
	parse("hudtxt 1 \"©255000000T Score:"..ts.."\" 200 5")
	parse("hudtxt 2 \"©000000255CT Score:"..cts.."\" 400 5")
end

old Re: Team score :d

EngiN33R
Moderator Off Offline

Quote
user MikuAuahDark has written
user EngiN33R has written
1
2
3
4
5
6
7
addhook("startround","showscores")
function showscores()
	parse("hudtxt 1 \"©255000000T Score:"..game("score_t").."\" 200 5")
	parse("hudtxt 2 \"©000000255CT Score:"..game("score_ct").."\" 400 5")
end

showscores()


I just tested it and it works.

user MikuAuahDark has written
also if only called 1 time, im sure the score is stays, so the code below maybe work!


If you honestly believe that - you need to learn CS2D Lua a little. A hook automatically parses a function when the hook event happens - thus, the showscores() function is executed manually once when the script starts, but then it's automatically executed every round start.
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview