-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu_flyhack.go
executable file
·78 lines (69 loc) · 1.54 KB
/
menu_flyhack.go
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package main
import (
. "gtasamod/directcalls"
. "gtasamod/types"
)
func pedorvehiclepos(gi *GameInternals) *CVector {
if *gi.currentvehicle != nil {
return &(*gi.currentvehicle).Pos.Position
} else {
return &gi.player.Ped.Pos.Position
}
}
func pedorvehiclephysicsflags(gi *GameInternals) *PhysicsFlags {
if *gi.currentvehicle != nil {
return &(*gi.currentvehicle).PhysFlags
} else {
return &gi.player.Ped.PhysFlags
}
}
func pedorvehiclespeed(gi *GameInternals) *CVector {
if *gi.currentvehicle != nil {
return &(*gi.currentvehicle).MoveSpeed
} else {
return &gi.player.Ped.MoveSpeed
}
}
func menu_flyhack_setup() {
AddFn(func(gi *GameInternals) bool {
pedorvehiclephysicsflags(gi).ApplyGravityToggle(false)
return false
})
Hud_SetHelpMessage("Flymode on.\nPress Esc to quit.", true, false, false)
}
func menu_flyhack(c uint32) bool {
var t CVector
switch c {
case Numpad5:
t.Z += 2
case Numpad0:
t.Z -= 2
case Numpad8:
t.Y += 2
case Numpad2:
t.Y -= 2
case Numpad6:
t.X += 2
case Numpad4:
t.X -= 2
case Esc:
AddFn(func(gi *GameInternals) bool {
pedorvehiclephysicsflags(gi).ApplyGravityToggle(true)
return false
})
Hud_SetHelpMessage("Flymode off", true, false, false)
return false
}
AddFn(func(gi *GameInternals) bool {
*pedorvehiclespeed(gi) = CVector{} //zero the speed every time since we can he hit by something
dstpos := pedorvehiclepos(gi)
dstpos.X += t.X
dstpos.Y += t.Y
dstpos.Z += t.Z
return false
})
return true
}
func init() {
NewMenu(F7, menu_flyhack, menu_flyhack_setup)
}