-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFoXer.lua
More file actions
339 lines (297 loc) · 9.19 KB
/
Copy pathFoXer.lua
File metadata and controls
339 lines (297 loc) · 9.19 KB
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
script_name('FoXer')
script_author('Votati')
script_version('v0.8')
-- require('lib.moonloader')
-- require('lib.sampfuncs')
local sampEvent = require('lib.samp.events')
local sampRaknet = require('lib.samp.raknet')
local dinero = 0
local bancoId = 0
local depositando = false
local transfiriendo = false
local evadiendo = false
local dinfo = false
local borrarveh = false
local desmadre = false
local vehTotal = 0
local dialogs = {
D_AYUDA = 0
}
local vehicles = {}
for i = 1, 2000 do
vehicles[i] = 0
end
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
print("cargado correctamente.")
sampRegisterChatCommand('af', cmd_af)
sampRegisterChatCommand('nombre', cmd_nombre)
-- sampRegisterChatCommand('depositar', cmd_depositar)
-- sampRegisterChatCommand('transferir', cmd_transferir)
sampRegisterChatCommand('evadir', cmd_evadir)
sampRegisterChatCommand('borrarv', cmd_borrarv)
sampRegisterChatCommand('dinfo', cmd_dinfo)
-- sampRegisterChatCommand('desmadre', cmd_desmadre)
sampRegisterChatCommand('spawn', cmd_spawn)
sampRegisterChatCommand('registro', function()
sampSendDialogResponse(0, 1, 0, 'admin123')
end)
wait(-1)
end
function sampEvent.onShowDialog(dialogId, style, title, button1, button2, text)
if depositando == true then
if dialogId == 8 then
sampSendDialogResponse(8, 1, 1, "Depositar")
end
if dialogId == 10 then
sampSendDialogResponse(10, 1, 0, dinero)
end
end
if transfiriendo == true then
if dialogId == 8 then
sampSendDialogResponse(8, 1, 2, "Transferir")
end
if dialogId == 11 then
sampSendDialogResponse(11, 1, 0, bancoId)
end
if dialogId == 12 then
sampSendDialogResponse(12, 1, 0, dinero)
end
end
if evadiendo == true then
if dialogId == 3 then
return false
end
end
if dinfo == true then
return { dialogId, style, title .. " | ID: " .. dialogId, button1, button2, text }
end
end
--[[function sampEvent.onSendDialogResponse(dialogId, button, listboxId, input)
sampAddChatMessage("{FCFC74}=== EVENTO: {FF5555}onSendDialogResponse {FCFC74}===", -1)
sampAddChatMessage(string.format("{FCFC74}dialogId: {FFAF55}%d", dialogId), -1)
sampAddChatMessage(string.format("{FCFC74}button: {FFAF55}%d", button), -1)
sampAddChatMessage(string.format("{FCFC74}listboxId: {FFAF55}%d", listboxId), -1)
sampAddChatMessage(string.format("{FCFC74}input: {FFAF55}%s", input), -1)
end]]
function sampEvent.onShowTextDraw(textdrawId, textdraw)
if evadiendo == true then
if textdrawId == 2 or textdrawId == 0 then
return false
end
end
end
function sampEvent.onInterpolateCamera(setPos, fromPos, destPos, time, mode)
if evadiendo == true then
return false
end
end
function sampEvent.onTogglePlayerSpectating(state)
if evadiendo == true then
return false
end
end
function sampEvent.onSendClientJoin(version, mod, nickname, challengeResponse, joinAuthKey, clientVer, challengeResponse2)
return { version, mod, nickname, challengeResponse, joinAuthKey, "0.3.7-R4", challengeResponse2 }
end
--[[function sampEvent.onSendVehicleDamaged(vehicleid, panelDmg, doorDmg, light, tires)
sampAddChatMessage("{FCFC74}=== EVENTO: {FF5555}onSendVehicleDamaged {FCFC74}===", -1)
sampAddChatMessage(string.format("{FCFC74}vehicleid: {FFAF55}%d", vehicleid), -1)
sampAddChatMessage(string.format("{FCFC74}panelDmg: {FFAF55}%d", panelDmg), -1)
sampAddChatMessage(string.format("{FCFC74}doorDmg: {FFAF55}%d", doorDmg), -1)
sampAddChatMessage(string.format("{FCFC74}light: {FFAF55}%d", light), -1)
sampAddChatMessage(string.format("{FCFC74}tires: {FFAF55}%d", tires), -1)
end]]
function sampEvent.onVehicleStreamIn(vehicleid, forplayerid)
if borrarveh == true then
sampSendVehicleDestroyed(vehicleid)
end
vehicles[vehicleid] = vehicleid
vehTotal = vehTotal + 1
end
function sampEvent.onVehicleStreamOut(vehicleid)
vehicles[vehicleid] = 0
vehTotal = vehTotal - 1
end
function sampEvent.onPlayerQuit(playerid, reason)
if desmadre == true then
nickname = sampGetPlayerNickname(playerid)
sampSendChat(string.format("/delete %s", nickname))
end
end
-- function sampEvent.onSendEnterVehicle(vehicleid, passenger)
-- lua_thread.create(putBelt)
-- end
function GetMaxElementArray(array)
local max = 0
for i = 1, 2000 do
if array[i] > max then
max = array[i]
end
end
return max
end
function GetMinElementArray(array)
local min = 2000
for i = 1, 2000 do
if array[i] < min and array[i] ~= 0 then
min = array[i]
end
end
return min
end
function cmd_dinfo()
if dinfo == true then
dinfo = false
sampAddChatMessage("{FCFC74}Información de los diálogos: {FF5555}Desactivado", -1)
else
dinfo = true
sampAddChatMessage("{FCFC74}Información de los diálogos: {76FF55}Activado", -1)
end
end
function cmd_borrarv(id)
if #id == 0 then
local cont = 0
for i = GetMinElementArray(vehicles), GetMaxElementArray(vehicles) do
if select(1, sampGetCarHandleBySampVehicleId(vehicles[i])) == true then
sampSendVehicleDestroyed(vehicles[i])
cont = cont + 1
end
end
if cont == 0 then
sampAddChatMessage("{FF5555}<!> No se encontró ningún vehículo para eliminar.", -1)
else
sampAddChatMessage(string.format("{FCFC74}Eliminaste {FF5555}%d {FCFC74}vehículos.", cont), -1)
end
return
elseif type(tonumber(id)) == "number" then
if tonumber(id) > 0 and tonumber(id) <= 2000 then
sampSendVehicleDestroyed(id)
sampAddChatMessage(string.format("{FCFC74}Vehículo ID {FF5555}%d {FCFC74}fue eliminado.", id), -1)
return
else
sampAddChatMessage("{FF5555}<!> La ID debe ser entre 1 - 2000.", -1)
end
elseif id == "on" then
borrarveh = true
sampAddChatMessage("{FCFC74}Modo borrar vehículos: {76FF55}Activado", -1)
return
elseif id == "off" then
borrarveh = false
sampAddChatMessage("{FCFC74}Modo borrar vehículos: {FF5555}Desactivado", -1)
return
else
sampAddChatMessage("{FF5555}<!> Uso correcto: {FFAF55}/borrarv | /borrarv <ID> | /borrarv <on/off>", -1)
end
end
function cmd_evadir()
if evadiendo == true then
evadiendo = false
sampAddChatMessage("{FCFC74}Modo evadir: {FF5555}Desactivado", -1)
else
evadiendo = true
sampAddChatMessage("{FCFC74}Modo evadir: {76FF55}Activado", -1)
end
end
function cmd_transferir(args)
local id, money = string.match(args, '(%d+)%s*(%d+)')
if #args == 0 then
return sampAddChatMessage("{FF5555}<!> Uso correcto: {FFAF55}/transferir <ID> <Cantidad>", -1)
else
if args == tostring(0) then
transfiriendo = false
sampAddChatMessage("{FCFC74}Modo transferir: {FF5555}Desactivado", -1)
else
transfiriendo = true
dinero = money
bancoId = id
sampAddChatMessage("{FCFC74}Modo transferir: {76FF55}Activado", -1)
sampAddChatMessage(string.format("{FCFC74}Cuenta bancaria: {6AFFCD}%s", id), -1)
sampAddChatMessage(string.format("{FCFC74}Dinero: {53C33A}$%s", money), -1)
end
end
end
function cmd_depositar(money)
if #money == 0 then
return sampAddChatMessage("{FF5555}<!> Uso correcto: {FFAF55}/depositar <Cantidad>", -1)
else
if money == tostring(0) then
depositando = false
sampAddChatMessage("{FCFC74}Modo depositar: {FF5555}Desactivado", -1)
else
depositando = true
dinero = money
sampAddChatMessage("{FCFC74}Modo depositar: {76FF55}Activado", -1)
sampAddChatMessage(string.format("{FCFC74}Dinero: {53C33A}$%d", money), -1)
end
end
end
function cmd_nombre(name)
if #name == 0 then
return sampAddChatMessage("{FF5555}<!> Uso correcto: {FFAF55}/nombre <Nombre>", -1)
else
--[[for i = 0, sampGetMaxPlayerId(false) do
if sampGetPlayerNickname(i) == name then
sampAddChatMessage("{FF5555}<!> El jugador ya está conectado.", -1)
return
end
end]]
sampSetLocalPlayerName(name)
sampSetGamestate(4)
sampSetGamestate(1)
end
end
function GiveGift(id)
playerid = select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))
ping = sampGetPlayerPing(playerid)
sampSendChat(string.format("/givecash %d 3000000", id))
wait(ping * 10)
sampSendChat(string.format("/pm %d Has ganado el sorteo secreto! No le digas a nadie ;)", id))
end
function cmd_r(id)
if #id == 0 then
return sampAddChatMessage("{FF5555}<!> Uso correcto: {FFAF55}/r <ID>", -1)
else
lua_thread.create(GiveGift, id)
end
end
function cmd_desmadre()
if desmadre == true then
desmadre = false
sampAddChatMessage("{FCFC74}Modo desmadre: {FF5555}Desactivado", -1)
else
desmadre = true
sampAddChatMessage("{FCFC74}Modo desmadre: {76FF55}Activado", -1)
end
end
function cmd_spawn()
sampSpawnPlayer()
sampAddChatMessage("{FCFC74}Spawneaste.", -1)
end
function cmd_af()
sampShowDialog(D_AYUDA, "Comandos de FoXer", "/nombre - Cambia tu nombre y te reconecta.\
\n/depositar - Activa/Deactiva el modo depositar\
\n/transferir - Transfiere el dinero de una cuenta bancaria a otra.\
\n/evadir - Activa/Desactiva el modo evadir.\
\n/borrarv - Borra los vehículos de los usuarios.\
\n/dinfo - Activa/Desactiva la información de los diálogos.\
\n/registro - Muestra el diálogo de registro.\
\n/spawn - Te vuelve a spawnear.",
"Cerrar", 0)
end
function cmd_test()
-- local result = isCharInAnyCar(PLAYER_PED)
-- print(result)
lua_thread.create(putBelt)
end
function putBelt()
wait(5000)
if isCharInAnyCar(PLAYER_PED) then
sampSendChat("/poner cinturon")
end
end
function getOwnId()
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
return id
end