Forum

> > CS2D > Scripts > [SOLVED] Reset tables on leave/join
Forums overviewCS2D overview Scripts overviewLog in to reply

English [SOLVED] Reset tables on leave/join

1 reply
To the start Previous 1 Next To the start

old [SOLVED] Reset tables on leave/join

Casper-
User Off Offline

Quote
I've been trying to make player ID specific tables to restart on leave or join. I've failed and don't know what to do next. Any hints or tips? Or maybe other ways to do it?
Code :
Spoiler >

Image :


EDIT :Ugh, figured out... it was
PlayerHP[id]
instead of
PlayerHP[i]

Sorry about this. You can delete the post now.
edited 2×, last 18.07.18 09:33:31 am

old Re: [SOLVED] Reset tables on leave/join

Rainoth
Moderator Off Offline

Quote
You can change the title to [SOLVED] if you solve the problem.
With that said, I'd advise using a single table for these things.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
stats = {
player = {},
max = {spd = 40, hp = 250},
hooks = {"second","join"}
}
for k,v in pairs(stats.hooks) do
	addhook(v, "_"..v)
end

function _join(id)
	stats.player[id] = {hp = 100, armor = 0, spd = 0}
end

function _second()
	for _,id in pairs (player(0,"team2")) do
		parse('hudtxt2 '..id..' 0 "Player HP: '..stats.player[id].hp..'" 40 40')
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview