Forum

> > CS2D > Scripts > Using variable in concatenating
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Using variable in concatenating

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Using variable in concatenating

SkullFace
User Off Offline

Zitieren
I .. think I said it alright in title, haha.

Well, what I'm trying to do is just as the title says.
I'm trying to get a player that isn't a bot, get health regeneration

1
2
3
4
5
6
7
8
9
10
playerRegen = 1

addhook("second","healsystem")
function healsystem()
	for id=1,32 do
		if player(id,"bot") == false then
			parse("sethealth "..id.." "..player(id,"health").. + playerRegen)
		end
	end
end

I've tried doing it in other ways; failed.
So I'm asking here if someone can help me with this, since I can't get my head around this.

alt Re: Using variable in concatenating

Cure Pikachu
User Off Offline

Zitieren
It's actually quite easy.
parse("sethealth "..id.." "..player(id,"health").. + playerRegen)
should be
parse("sethealth "..id.." "..player(id,"health") + playerRegen)
.

alt Re: Using variable in concatenating

GeoB99
Moderator Off Offline

Zitieren
Replace the numerical
for
loop with this:
1
for _, id in pairs( player(0, 'tableliving') ) do
Your numerical loop iterated over 32 players to gather their ID however since, assuming you were the only player online, it would have iterated over to you, the rest of the iteration resulting in
false
hence boolean.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht