-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
148 lines (92 loc) · 4.29 KB
/
main.js
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// xdd -> Zykem#9999
function showMain() {
console.clear();
console.log('\n\nFIVEM-TOOL\n\n[1] Server online Users\n[2] Server resources\n[3] Get Whole Server Object\n[4] Get IP:PORT by CFX url\n\n')
readline.question("Pick [1,2,3]:", (pick) => {
if (pick === '1') {
console.clear();
readline.question("Server IP:PORT (Default PORT: 30120):", (ip) => {
const srv = new fivem.Server(ip) // Set the IP with port.
const onlinePlayers = srv.getPlayers();
setInterval(() => {
srv.getPlayers().then(data => console.log(data + ' PLAYERS ONLINE')) // Get & log the data!
}, 1500)
readline.question("\n[1] GOTO Main Menu\n[2] EXIT Process\nYour Choose::", (pick2) => {
if(pick2 === '1') {
showMain();
}else {
process.exit();
}
})
})
}
if (pick === '2') {
console.clear();
readline.question("Server IP:PORT (Default PORT: 30120):", (ip) => {
const srv = new fivem.Server(ip) // Set the IP with port.
const onlinePlayers = srv.getPlayers();
srv.getResources().then(data => console.log(data)) // Get & log the data!
readline.question("\n[1] GOTO Main Menu\n[2] EXIT Process\nYour Choose::", (pick2) => {
if(pick2 === '1') {
showMain();
}else {
process.exit();
}
})
})
}
if(pick === '3'){
console.clear();
readline.question("Server IP:PORT (Default PORT: 30120):", (ip) => {
const srv = new fivem.Server(ip) // Set the IP with port.
const onlinePlayers = srv.getPlayers();
srv.getServer().then(data => console.log(data));
readline.question("\n[1] GOTO Main Menu\n[2] EXIT Process\nYour Choose::", (pick2) => {
if(pick2 === '1') {
showMain();
}else {
process.exit();
}
})
})
}
if(pick === '4') {
console.clear();
readline.question("Enter cfx url (cfx.re/????):", (url) => {
if (url.startsWith("cfx.re/join/")) {
var request = "https://" + url
}
else {
var request = "https://cfx.re/join/" + url
var url = "cfx.re/join/" + url;
}
try {
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var req = new XMLHttpRequest();
req.open('GET', request, false);
req.send();
var response = req.getResponseHeader('x-citizenfx-url').replace("http://", "").replace("/", "");
}
catch(error) {
var response = "Server wasn't found."
}
console.log(`\x1b[0mIP address: \x1b[36m${response}\x1b[0m`);
readline.question("\n[1] GOTO Main Menu\n[2] EXIT Process\nYour Choose::", (pick2) => {
if(pick2 === '1') {
showMain();
}else {
process.exit();
}
})
})
}
})
}
// i love doggo
const fivem = require('fivem')
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
showMain();