Forum
CS2D Scripts savesystemsavesystem
9 Antworten 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pos = {} addhook('join', 'AA_join') addhook('leave', 'AA_leave') addhook('spawn', 'AA_spawn') function AA_join(id) 	if io.open('sys/lua/saves/pos'..player(id, 'usgn')..'.lua') then 		dofile('sys/lua/saves/pos'..player(id, 'usgn')..'.lua') 		os.remove('sys/lua/saves/pos'..player(id, 'usgn')..'.lua') 	end end function AA_leave(id) 	local file = io.open('sys/lua/saves/pos'..player(id, 'usgn')..'.lua', 'w') 	file:write('pos['..player(id, 'usgn')..'] = {'..player(id, 'x')..','..player(id, 'y')..'}') end function AA_spawn(id) 	if io.open('sys/lua/saves/pos'..player(id, 'usgn')..'.lua') then 		parse('setpos '..id..' '..pos[player(id, 'usgn')][1]..' '..pos[player(id, 'usgn')][2]) 	end end
5× editiert, zuletzt 12.07.12 11:06:34
Xavis hat geschrieben
is possible tht if u kill player thn player respawns in same pos like he died ?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
sppos = {} for i = 1, 32 do sppos[i] = {0, 0} end addhook('kill', 'AA_kill') addhook('spawn', 'AA_spawn') function AA_kill(id, victim) 	sppos[victim][1] = player(victim, 'x') 	sppos[victim][2] = player(victim, 'y') end function AA_spawn(id) 	if sppos[id][1] and sppos[id][2] then 		parse('setpos '..id..' '..sppos[id][1]..' '..sppos[id][2]) 	end end
1× editiert, zuletzt 12.07.12 11:06:18
1
addhook('spawn', 'AA_spawn')
Alistaire hat geschrieben
1
addhook('spawn' 'AA_spawn')
You forgot a comma there.
1