-
Notifications
You must be signed in to change notification settings - Fork 1
/
Itinerance.cs
84 lines (67 loc) · 2.53 KB
/
Itinerance.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using CitizenFX.Core;
using CitizenFX.Core.Native;
using LaLifeWrapper.Utils;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace LaLifeWrapper.Itinerance
{
class Itinerance : BaseScript
{
public Itinerance()
{
//TriggerServerEvent(Events.FIRSTTIME, Game.Player.ServerId);
SetPauseMenuTitle();
EventHandlers[Events.PLAYERSPAWNED] += new Action(PlayerSpawned);
EventHandlers[Events.VEHPERSIST] += new Action<Vehicle>(vehPersist);
EventHandlers[Events.ONCLIENTMAPSTART] += new Action(OnClientMapStart);
EventHandlers[Events.DISPLAYTEXT] += new Action<string, int>(DisplayText);
EventHandlers[Events.NOTIFY] += new Action<string, int, string, bool, string>(Notify);
EventHandlers[Events.NOTIF] += new Action<string>(Notif);
EventHandlers[Events.HELP] += new Action<string>(Help);
Tick += OnTick;
}
private void PlayerSpawned()
{
}
//Des petits tests
private void vehPersist(Vehicle veh)
{
veh.IsPersistent.Equals(true);
}
private void SetPauseMenuTitle()
{
Function.Call((Hash)Util.GetHashKey("ADD_TEXT_ENTRY"), "FE_THDR_GTAO", "Propulsé by La Life");
}
private void OnClientMapStart()
{
Exports["spawnmanager"].setAutoSpawn(true);
Exports["spawnmanager"].forceRespawn();
}
private void DisplayText(string text, int time)
{
CitizenFX.Core.UI.Screen.ShowSubtitle(text, time);
}
private void Notify(string icon, int type, string sender, bool title, string text)
{
Function.Call(Hash._SET_NOTIFICATION_TEXT_ENTRY, "STRING");
Function.Call(Hash.ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME, text);
Function.Call(Hash._SET_NOTIFICATION_MESSAGE, icon, icon, true, type, sender, title, text);
Function.Call(Hash._DRAW_NOTIFICATION, false, true);
}
private void Help(string text)
{
CitizenFX.Core.UI.Screen.DisplayHelpTextThisFrame(text);
}
private void Notif(string text)
{
byte[] bytes = System.Text.Encoding.Default.GetBytes(text);
text = System.Text.Encoding.UTF8.GetString(bytes);
CitizenFX.Core.UI.Screen.ShowNotification(text);
}
private async Task OnTick()
{
await Task.FromResult(0);
}
}
}