-
Notifications
You must be signed in to change notification settings - Fork 1
/
Cellphone_controller.cs
63 lines (53 loc) · 1.54 KB
/
Cellphone_controller.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CitizenFX.Core;
using CitizenFX.Core.Native;
using CitizenFX.Core.UI;
namespace LaLifeWrapper
{
class Cellphone_controller : BaseScript
{
public static Prop cellphone;
public bool cellInHand = false;
public bool noCellInHand = false;
public Cellphone_controller()
{
//If your fishing rod doesn't appear. Type /clearhands. SHOULD FIX.
EventHandlers["wrapper:cellphoneAnimOn"] += new Action(cellOn);
EventHandlers["wrapper:cellphoneAnimOff"] += new Action(cellOff);
Tick += OnTick;
}
//Wonderful function to clear the hands.
void clearHands()
{
cellphone.Detach();
cellphone.Delete();
}
void cellOn()
{
cellInHand = true;
}
void cellOff()
{
noCellInHand = true;
}
public async Task OnTick()
{
if (cellInHand)
{
cellphone = await World.CreateProp(new Model("prop_npc_phone"), Vector3.Zero, false, false);
cellphone.AttachTo(Game.PlayerPed.Bones[73], new Vector3(0.03f, -0.04f, 0.01f), new Vector3(90f, 80f, 60f));
cellInHand = false;
}
if (noCellInHand)
{
clearHands();
noCellInHand = false;
}
await Task.FromResult(0);
}
}
}