local a=[[ ESX = nil IsCanLock = true vehicle = nil Citizen.CreateThread(function() while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Citizen.Wait(500) end end) Citizen.CreateThread(function() while true do Citizen.Wait(10) local player = PlayerPedId() local coords = GetEntityCoords(player) local entityWorld = GetOffsetFromEntityInWorldCoords(player, 0.0, 10, 0.0) local rayHandle = CastRayPointToPoint(coords["x"], coords["y"], coords["z"], entityWorld.x, entityWorld.y, entityWorld.z, 10, ply, 0) local a, b, c, d, targetVehicle = GetRaycastResult(rayHandle) if (targetVehicle ~= nil and targetVehicle ~= 0) then vehicle = targetVehicle else vehicle = ESX.Game.GetClosestVehicle(coords) end if IsDisabledControlJustReleased(1, Config.settings.key) then ESX.TriggerServerCallback('nox_carlock:isVehicleOwner', function(owner) if owner then LockVehicle(ESX.Math.Trim(GetVehicleNumberPlateText(vehicle))) else ESX.SendNotification(Config['settings']["translate"]["no_car"]) end end, ESX.Math.Trim(GetVehicleNumberPlateText(vehicle))) end end end) function LockVehicle(plate) if IsCanLock == true then IsCanLock = false local coords = GetEntityCoords(GetPlayerPed(-1)) if IsPedInAnyVehicle(PlayerPedId(), true) == false then cars = ESX.Game.GetVehiclesInArea(coords, Config['settings']['remote_range']) else cars = ESX.Game.GetVehiclesInArea(coords, 0.5) end local carstrie = {} local cars_dist = {} notowned = 0 if #cars == 0 then else for j=1, #cars, 1 do local coordscar = GetEntityCoords(cars[j]) local distance = Vdist(coordscar.x, coordscar.y, coordscar.z, coords.x, coords.y, coords.z) table.insert(cars_dist, {cars[j], distance}) end for k=1, #cars_dist, 1 do local z = -1 local distance, car = 999 for l=1, #cars_dist, 1 do if cars_dist[l][2] < distance then distance = cars_dist[l][2] car = cars_dist[l][1] z = l end end if z ~= -1 then table.remove(cars_dist, z) table.insert(carstrie, car) end end for i=1, #carstrie, 1 do local plates = ESX.Math.Trim(GetVehicleNumberPlateText(carstrie[i])) if plates == plate then lockAnimation() local lock = GetVehicleDoorLockStatus(carstrie[i]) if lock == 1 or lock == 0 then SetVehicleDoorShut(carstrie[i], 0, false) SetVehicleDoorShut(carstrie[i], 1, false) SetVehicleDoorShut(carstrie[i], 2, false) SetVehicleDoorShut(carstrie[i], 3, false) SetVehicleDoorsLocked(carstrie[i], 2) SetVehicleDoorsLockedForAllPlayers(carstrie[i], true) TriggerServerEvent("InteractSound_SV:PlayWithinDistance", 10, "car-lock", 0.5) --TriggerServerEvent("nox_carlock:lockcar", plate) LOCK_CAR(carstrie[i]) elseif lock == 2 then SetVehicleDoorsLocked(carstrie[i], 1) SetVehicleDoorsLockedForAllPlayers(carstrie[i], false) TriggerServerEvent("InteractSound_SV:PlayWithinDistance", 10, "car-lock", 0.5) --TriggerServerEvent("nox_carlock:unlockcar", plate) UN_LOCK_CAR(carstrie[i]) end break end end end Citizen.Wait(100) IsCanLock = true end end function UN_LOCK_CAR(vehicle) SetVehicleLights(vehicle, 2) Wait (400) SetVehicleLights(vehicle, 0) Wait (400) SetVehicleLights(vehicle, 2) Wait (400) SetVehicleLights(vehicle, 0) end function LOCK_CAR(vehicle) SetVehicleLights(vehicle, 2) Wait (400) SetVehicleLights(vehicle, 0) end lockAnimation = function() if IsPedInAnyVehicle(PlayerPedId(), true) == false then local dict, anim = "anim@mp_player_intmenu@key_fob@", "fob_click_fp" RequestAnimDict(dict) while not HasAnimDictLoaded(dict) do Citizen.Wait(0) end if not IsPedInAnyVehicle(PlayerPedId(), true) then TaskPlayAnim(PlayerPedId(), dict, anim, 8.0, 8.0, -1, 48, 1, false, false, false) end Citizen.Wait(900) ClearPedSecondaryTask(PlayerPedId()) end end if (Config['settings']['disablecar_npc']) then Citizen.CreateThread(function() while true do Citizen.Wait(0) local ped = GetPlayerPed(-1) if DoesEntityExist(GetVehiclePedIsTryingToEnter(PlayerPedId(ped))) then local veh = GetVehiclePedIsTryingToEnter(PlayerPedId(ped)) local lock = GetVehicleDoorLockStatus(veh) if lock == 7 then SetVehicleDoorsLocked(veh, 2) end local pedd = GetPedInVehicleSeat(veh, -1) if pedd then SetPedCanBeDraggedOut(pedd, false) end end end end) end ]] a="11111"..a;function Obfuscate(b)local c="function IllIlllIllIlllIlllIlllIll(IllIlllIllIllIll) if (IllIlllIllIllIll==(((((919 + 636)-636)*3147)/3147)+919)) then return not true end if (IllIlllIllIllIll==(((((968 + 670)-670)*3315)/3315)+968)) then return not false end end; "local d=c;local e=""local f={"IllIllIllIllI","IIlllIIlllIIlllIIlllII","IIllllIIllll"}local g=[[local IlIlIlIlIlIlIlIlII = {]]local h=[[local IllIIllIIllIII = loadstring]]local i=[[local IllIIIllIIIIllI = table.concat]]local j=[[local IIIIIIIIllllllllIIIIIIII = "''"]]local k="local "..f[math.random(1,#f)].." = (7*3-9/9+3*2/0+3*3);"local l="local "..f[math.random(1,#f)].." = (3*4-7/7+6*4/3+9*9);"local m="--// Obfuscated with LuaSeel 1.1 \n\n"for n=1,string.len(b)do e=e.."'\\"..string.byte(b,n).."',"end;local o="function IllIIIIllIIIIIl("..f[math.random(1,#f)]..")"local p="function "..f[math.random(1,#f)].."("..f[math.random(1,#f)]..")"local q="local "..f[math.random(1,#f)].." = (5*3-2/8+9*2/9+8*3)"local r="end"local s="IllIIIIllIIIIIl(900283)"local t="function IllIlllIllIlllIlllIlllIllIlllIIIlll("..f[math.random(1,#f)]..")"local q="function "..f[math.random(1,#f)].."("..f[math.random(1,#f)]..")"local u="local "..f[math.random(1,#f)].." = (9*0-7/5+3*1/3+8*2)"local v="end"local w="IllIlllIllIlllIlllIlllIllIlllIIIlll(9083)"local x=m..d..k..l..i..";"..o.." "..p.." "..q.." "..r.." "..r.." "..r..";"..s..";"..t.." "..q.." "..u.." "..v.." "..v..";"..w..";"..h..";"..g..e.."}".."IllIIllIIllIII(IllIIIllIIIIllI(IlIlIlIlIlIlIlIlII,IIIIIIIIllllllllIIIIIIII))()"print(x)end;do Obfuscate(a)end
Write, Run & Share Lua code online using OneCompiler's Lua online compiler for free. It's one of the robust, feature-rich online compilers for Lua language, running the latest Lua version 5.4. Getting started with the OneCompiler's Lua editor is easy and fast. The editor shows sample boilerplate code when you choose language as Lua and start coding.
OneCompiler's Lua online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample Lua program which takes name as input and prints hello message with your name.
name = io.read("*a")
print ("Hello ", name)
Lua is a light weight embeddable scripting language which is built on top of C. It is used in almost all kind of applications like games, web applications, mobile applications, image processing etc. It's a very powerful, fast, easy to learn, open-source scripting language.
-- global variables
a = 10
-- local variables
local x = 30
Value Type | Description |
---|---|
number | Represents numbers |
string | Represents text |
nil | Differentiates values whether it has data or not |
boolean | Value can be either true or false |
function | Represents a sub-routine |
userdata | Represents arbitary C data |
thread | Represents independent threads of execution. |
table | Can hold any value except nil |
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while(condition)
do
--code
end
Repeat-Until is also used to iterate a set of statements based on a condition. It is very similar to Do-While, it is mostly used when you need to execute the statements atleast once.
repeat
--code
until( condition )
For loop is used to iterate a set of statements based on a condition.
for init,max/min value, increment
do
--code
end
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increase re-usuability and modularity.
optional_function_scope function function_name( argument1, argument2, argument3........, argumentn)
--code
return params with comma seperated
end