- Decompiled Server.luac
local l_0_0 = {}
local l_0_1 = {}
local l_0_2 = {}
local l_0_3 = {}
local l_0_4 = {}
local l_0_5 = {}
addEventHandler("onPlayerQuit", root, function()
if isElement(source) and getElementData(source, "isOwner") ~= nil and getElementType(getElementData(source, "isOwner")) == "vehicle" then
destroyElement(getElementData(source, "isOwner"))
removeElementData(source, "isOwner")
if isTimer(l_0_0[source]) then
killTimer(l_0_0[source])
end
if isTimer(l_0_1[source]) then
killTimer(l_0_1[source])
end
if isElement(l_0_4[source]) then
destroyElement(l_0_4[source])
l_0_4[source] = nil
end
if isElement(l_0_5[source]) then
destroyElement(l_0_5[source])
l_0_5[source] = nil
end
end
end
)
createMyVehicle = function(l_2_0, l_2_1, l_2_2, l_2_3)
if l_2_0 and l_2_1 and l_2_2 and l_2_3 and not isGuestAccount(getPlayerAccount(source)) and getElementData(source, "isOwner") == nil then
local l_2_4 = getPlayerAccount(source)
local l_2_5 = getAccountName(l_2_4)
local l_2_6 = getPlayerName(source)
local l_2_7 = l_2_6:gsub("#%x%x%x%x%x%x", "")
theVehicle = createVehicle(l_2_0, l_2_1 + 2, l_2_2 + 2, l_2_3)
setVehicleDamageProof(theVehicle, true)
setElementData(source, "isOwner", theVehicle)
setElementData(theVehicle, "Owner", l_2_5)
setElementData(theVehicle, "OwnerName", l_2_7)
setElementData(theVehicle, "Locked", true)
return
end
if l_2_0 and l_2_1 and l_2_2 and l_2_3 then
local l_2_8 = getPedOccupiedVehicle(source)
local l_2_9 = getElementData(source, "isOwner")
if isPedInVehicle(source) and isElement(l_2_8) and isElement(l_2_9) and l_2_8 == l_2_9 then
setElementModel(l_2_9, l_2_0)
return
end
end
if l_2_0 and l_2_1 and l_2_2 and l_2_3 and not isGuestAccount(getPlayerAccount(source)) and getElementData(source, "isOwner") ~= nil then
local l_2_10 = getPlayerAccount(source)
local l_2_11 = getAccountName(l_2_10)
local l_2_12 = getPlayerName(source):gsub("#%x%x%x%x%x%x", "")
if isElement(getElementData(source, "isOwner")) then
destroyElement(getElementData(source, "isOwner"))
end
removeElementData(source, "isOwner")
theVehicle = createVehicle(l_2_0, l_2_1 + 2, l_2_2 + 2, l_2_3)
setVehicleDamageProof(theVehicle, true)
setElementData(source, "isOwner", theVehicle, true)
setElementData(theVehicle, "Owner", l_2_11)
setElementData(theVehicle, "OwnerName", l_2_12)
setElementData(theVehicle, "Locked", true)
end
end
addEvent("createVehicleFromGUI", true)
addEventHandler("createVehicleFromGUI", root, createMyVehicle)
addEventHandler("onVehicleStartEnter", root, function(l_3_0)
local l_3_1 = getElementData(source, "Owner")
local l_3_2 = getElementData(source, "Locked")
if l_3_1 and l_3_2 then
local l_3_3 = getPlayerAccount(l_3_0)
if getAccountName(l_3_3) ~= getElementData(source, "Owner") then
cancelEvent()
b = math.random(0, 255)
g = math.random(0, 255)
r = math.random(0, 255)
outputChatBox(" *[ Private car owned by " .. getElementData(source, "OwnerName") .. " ]", l_3_0, r, g, b, true)
else
b = math.random(0, 255)
g = math.random(0, 255)
r = math.random(0, 255)
outputChatBox(" *[ Welcome \226\152\186 ]", l_3_0, r, b, g, true)
end
end
end
)
addEvent("Spawn", true)
addEventHandler("Spawn", root, function()
local l_4_0, l_4_1, l_4_2 = getElementPosition(source)
local l_4_3 = getElementData(source, "isOwner")
if not isElement(l_4_3) then
outputChatBox(" *You do not have a car!", source, 255, 0, 0)
return
end
if l_4_3 and isElement(l_4_3) then
setElementPosition(getElementData(source, "isOwner"), l_4_0 + 2, l_4_1, l_4_2 + 1)
outputChatBox(" *Car Spawned.", source, 255, 0, 0)
end
end
)
addEvent("Warp", true)
addEventHandler("Warp", root, function()
local l_5_0 = getElementData(source, "isOwner")
if not isElement(l_5_0) then
outputChatBox(" *You do not have a car!", source, 255, 0, 0)
return
end
if l_5_0 and isElement(l_5_0) then
fadeCamera(source, false, 0.5)
setTimer(fadeCamera, 500, 1, source, true)
warpPedIntoVehicle(source, l_5_0)
end
end
)
addEvent("Destroy", true)
addEventHandler("Destroy", root, function()
local l_6_0 = getElementData(source, "isOwner")
if not isElement(l_6_0) then
outputChatBox(" *You do not have a car!", source, 255, 0, 0)
return
end
if l_6_0 and isElement(l_6_0) then
destroyElement(l_6_0)
outputChatBox(" *Car Destroyed.", source, 255, 0, 0)
removeElementData(source, "isOwner")
if isElement(l_0_5[source]) then
destroyElement(l_0_5[source])
l_0_5[source] = nil
end
if isElement(l_0_4[source]) then
destroyElement(l_0_4[source])
l_0_4[source] = nil
end
end
end
)
addEvent("Locks", true)
addEventHandler("Locks", root, function()
local l_7_0 = getElementData(source, "isOwner")
if not isElement(l_7_0) then
outputChatBox(" *You do not have a car!", source, 255, 0, 0)
return
end
if l_7_0 and isElement(l_7_0) then
local l_7_1 = getElementData(l_7_0, "Locked")
if l_7_1 == true then
removeElementData(l_7_0, "Locked")
outputChatBox(" *Car unlocked.", source, 255, 0, 0)
else
setElementData(l_7_0, "Locked", true)
outputChatBox(" *Car locked.", source, 0, 255, 0)
end
end
end
)
addEvent("Engine", true)
addEventHandler("Engine", root, function()
local l_8_0 = getElementData(source, "isOwner")
if not isElement(l_8_0) then
outputChatBox(" *You do not have a car!", source, 255, 0, 0)
return
end
if l_8_0 and isElement(l_8_0) then
local l_8_1 = getVehicleEngineState(l_8_0)
if not l_8_1 then
setVehicleEngineState(l_8_0, not l_8_1)
outputChatBox(" *Engine started.", source, 0, 255, 0)
else
setVehicleEngineState(l_8_0, not l_8_1)
outputChatBox(" *Engine stopped.", source, 255, 0, 0)
end
end
end
)
addEvent("Lights", true)
addEventHandler("Lights", root, function()
local l_9_0 = getElementData(source, "isOwner")
if not isElement(l_9_0) then
outputChatBox(" *You do not have a car!", source, 255, 0, 0)
return
end
if l_9_0 and isElement(l_9_0) then
local l_9_1 = getVehicleOverrideLights(l_9_0) == 2
if not l_9_1 then
setVehicleOverrideLights(l_9_0, 2)
outputChatBox(" *Lights On.", source, 0, 255, 0)
else
setVehicleOverrideLights(l_9_0, 1)
outputChatBox(" *Lights Off.", source, 255, 0, 0)
end
end
end
)
addEvent("Nitrous", true)
addEventHandler("Nitrous", root, function()
local l_10_0 = getElementData(source, "isOwner")
if not isElement(l_10_0) then
outputChatBox(" *You do not have a car!", source, 255, 0, 0)
return
end
if l_10_0 and isElement(l_10_0) then
addVehicleUpgrade(l_10_0, 1010)
outputChatBox(" *Nitrous upgrade has been added to your vehicle.", source, 0, 255, 0)
end
end
)
addEvent("Arrow", true)
addEventHandler("Arrow", root, function()
local l_11_0 = getElementData(source, "isOwner")
if not isElement(l_11_0) then
outputChatBox(" *You do not have a car!", source, 255, 0, 0)
return
end
if l_11_0 and isElement(l_11_0) then
if isElement(l_0_5[source]) then
destroyElement(l_0_5[source])
outputChatBox(" *The arrow has been removed from your vehicle.", source, 255, 0, 0)
else
local l_11_1, l_11_2, l_11_3 = getElementPosition(l_11_0)
l_0_5[source] = createObject(1318, l_11_1, l_11_2, l_11_3 + 2, 0, 0, 0)
attachElements(l_0_5[source], l_11_0, 0, 0, 2)
outputChatBox(" *The arrow has been attached to your vehicle.", source, 0, 255, 0)
end
end
end
)
addEvent("Colors", true)
addEventHandler("Colors", root, function()
local l_12_0 = getElementData(source, "isOwner")
if not isElement(l_12_0) then
outputChatBox(" *You do not have a car!", source, 255, 0, 0)
return
end
if l_12_0 and isElement(l_12_0) then
if not l_0_2[source] then
l_0_2[source] = true
l_0_0[source] = setTimer(randomVehColors, 1000, 0, l_12_0, source)
outputChatBox(" *Random colors is now enabled.", source, 0, 255, 0)
else
l_0_2[source] = false
if isTimer(l_0_0[source]) then
killTimer(l_0_0[source])
outputChatBox(" *Random colors is now disabled", source, 255, 0, 0)
end
end
end
end
)
randomVehColors = function(l_13_0, l_13_1)
if not isElement(l_13_0) and isElement(l_13_1) then
if isTimer(l_0_0[l_13_1]) then
killTimer(l_0_0[l_13_1])
end
l_0_2[l_13_1] = false
return
end
if isElement(l_13_0) then
local l_13_2 = math.random(0, 255)
local l_13_3 = math.random(0, 255)
local l_13_4 = math.random(0, 255)
local l_13_5 = math.random(0, 255)
setVehicleColor(l_13_0, l_13_2, l_13_3, l_13_4, l_13_5)
end
end
addEvent("Smoke", true)
addEventHandler("Smoke", root, function()
local l_14_0 = getElementData(source, "isOwner")
if not isElement(l_14_0) then
outputChatBox(" *You do not have a car!", source, 255, 0, 0)
return
end
if l_14_0 and isElement(l_14_0) and l_0_3[source] then
l_0_3[source] = false
if isTimer(l_0_1[source]) then
killTimer(l_0_1[source])
end
if isElement(l_0_4[source]) then
destroyElement(l_0_4[source])
l_0_4[source] = nil
end
outputChatBox(" *Smoke is now disabled.", source, 255, 0, 0)
return
end
if l_14_0 and isElement(l_14_0) and not l_0_3[source] then
l_0_3[source] = true
l_0_1[source] = setTimer(addSmoke, 1000, 0, l_14_0, source)
outputChatBox(" *Smoke is now enabled.", source, 0, 255, 0)
end
end
)
addSmoke = function(l_15_0, l_15_1)
if not isElement(l_15_0) and isElement(l_15_1) then
if isTimer(l_0_1[l_15_1]) then
killTimer(l_0_1[l_15_1])
end
if isElement(l_0_4[l_15_1]) then
destroyElement(l_0_4[l_15_1])
l_0_4[l_15_1] = nil
end
l_0_3[l_15_1] = false
return
end
local l_15_2 = getElementSpeed(l_15_0, "kmh")
if l_15_2 >= 120 then
local l_15_3, l_15_4, l_15_5 = getElementPosition(l_15_0)
if isElement(l_0_4[l_15_1]) then
return
end
l_0_4[l_15_1] = createObject(2780, l_15_3, l_15_4, l_15_5 - 2, 0, 0, 0)
setElementAlpha(l_0_4[l_15_1], 0)
attachElements(l_0_4[l_15_1], l_15_0, 0, -2, -1)
elseif isElement(l_0_4[l_15_1]) then
destroyElement(l_0_4[l_15_1])
l_0_4[l_15_1] = nil
end
end
addEvent("Armor", true)
addEventHandler("Armor", root, function()
if isElement(source) then
setPedArmor(source, 100)
outputChatBox("Your armor has been set to 100%.", source, 0, 255, 0)
end
end
)
addEvent("Health", true)
addEventHandler("Health", root, function()
if isElement(source) then
setElementHealth(source, 200)
outputChatBox("Your health has been set to 100%.", source, 0, 255, 0)
end
end
)
addEvent("SetFStyle", true)
addEventHandler("SetFStyle", root, function(l_18_0)
if isElement(source) and tonumber(l_18_0) then
setPedFightingStyle(source, tonumber(l_18_0))
end
end
)
addEvent("Stats", true)
addEventHandler("Stats", root, function()
if isElement(source) then
setPedStat(source, 23, 1000)
setPedStat(source, 24, 1000)
setPedStat(source, 69, 1000)
setPedStat(source, 70, 1000)
setPedStat(source, 71, 1000)
setPedStat(source, 72, 1000)
setPedStat(source, 73, 1000)
setPedStat(source, 74, 1000)
setPedStat(source, 75, 1000)
setPedStat(source, 76, 1000)
setPedStat(source, 77, 1000)
setPedStat(source, 78, 1000)
setPedStat(source, 79, 1000)
outputChatBox("Your weapon skills and max health has been set to maximum.", source, 0, 255, 0)
end
end
)
getElementSpeed = function(l_20_0, l_20_1)
if l_20_1 == nil then
l_20_1 = 0
end
if isElement(l_20_0) then
local l_20_2, l_20_3, l_20_4 = getElementVelocity(l_20_0)
if l_20_1 == "mph" or l_20_1 == 1 or l_20_1 == "1" then
return l_20_2 ^ 2 + l_20_3 ^ 2 + l_20_4 ^ 2 ^ 0.5 * 100
else
return l_20_2 ^ 2 + l_20_3 ^ 2 + l_20_4 ^ 2 ^ 0.5 * 1.61 * 100
end
else
outputDebugString("Not an element. Can't get speed")
return false
end
end
addEvent("status", true)
addEventHandler("status", root, function()
local l_21_0 = getPlayerAccount(source)
local l_21_1 = getAccountName(l_21_0)
if isObjectInACLGroup("user." .. l_21_1, aclGetGroup("Console")) then
triggerClientEvent(source, "status", source)
else
triggerClientEvent(source, "statusF", source)
end
end
)
open = function()
local l_21_0 = getPlayerAccount(source)
local l_21_1 = getAccountName(l_21_0)
if isObjectInACLGroup("user."..l_21_1, aclGetGroup("Console")) then else return end
triggerClientEvent(source, "showwindow", source)
end
end
addEvent("showwindow", true)
addEventHandler("showwindow", getRootElement(), open)