· 5 years ago · Mar 01, 2020, 12:40 AM
1customCarNames = -- новые названия
2{
3
4}
5
6shopsVehSpawns = {
7 [1] = { 2131, -1133, 25.6, 0,0,359 },
8 [2] = { 536.85071, -1279.69385, 17.24219, 0,0,320 },
9 [3] = { 1941, 2097, 10.8, 0,0,350 },
10 [4] = { -1988, 272, 36, 0,0,259 },
11 [5] = { -1642, 1213, 7.17, 0,0, 227 },
12}
13
14function getFreeID()
15 local result = dbPoll(dbQuery(db, "SELECT ID FROM VehicleList ORDER BY ID ASC"), -1)
16 newID = false
17 for i, id in pairs (result) do
18 if id["ID"] ~= i then
19 newID = i
20 break
21 end
22 end
23 if newID then return newID else return #result + 1 end
24end
25
26function getVehicleByID(id)
27 v = false
28 for i, veh in ipairs (getElementsByType("vehicle")) do
29 if getElementData(veh, "ID") == id then
30 v = veh
31 break
32 end
33 end
34 return v
35end
36
37function updateVehicleInfo(player)
38 if isElement(player) then
39 local result = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ?", getAccountName(getPlayerAccount(player))), -1)
40 if type(result) == "table" then
41 setElementData(player, "VehicleInfo", result)
42 end
43 end
44end
45
46addEventHandler("onResourceStart", resourceRoot,
47function()
48 db = dbConnect("sqlite", "database.db")
49 dbExec(db, "CREATE TABLE IF NOT EXISTS VehicleList (ID, Account, Model, X, Y, Z, RotZ, Colors, Upgrades, Paintjob, Cost, HP, new_hydr)")
50 for i, player in ipairs(getElementsByType("player")) do
51 updateVehicleInfo(player)
52 end
53end)
54
55addEvent("onOpenGui", true)
56addEventHandler("onOpenGui", root,
57function()
58 updateVehicleInfo(source)
59end)
60
61function destroyVehicle(theVehicle)
62 if isElement(theVehicle) then
63 local Owner = getElementData(theVehicle, "Owner")
64 if Owner then
65 local x, y, z = getElementPosition(theVehicle)
66 local _, _, rz = getElementRotation(theVehicle)
67 local r1, g1, b1, r2, g2, b2 = getVehicleColor(theVehicle, true)
68 local color = r1..","..g1..","..b1..","..r2..","..g2..","..b2
69 upgrade = ""
70 for _, upgradee in ipairs (getVehicleUpgrades(theVehicle)) do
71 if upgrade == "" then
72 upgrade = upgradee
73 else
74 upgrade = upgrade..","..upgradee
75 end
76 end
77 local Paintjob = getVehiclePaintjob(theVehicle) or 3
78 local id = getElementData(theVehicle, "ID")
79 dbExec(db, "UPDATE VehicleList SET X = ?, Y = ?, Z = ?, RotZ = ?, HP = ?, Colors = ?, Upgrades = ?, Paintjob = ?, new_hydr = ? WHERE Account = ? AND ID = ?", x, y, z, rz, getElementHealth(theVehicle), color, upgrade, Paintjob, getElementData ( theVehicle, "NewHydr") and 1 or 0, getAccountName(getPlayerAccount(Owner)), id)
80 updateVehicleInfo(Owner)
81 local attached = getAttachedElements(theVehicle)
82 if (attached) then
83 for k,element in ipairs(attached) do
84 if getElementType(element) == "blip" then
85 destroyElement(element)
86 end
87 end
88 end
89 end
90 destroyElement(theVehicle)
91 end
92end
93
94addEvent("onBuyNewVehicle", true)
95addEventHandler("onBuyNewVehicle", root,
96function(Model, cost, r1, g1, b1, r2, g2, b2)
97 abc = false
98 local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ?", getAccountName(getPlayerAccount(source))), -1)
99 for i, data in ipairs (data) do
100 if data["Model"] == Model then
101 abc = true
102 break
103 end
104 end
105 if #data >= 5 then outputChatBox("#FF0000| ERRO | Você só pode comprar 5 veículos!", source, 38, 122, 216, true) return end
106 if abc then -- outputMessage("#c1c1c1Você já tem este veiculo.", source, 38, 122, 216, true) return end
107 if getPlayerMoney(source) >= tonumber(cost) then
108 takePlayerMoney ( source, cost )
109 local x, y, z = getElementPosition(source)
110 local _, _, rz = getElementRotation(source)
111 local shopID = getElementData ( source, "atVehShop")
112 local color = r1..","..g1..","..b1..","..r2..","..g2..","..b2
113 if shopID and shopsVehSpawns[shopID] then
114 vehicle = createVehicle(Model, shopsVehSpawns[shopID][1], shopsVehSpawns[shopID][2], shopsVehSpawns[shopID][3], shopsVehSpawns[shopID][4], shopsVehSpawns[shopID][5], shopsVehSpawns[shopID][6])
115 else
116 vehicle = createVehicle(Model, x-5, y+5, z, 0, 0, rz)
117 end
118 setVehicleColor(vehicle, r1, g1, b1, r2, g2, b2)
119 setElementData(vehicle, "Owner", source)
120 setElementData(vehicle, "fuel", 50)
121 local NewID = getFreeID()
122 setElementData(vehicle, "ID", NewID)
123 dbExec(db, "INSERT INTO VehicleList VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", NewID, getAccountName(getPlayerAccount(source)), Model, x-5, y+5, z, rz, color, "", 3, cost, 1000, 0)
124 -- outputMessage("#c1c1c1Por: #00FF66$"..cost, source, 38, 122, 216, true)
125 updateVehicleInfo(source)
126 setElementData(vehicle, "ownercar", getAccountName(getPlayerAccount(source)))
127 warpPedIntoVehicle ( source, vehicle )
128 local id1 = getElementData(source, "ID")
129
130
131 setVehiclePlateText(vehicle, ""..id1.."" )
132 vv[vehicle] = setTimer(function(source)
133 if not isElement(source) then killTimer(vv[source]) vv[source] = nil end
134 if isElement(source) and getElementHealth(source) <= 255 then
135 setElementHealth(source, 255.5)
136 setVehicleDamageProof(source, true)
137 setVehicleEngineState(source, false)
138 end
139 end, 150, 0, vehicle)
140 addEventHandler("onVehicleDamage", vehicle,
141 function(loss)
142 local account = getAccountName(getPlayerAccount(getElementData(source, "Owner")))
143 setTimer(function(source) if isElement(source) then dbExec(db, "UPDATE VehicleList SET HP = ? WHERE Account = ? AND Model = ?", getElementHealth(source), account, getElementModel(source)) updateVehicleInfo(getElementData(source, "Owner")) end end, 100, 1, source)
144 end)
145 addEventHandler("onVehicleEnter", vehicle,
146 function(player)
147 if getElementHealth(source) <= 255.5 then
148 setVehicleEngineState(source, false)
149 else
150 if isVehicleDamageProof(source) then
151 setVehicleDamageProof(source, false)
152 end
153 end
154 end)
155 else
156 -- outputMessage("#c1c1c1Você não tem grana para comprar este veiculo.", source, 38, 122, 216, true)
157 end
158end)
159
160vv = {}
161
162addEvent("SpawnMyVehicle", true)
163addEventHandler("SpawnMyVehicle", root,
164function(id)
165 local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1)
166 if type(data) == "table" and #data ~= 0 then
167 if getVehicleByID(id) then
168 -- outputMessage("#c1c1c1O seu veiculo #00FF66"..(customCarNames[data[1]["Model"]] or getVehicleNameFromModel(data[1]["Model"])).." #c1c1c1já está spawnado.", source, 38, 122, 216, true)
169 else
170 local color = split(data[1]["Colors"], ',')
171 r1 = color[1] or 255
172 g1 = color[2] or 255
173 b1 = color[3] or 255
174 r2 = color[4] or 255
175 g2 = color[5] or 255
176 b2 = color[6] or 255
177 vehicle = createVehicle(data[1]["Model"], data[1]["X"], data[1]["Y"], data[1]["Z"], 0, 0, data[1]["RotZ"])
178 setElementData(vehicle, "ID", id)
179 local upd = split(tostring(data[1]["Upgrades"]), ',')
180 for i, upgrade in ipairs(upd) do
181 addVehicleUpgrade(vehicle, upgrade)
182 end
183 local Paintjob = data[1]["Paintjob"] or 3
184 setVehiclePaintjob(vehicle, Paintjob)
185 setVehicleColor(vehicle, r1, g1, b1, r2, g2, b2)
186 if tonumber(data[1]["HP"]) <= 255.5 then data[1]["HP"] = 255 end
187 if data[1]["new_hydr"] and data[1]["new_hydr"] == 1 then
188 setElementData(vehicle, "NewHydr", true)
189 else
190 setElementData(vehicle, "NewHydr", false)
191 end
192 setElementData(vehicle, "ownercar", getAccountName(getPlayerAccount(source)))
193 setElementHealth(vehicle, data[1]["HP"])
194 setElementData(vehicle, "Owner", source)
195 vv[vehicle] = setTimer(function(source)
196 if not isElement(source) then killTimer(vv[source]) vv[source] = nil end
197 if isElement(source) and getElementHealth(source) <= 255 then
198 setElementHealth(source, 255.5)
199 setVehicleDamageProof(source, true)
200 setVehicleEngineState(source, false)
201 end
202 end, 50, 0, vehicle)
203 addEventHandler("onVehicleDamage", vehicle,
204 function(loss)
205 local account = getAccountName(getPlayerAccount(getElementData(source, "Owner")))
206 setTimer(function(source) if isElement(source) then dbExec(db, "UPDATE VehicleList SET HP = ? WHERE Account = ? AND Model = ?", getElementHealth(source), account, getElementModel(source)) updateVehicleInfo(getElementData(source, "Owner")) end end, 100, 1, source)
207 end)
208 addEventHandler("onVehicleEnter", vehicle,
209 function(player)
210 if getElementHealth(source) <= 255.5 then
211 setVehicleEngineState(source, false)
212 else
213 if isVehicleDamageProof(source) then
214 setVehicleDamageProof(source, false)
215 end
216 end
217 end)
218 outputChatBox("| BVO | Você conectou seu veículo #0080ff"..(customCarNames[data[1]["Model"]] or getVehicleNameFromModel(data[1]["Model"])).."", source, 255, 255, 255, true)
219 end
220 else
221 -- outputMessage("#c1c1c1Há um problema com o veiculo, notifique o administrador.", source, 38, 122, 216, true)
222 end
223end)
224
225addEvent("DestroyMyVehicle", true)
226addEventHandler("DestroyMyVehicle", root,
227function(id)
228 local vehicle = getVehicleByID(id)
229 if isElement(vehicle) then
230 local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1)
231 if type(data) == "table" and #data ~= 0 then
232 destroyVehicle(vehicle)
233 outputChatBox("| BVO | Você desconectou seu veículo #0080ff"..(customCarNames[data[1]["Model"]] or getVehicleNameFromModel(data[1]["Model"])).."", source, 255, 255, 255, true)
234 else
235 -- outputMessage("#c1c1c1Selecione um veiculo.", source, 38, 122, 216, true)
236 end
237 else
238 outputChatBox("#ff0000| BVO | Esse veículo não está conectado!", source, 255, 255, 255, true)
239 end
240end)
241
242addEvent("LightsMyVehicle", true)
243addEventHandler("LightsMyVehicle", root,
244function(id)
245 local vehicle = getVehicleByID(id)
246 if isElement(vehicle) then
247 local Vehicle = getPedOccupiedVehicle(source)
248 if Vehicle == vehicle then
249 if getVehicleOverrideLights(vehicle) ~= 2 then
250 setVehicleOverrideLights(vehicle, 2)
251 -- outputMessage("#c1c1c1Seu veiculo #00FF66"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #c1c1c1teve as luzes acesas.", source, 38, 122, 216, true)
252 elseif getVehicleOverrideLights(vehicle) ~= 1 then
253 setVehicleOverrideLights(vehicle, 1)
254 -- outputMessage("#c1c1c1Seu veiculo #00FF66"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #c1c1c1teve as luzes apagadas.", source, 38, 122, 216, true)
255 end
256 else
257 -- outputMessage("#c1c1c1Você não está no veiculo!", source, 38, 122, 216, true)
258 end
259 else
260 -- outputMessage("#c1c1c1O seu veiculo não está spawnado.", source, 38, 122, 216, true)
261 end
262end)
263
264addEvent("LockMyVehicle", true)
265addEventHandler("LockMyVehicle", root,
266function(id)
267 local vehicle = getVehicleByID(id)
268 if isElement(vehicle) then
269 if not isVehicleLocked(vehicle) then
270 setVehicleLocked(vehicle, true)
271 setVehicleDoorsUndamageable(vehicle, true)
272 setVehicleDoorState(vehicle, 0, 0)
273 setVehicleDoorState(vehicle, 1, 0)
274 setVehicleDoorState(vehicle, 2, 0)
275 setVehicleDoorState(vehicle, 3, 0)
276 outputChatBox("| BVO | Seu veículo #0080ff"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #fffffffoi fechado!", source, 255, 255, 255, true)
277
278 elseif isVehicleLocked(vehicle) then
279 setVehicleLocked(vehicle, false)
280 setVehicleDoorsUndamageable(vehicle, false)
281 outputChatBox("| BVO | Seu veículo #0080ff"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #fffffffoi aberto!", source, 255, 255, 255, true)
282
283 end
284 else
285 outputChatBox("#ff0000| BVO | Seu veículo não está conectado!", source, 255, 255, 255, true)
286 end
287end)
288
289
290addEvent("FixMyVehicle", true)
291addEventHandler("FixMyVehicle", root,
292function(id)
293if getElementData(source, "SeguroCarroaa") then
294 local vehicle = getVehicleByID(id)
295 if isElement(vehicle) then
296 if not getElementData(vehicle, "ABlip") then
297 setElementData(vehicle, "ABlip", true)
298
299 createBlipAttachedTo(vehicle, 41, 2, 255, 0, 0, 255, 0, 65535, source)
300 outputChatBox("| BVO | Seu veículo #0080ff"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #fffffffoi marcado no mapa", source, 255, 255, 255, true)
301
302 else
303 local attached = getAttachedElements(vehicle)
304 if (attached) then
305 for k,element in ipairs(attached) do
306 if getElementType(element) == "blip" then
307 destroyElement(element)
308 end
309 end
310 end
311 setElementData(vehicle, "ABlip", false)
312 outputChatBox("| BVO | Você deslocalizou seu veículo!.", source, 255, 255, 255, true)
313 end
314 else
315 outputChatBox("#ff0000| ERRO | Seu veículo não está spawnado para localiza-lo!", source, 255, 255, 255, true)
316 end
317 else
318 outputChatBox("#ff0000| ERRO | Você não possui rastreador em seus veículos para localiza-los!", source, 255, 255, 255, true)
319 outputChatBox("#ff0000| ERRO | Compre rastreador no Detran de Los Santos ( Localizado por um ' D ' )", source, 255, 255, 255, true)
320 end
321end)
322
323
324commando = { }
325tempo = 120000
326
327addEvent("WarpMyVehicle", true)
328addEventHandler("WarpMyVehicle", root,
329function(id)
330 if (commando[source]) then --Existe algum motivo para usar playerSource em vez de thePlayer?
331 return outputChatBox ( "| ERRO | Seu mecanico não está disponivel... tente mais tarde!", source, 255, 0, 0, true )
332 end
333 if not isPedInVehicle (source) then
334 if getElementInterior(source) == 0 then
335 if getPlayerMoney(source) >= tonumber(5000) then
336 local vehicle = getVehicleByID(id)
337 if isElement(vehicle) then
338 takePlayerMoney ( source, 5000 )
339 local x, y, z = getElementPosition(source)
340 setElementPosition(vehicle, x, y, z)
341 commando[source] = true
342 outputChatBox ("#ffffff| BVO | Seu mecanico levou seu veículo até você! ", source, 38, 122, 216, true)
343 commando [ source ] = setTimer (
344 function ( source )
345 commando [ source ] = false
346 end
347 ,tempo, 1, source
348 )
349 else
350 outputChatBox("#ff0000| ERRO | Seu veículo não está spawnado para trazer-lo!", source, 38, 122, 216, true)
351 end
352 else
353 outputChatBox("#ff0000| ERRO | Você não tem dinheiro suficiente para chamar seu mecanico", source, 38, 122, 216, true)
354 end
355 else
356 -- outputMessage("#c1c1c1Você só poderá mudar de veiculo se sair do atual.", source, 38, 122, 216, true)
357 end
358 else
359-- outputMessage("#c1c1c1Nós não podemos dirigir seu veiculo. Por favor, sair do outro veiculo.", source, 38, 122, 216, true)
360 end
361end)
362
363
364 revenda1ss = createMarker ( 2148.59448, -1161.65540, 23.82031-1, "cylinder", 10, 0, 128, 255, 20 )
365local revendaaaa = createBlipAttachedTo ( revenda1ss, 62 )
366 setBlipVisibleDistance(revendaaaa, 100)
367
368 revenda2ss = createMarker ( -1976.51819, 264.23325, 35.17188-1, "cylinder", 10, 0, 128, 255, 20 )
369 local revendaaaa = createBlipAttachedTo ( revenda2ss, 62 )
370 setBlipVisibleDistance(revendaaaa, 100)
371
372 revenda3ss = createMarker ( 560.30804, -1285.76099, 17.24824-1, "cylinder", 10, 0, 128, 255, 20 )
373 local revendaaaa = createBlipAttachedTo ( revenda3ss, 62 )
374 setBlipVisibleDistance(revendaaaa, 100)
375
376 revenda4ss = createMarker ( 1982.59814, 2045.10815, 10.82031-1, "cylinder", 10, 0, 128, 255, 20 )
377 local revendaaaa = createBlipAttachedTo ( revenda4ss, 62 )
378 setBlipVisibleDistance(revendaaaa, 100)
379
380addEvent("SellMyVehicle", true)
381addEventHandler("SellMyVehicle", root,
382function(id)
383 local vehicle = getVehicleByID(id)
384 if isElement(vehicle) then
385 if isElementWithinMarker(source, revenda1ss ) or isElementWithinMarker(source, revenda2ss ) or isElementWithinMarker(source, revenda3ss ) or isElementWithinMarker(source, revenda4ss ) then
386 local vehicle = getVehicleByID(id)
387
388 local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1)
389 if type(data) == "table" and #data ~= 0 then
390 local Money = math.ceil((data[1]["Cost"]*.9)*math.floor(data[1]["HP"])/100/10)
391 givePlayerMoney (source, Money)
392 if isElement(vehicle) then destroyElement(vehicle) end
393 dbExec(db, "DELETE FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id)
394 updateVehicleInfo(source)
395 outputChatBox("#FFFFFF| VEÍCULO | Você vendeu o seu veiculo por #0080FF$"..Money, source, 38, 122, 216, true)
396 end
397 else
398 outputChatBox("#FF0000| ERRO | Você não está em uma revenda!", source, 38, 122, 216, true)
399 end
400 else
401 outputChatBox("#FF0000| ERRO | Este veículo não está conectado!", source, 38, 122, 216, true)
402 end
403end)
404
405function getDataOnLogin(_, account)
406 updateVehicleInfo(source)
407end
408addEventHandler("onPlayerLogin", root, getDataOnLogin)
409
410function SaveVehicleDataOnQuit()
411 for i, veh in ipairs (getElementsByType("vehicle")) do
412 if getElementData(veh, "Owner") == source then
413 destroyVehicle(veh)
414 end
415 end
416end
417addEventHandler("onPlayerQuit", root,SaveVehicleDataOnQuit)
418
419
420addEvent("inviteToBuyCarSended", true)
421addEventHandler("inviteToBuyCarSended", root,
422function(player, price, veh_name, veh_id)
423 if player and price and veh_name and veh_id then
424 local pl = getPlayerFromName ( player )
425 if pl then
426 triggerClientEvent ( pl, "recieveInviteToBuyCar", pl, getPlayerName (source), getAccountName(getPlayerAccount(source)), price, veh_name, veh_id )
427 else
428 -- outputMessage ( "#c1c1c1O jogador não foi encontrado, a venda foi cancelada", source, 250, 10, 10, true)
429 triggerClientEvent ( source, "cleanCarInvitations", source )
430 end
431 end
432end)
433
434
435addEvent("invitationBuyCarNotAccepted", true)
436addEventHandler("invitationBuyCarNotAccepted", root,
437function(player, acc, price, veh_name, veh_id)
438 local pl = getPlayerFromName ( player )
439 if pl then
440 triggerClientEvent ( pl, "cleanCarInvitations", pl )
441 -- outputMessage ( "#c1c1c1O jogador recusou-se a comprar o seu carro", pl, 250, 10, 10,true)
442 end
443end)
444
445addEvent("invitationBuyCarAccepted", true)
446addEventHandler("invitationBuyCarAccepted", root,
447function(player, acc, price, veh_name, veh_id)
448 local pl = getPlayerFromName ( player )
449 local avail = false
450 if pl and getAccountName ( getPlayerAccount (pl)) == acc then
451 avail = true
452 triggerClientEvent ( pl, "cleanCarInvitations", pl )
453 ---- outputMessage ( "Игрок отказался покупать ваше авто", pl, 250, 10, 10)
454 else
455 for i, v in ipairs( getElementsByType ( 'player' ) ) do
456 if getAccountName(getPlayerAccount ( v )) == acc then
457 avail = true
458 pl = v
459 break
460 end
461 end
462 end
463 price = tonumber(price) or 0
464 if avail then
465 if isGuestAccount ( getPlayerAccount ( source ) ) then
466 triggerClientEvent ( pl, "cleanCarInvitations", pl )
467 -- outputMessage ( "#c1c1c1Você não está logado em sua conta, a transação foi cancelada", source, 250, 10, 10,true )
468 -- outputMessage ( "#c1c1c1O jogador não entrou na conta, a transação foi cancelada", pl, 250, 10, 10,true )
469 return true
470 end
471 if getPlayerMoney ( source ) >= price then
472 local vehicle = getVehicleByID(tonumber(veh_id))
473 local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(pl)), veh_id), -1)
474 if type(data) == "table" and #data ~= 0 and isElement ( vehicle ) then
475 givePlayerMoney ( pl, price )
476 takePlayerMoney ( source, price )
477 dbExec(db, "UPDATE VehicleList SET Account = ? WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), getAccountName(getPlayerAccount(pl)), veh_id)
478 updateVehicleInfo(source)
479 updateVehicleInfo(pl)
480 setElementData(vehicle, "Owner", source)
481
482 setElementData(vehicle, "ownercar", getAccountName(getPlayerAccount(source)))
483 -- outputMessage("#c1c1c1Você vendeu o seu veiculo por #00FF66$"..price, pl, 38, 122, 216, true)
484 -- outputMessage("#c1c1c1Você comprou um carro por #00FF66$"..price, source, 38, 122, 216, true)
485
486
487 triggerClientEvent ( pl, "cleanCarInvitations", pl )
488 else
489 -- outputMessage ( "#c1c1c1A máquina não pode ser encontrado, o negócio é cancelado", source, 250, 10, 10,true )
490 -- outputMessage ( "#c1c1c1A máquina não pode ser encontrado, o negócio é cancelado. Tente carro desova.", pl, 250, 10, 10,true )
491 triggerClientEvent ( pl, "cleanCarInvitations", pl )
492 end
493 else
494 -- outputMessage ( "#c1c1c1Você não tem dinheiro suficiente, a transação foi cancelada", source, 250, 10, 10,true )
495 end
496 else
497 -- outputMessage ( "#c1c1c1O jogador não foi encontrado, a operação foi cancelada", source, 250, 10, 10,true)
498 end
499end)
500
501
502
503
504
505local predefinedHandling = {
506 [451] = {
507 ["maxVelocity"] = 250
508 },
509
510 --next model below etc (copy rows)
511}
512
513for i,v in pairs (predefinedHandling) do
514 if i then
515 for handling, value in pairs (v) do
516 if not setModelHandling (i, handling, value) then
517 outputDebugString ("* Predefined handling '"..tostring(handling).."' for vehicle model '"..tostring(i).."' could not be set to '"..tostring(value).."'")
518 end
519 end
520 end
521end
522
523for _,v in ipairs (getElementsByType("vehicle")) do
524 if v and predefinedHandling[getElementModel(v)] then
525 for k,vl in pairs (predefinedHandling[getElementModel(v)]) do
526 setVehicleHandling (v, k, vl)
527 end
528 end
529end
530
531function resetHandling()
532 for model in pairs (predefinedHandling) do
533 if model then
534 for k in pairs(getOriginalHandling(model)) do
535 setModelHandling(model, k, nil)
536 end
537 end
538 end
539
540 for _,v in ipairs (getElementsByType("vehicle")) do
541 if v then
542 local model = getElementModel(v)
543 if predefinedHandling[model] then
544 for k,h in pairs(getOriginalHandling(model)) do
545 setVehicleHandling(v, k, h)
546 end
547 end
548 end
549 end
550end
551addEventHandler("onResourceStop", resourceRoot, resetHandling)