Price
UnknownA script by sModsk
Price
Unknown
Preview Video
Discord Support
Tebex
Try it before buy it
3 Different minigames
This is a standalone script, and you can use it easily with exports.
*Server*
exports["smodsk_laptop"]:CreateLaptop(uniqueId, rules)
exports["smodsk_laptop"]:LockLaptop(uniqueId)
exports["smodsk_laptop"]:ResetLaptop(uniqueId)
** Client **
exports["smodsk_laptop"]:EnterZone(uniqueId, rules)
exports["smodsk_laptop"]:ExitZone()
exports["smodsk_laptop"]:StartHack(uniqueId, laptopEntity, function(success)
-- This will be executed as soon as the player fails or succeeds --
-- If successful, a loading bar will appear on screen and it takes rules.executionTime to be ready --
if success then
Wait(rules.executionTime * 1000)
-- Make your magic
else
-- Failure handling code here
end
end)
exapleRules = {
propName = "prop_laptop_lester2", -- Check working laptops from smodsk_laptop/config/screens.lua
name = "My Pc", -- The title displayed on the screen during the screensaver sequence
executionTime = 5, -- Duration (in seconds) it takes for the progress bar to fill completely
successText = {"Syncing Detonator", "Detonator Synced"}, -- Text messages shown under the progress bar during and after syncing
cooldown = 60, -- How long (in seconds) computer is cooldown after used
games = {
--[[ Games Configuration:
Available Games:
1 = FLAPPY HACKER
2 = SPACE HACKER
3 = SNAKE HACKER
Configuring Games:
You can add specific games by including their indices or leave `games` nil or an empty array to include all games.
Game Settings for Each Index:
[1-3] = {
difficulty = 1-3, -- Game difficulty level, affects game speed (1 = easiest, 3 = hardest) -- Optional
password = "Any string up to 12 characters", -- Optional
lives = 1-3 -- Number of lives the player has for the game -- Optional
}
]]
[1] = {}, -- Game 1: Settings for this game are randomized for difficulty and password
[2] = {difficulty = 1}, -- Game 2: Difficulty is set to level 1, password is randomized
[3] = {
difficulty = 3, -- Game 3: Difficulty level is set to the hardest (3)
password = "PASSWORD" -- Custom password
},
}
}
zones = {
["laptop1"] = {
rules = {
propName = "xm_prop_x17_laptop_agent14_01",
name = "All Games",
executionTime = 2,
successText = {"Syncing Detonator", "Detonator Synced"},
cooldown = 10,
games = {
[1] = {password="FLAPPY"},
[2] = {password="SPACE", lives = 1},
[3] = {password="SNAKE"},
}
},
--- props --
position = vec3(-947.036, -2981.985, 13.945),
radius = 10,
propsPos = vec3(-941.403, -2971.431, 12.945),
laptop = {
pos = vec4(-947.036, -2981.985, 13.82, 329.334),
--name = "prop_laptop_lester2", --
name = "xm_prop_x17_laptop_agent14_01",
},
barrel = {
pos = vec4(-947.036, -2981.985, 12.945, 329.334),
name = "prop_barrel_exp_01a",
},
propNames = {
"prop_cs_rub_box_01"
}
},
["laptop2"] = {
rules = {
propName = "prop_laptop_lester2",
name = "FLAPPY HACKER",
executionTime = 5, -- seconds
cooldown = 10,
successText = {"Syncing Detonator", "Detonator Synced"},
games = {
[1] = {}
}
},
position = vec3(-958.214, -3000.084, 13.945),
radius = 10,
propsPos = vec3(-964.186, -3010.591, 12.945),
laptop = {
pos = vec4(-958.214, -3000.084, 13.82, 147.522),
name = "prop_laptop_lester2",
},
barrel = {
pos = vec4(-958.214, -3000.084, 12.945, 147.522),
name = "prop_barrel_exp_01a",
},
propNames = {
"prop_cs_rub_box_01"
}
},
["laptop3"] = {
rules = {
propName = "p_laptop_02_s",
name = "SPACE HACKER",
executionTime = 5, -- seconds
successText = {"Syncing Detonator", "Detonator Synced"},
cooldown = 10,
games = {
[2] = {}
}
},
position = vec3(-965.153, -2971.832, 13.945),
radius = 10,
propsPos = vec3(-959.609, -2961.504, 12.945),
laptop = {
pos = vec4(-965.153, -2971.832, 13.82, 330.441),
name = "p_laptop_02_s",
},
barrel = {
pos = vec4(-965.153, -2971.832, 12.945, 330.441),
name = "prop_barrel_exp_01a",
},
propNames = {
"prop_cs_rub_box_01"
}
},
["laptop4"] = {
rules = {
propName = "xm_prop_x17_laptop_agent14_01",
name = "SNAKE HACKER",
executionTime = 5, -- seconds
successText = {"Syncing Detonator", "Detonator Synced"},
cooldown = 10,
games = {
[3] = {}
}
},
position = vec3(-976.269, -2989.494, 13.945),
radius = 10,
propsPos = vec3(-982.449, -3000.557, 12.945),
laptop = {
pos = vec4(-976.269, -2989.494, 13.82, 154.563),
name = "xm_prop_x17_laptop_agent14_01",
},
barrel = {
pos = vec4(-976.269, -2989.494, 12.945, 154.563),
name = "prop_barrel_exp_01a",
},
propNames = {
"prop_cs_rub_box_01"
}
},
}
AddEventHandler("uselaptop:explosion", function(data)
local rules = zones[data.id].rules
exports["smodsk_laptop"]:StartHack(data.id, data.entity, function(success)
-- This will be executed as soon as the player fails or succeeds --
-- If success then "loading bar will come on screen and it takes rules.executionTime to be ready" --
if (success) then
Wait(rules.executionTime * 1000)
TriggerServerEvent("smodsk_laptopExample:explosion", data.id)
else
end
end)
end)
function onEnter(data)
-- Passes the rules when a player enters the zone, ensuring everyone sees the same text --
-- Game rules may still vary for each player individually --
exports["smodsk_laptop"]:EnterZone(data.zoneId, zones[data.zoneId].rules)
end
function onExit(data)
exports["smodsk_laptop"]:ExitZone()
end
function RegisterLaptop(id, laptop)
if(GetResourceState("ox_target") ~= "missing") then
exports['ox_target']:addLocalEntity(laptop,
{
event = "uselaptop:explosion",
icon = "fa-solid fa-arrow-right",
label = "Use",
id = id,
canInteract = function(_, distance) return distance < 3.5 end
})
elseif(GetResourceState("qb-target") ~= "missing") then
exports['qb-target']:AddTargetEntity(laptop, {
options = {
{
name = "uselaptop:explosion",
icon = 'fa-solid fa-coins',
label = "Use",
action = function(resp)
TriggerEvent("uselaptop:explosion", {id = id, entity = laptop})
end,
canInteract = function(entity)
return true
end
}
},
distance = 3.5
})
end
end
function RegisterZones()
for k,v in pairs(zones) do
print("Register Zones",k)
if (GetResourceState("ox_lib") ~= "missing") then
zones[k].zone = lib.zones.sphere({
coords = v.position,
radius = v.radius,
onEnter = onEnter,
onExit = onExit,
zoneId = k
})
elseif (GetResourceState("PolyZone") ~= "missing") then
zones[k].zone = CircleZone:Create(v.position, v.radius, {
debugPoly = false,
useZ = false,
})
zones[k].zone:onPlayerInOut(function(isInside)
if isInside then onEnter({zoneId = k}) else onExit() end
end)
end
end
end
RegisterNetEvent("smodsk_laptopExample:explosion", function(id)
print("smodsk_laptopExample:explosion")
local zone = zones[id]
local x, y, z = table.unpack(zone.propsPos)
local damageScale = 15
AddExplosion(x, y, z, 2, 15.0, true, false, 1.0)
end)
local function createProps()
for k, v in pairs(zones) do
local x, y, z = table.unpack(v.propsPos)
-- Create barrel object
v.barrel.prop = CreateObject(GetHashKey(v.barrel.name), v.barrel.pos.x, v.barrel.pos.y, v.barrel.pos.z, false, false, false)
FreezeEntityPosition(v.barrel.prop, true)
SetEntityHeading(v.barrel.prop, v.barrel.pos.w)
-- Create laptop object
v.laptop.prop = CreateObject(GetHashKey(v.laptop.name), v.laptop.pos.x, v.laptop.pos.y, v.laptop.pos.z, false, false, false)
SetEntityHeading(v.laptop.prop, v.laptop.pos.w) -- Set laptop heading
FreezeEntityPosition(v.laptop.prop, true)
RegisterLaptop(k, v.laptop.prop) -- Register the laptop prop
v.props = {} -- Initialize props array for the zone
-- Create random props around the zone
for i = 1, 5 do
local propName = v.propNames[math.random(1, #v.propNames)]
local prop = CreateObject(GetHashKey(propName), x + math.random(-1, 1), y + math.random(-1, 1), z, false, false, false)
SetEntityDynamic(prop, true)
PlaceObjectOnGroundProperly(prop)
table.insert(v.props, prop)
end
end
end
AddEventHandler('onResourceStop', function(resourceName)
if GetCurrentResourceName() ~= resourceName then
return
end
for k,v in pairs(zones) do
if DoesEntityExist(v.laptop.prop) then DeleteEntity(v.laptop.prop) end
if DoesEntityExist(v.barrel.prop) then DeleteEntity(v.barrel.prop) end
for k, prop in pairs(v.props) do
if DoesEntityExist(prop) then
DeleteEntity(prop)
end
end
end
end)
RegisterZones()
createProps()
RegisterServerEvent("smodsk_laptopExample:explosion", function(id)
TriggerClientEvent("smodsk_laptopExample:explosion", -1, id)
end)
-- CreateLaptop function for initializing laptops in each zone --
-- This is required if custom cooldowns are used --
CreateThread(function()
-- Check if the "smodsk_laptop" resource is running before creating laptops --
if GetResourceState("smodsk_laptop") == "started" then
-- Loop through all defined zones and create a laptop in each one --
for k, v in pairs(zones) do
-- Call the CreateLaptop function from the "smodsk_laptop" resource for each zone --
exports["smodsk_laptop"]:CreateLaptop(k, v.rules)
end
end
end)
| Code is accessible | Partly |
| Subscription-based | No |
| Lines (approximately) | +500 |
| Requirements | Standalone |
| Support | Yes |
See what others are saying about this script.
Share your experience and help others.