edited 1×, last 14.09.17 12:06:35 am
Forum
Scripts
Make a players walk reverse
Make a players walk reverse
4 replies
1

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
posx={}
addhook("join","_j")
function _j(id)
posx[id]={}
posx[id][1]=1
end
addhook("move","_m")
function _m(id,x,y)
table.insert(posx[id],x)
local lol = x-10
if posx[id][#posx[id]]>posx[id][#posx[id]-1] then
parse("setpos "..id.." "..lol.." "..y.."")
end
end
With 1 condition which will make the player move left when he is trying to move right. Add more conditions. Laggy maybe.
Ajmin: Thank you for the answer. To be honest with you, i do not understand the why you did1
if posx[id][#posx[id]]>posx[id][#posx[id]-1] then
Can you please add the rest condition for me.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
posx={}
posy={}
addhook("join","_j")
function _j(id)
posx[id]={}
posy[id]={}
posx[id][1]=1
posy[id][1]=1
end
addhook("move","_m")
function _m(id,x,y)
table.insert(posx[id],x)
table.insert(posy[id],y)
local nq = x-10
local sq = x+10
if posy[id][#posy[id]]==posy[id][#posy[id]-1] then
	if posx[id][#posx[id]]>posx[id][#posx[id]-1] then
		table.insert(posx[id],nq)
		parse("setpos "..id.." "..nq.." "..y.."")
	else
		table.insert(posx[id],sq)
	parse("setpos "..id.." "..sq.." "..y.."")
	end
end
local mm = y-10
local em = y+10
if posx[id][#posx[id]]==posx[id][#posx[id]-1] then
	if posy[id][#posy[id]]>posy[id][#posy[id]-1] then
		table.insert(posy[id],mm)
		parse("setpos "..id.." "..x.." "..mm.."")
	else
		table.insert(posy[id],em)
	parse("setpos "..id.." "..x.." "..em.."")
	end
end
end
1

Offline