*Jump only to the direction that you are facing*
Forum
Scripts
LUA Question - Jumping
LUA Question - Jumping
2 replies
1

*Jump only to the direction that you are facing*
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
canjump=initArray2(32,true)
addhook("say","jump")
function jump(id,cmd)
if (cmd=="!jump" and player(id,"exists") and canjump[id]) then
local rot = player(id,"rot")
if rot < -90 then rot = rot + 360 end
local angle = math.rad(math.abs( rot + 90 )) - math.pi
local x = player(id,"x") + math.cos(angle) * 56
local y = player(id,"y") + math.sin(angle) * 56
local fx = player(id,"x") + math.cos(angle) * 32
local fy = player(id,"y") + math.sin(angle) * 32
local tfx = math.floor(fx/32)
local tfy = math.floor(fy/32)
local tx = math.floor(x/32)
local ty = math.floor(y/32)
if x > 0 and y > 0 and x < map("xsize") * 32 and y < map("ysize") * 32 and tile(tx,ty,"property")~=1 and tile(tx,ty,"property")~=2 and tile(tx,ty,"property")~=3 and tile(tx,ty,"property")~=4 and tile(tfx,tfy,"property")~=1 and tile(tfx,tfy,"property")~=2 and tile(tfx,tfy,"property")~=3 and tile(tfx,tfy,"property")~=4 then
parse("setpos "..id.." "..x.." "..y)
canjump[id]=false
timer(1000,"parse","lua canjump["..id.."]=true")
end
return 1
end
end
@Lotteria
What?
1

Offline