Skip to content

Commit

Permalink
part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuzkay authored Dec 15, 2019
1 parent 03359f0 commit 9540316
Show file tree
Hide file tree
Showing 79 changed files with 23,921 additions and 0 deletions.
96 changes: 96 additions & 0 deletions OKAYY Framework Basic/kuz_ActionZones/client.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
local timer = 0

function OnPackageStart()
timer = CreateTimer(Refresh, 500)
end
AddEvent("OnPackageStart", OnPackageStart)

local cooldown = false
local action = nil
local attr = nil
local callType = nil
function OnKeyPress(key)
if key == "E" and action ~= nil and not cooldown and not GetPlayerPropertyValue(GetPlayerId(), 'cuffed') and not GetPlayerPropertyValue(GetPlayerId(), 'dead') then

if callType == nil or callType == "server" then
if attr ~= nil then
CallRemoteEvent(action, attr)
else
CallRemoteEvent(action)
end
else
if attr ~= nil then
CallEvent(action, attr)
else
CallEvent(action)
end
end
cooldown = true
Delay(1000, function()
cooldown = false
end)
end
end
AddEvent("OnKeyPress", OnKeyPress)



local last = false
function Refresh()
local got = false


local pickups = GetStreamedPickups()
local x,y,z = GetPlayerLocation()
for k,v in pairs(pickups) do
if GetPickupPropertyValue(v, "action") ~= nil then
local px,py,pz = GetPickupLocation(v)
if GetDistance3D(x,y,z,px,py,pz) <= GetPickupPropertyValue(v, "action_range") then
got = true
action = GetPickupPropertyValue(v, "action")

if GetPickupPropertyValue(v, "action_attr") ~= nil then
attr = GetPickupPropertyValue(v, "action_attr")
end

if GetPickupPropertyValue(v, "action_type") ~= nil then
callType = GetPickupPropertyValue(v, "action_type")
end

CallEvent("KNotify:SendPress", GetPickupPropertyValue(v, "action_text"))
end
end
end


local objects = GetStreamedObjects()
local x,y,z = GetPlayerLocation()
for k,v in pairs(objects) do
if GetObjectPropertyValue(v, "action") ~= nil then
local px,py,pz = GetObjectLocation(v)
if GetDistance3D(x,y,z,px,py,pz) <= GetObjectPropertyValue(v, "action_range") then
got = true
action = GetObjectPropertyValue(v, "action")

if GetObjectPropertyValue(v, "action_attr") ~= nil then
attr = GetObjectPropertyValue(v, "action_attr")
end

if GetObjectPropertyValue(v, "action_type") ~= nil then
callType = GetObjectPropertyValue(v, "action_type")
end

CallEvent("KNotify:SendPress", GetObjectPropertyValue(v, "action_text"))
end
end
end

if not got and last then
CallEvent("KNotify:HidePress")
action = nil
attr = 0
callType = nil
end
last = got

end
9 changes: 9 additions & 0 deletions OKAYY Framework Basic/kuz_ActionZones/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"author": "Kuzkay",
"version": "1.0",
"server_scripts": [],
"client_scripts": [
"client.lua"
],
"files": []
}
103 changes: 103 additions & 0 deletions OKAYY Framework Basic/kuz_Essentials/atm/client.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
local ui = 0
local inside = false
local last_check = false
local refreshTimer = 0

local Atms = nil

local atmOpen = false

local bank = 0
local cash = 0

function AtmLoadedPlayer()
Delay(3000, function ()
ui = Gui_main
Atms = Atm.atms
ExecuteWebJS(ui, "SetFields('"..bank.."','"..cash.."');")
refreshTimer = CreateTimer(CheckInAtm, 100)
end)
end
AddRemoteEvent("Kuzkay:LoadingComplete", AtmLoadedPlayer)

function OpenAtm()
atmOpen = true
ExecuteWebJS(ui, "SetAmount('"..math.floor(cash).."');")
ExecuteWebJS(ui, "ToggleAtm(true);")
SetWebVisibility(ui, WEB_VISIBLE)
SetIgnoreLookInput(true)
SetIgnoreMoveInput(true)
ShowMouseCursor(true)
SetInputMode(INPUT_GAMEANDUI)
end
AddRemoteEvent('Kuzkay:AtmOpenUI', OpenAtm)

function CloseAtm()
atmOpen = false
ExecuteWebJS(ui, "ToggleAtm(false);")
SetWebVisibility(ui, WEB_HITINVISIBLE)
SetIgnoreLookInput(false)
SetIgnoreMoveInput(false)
ShowMouseCursor(false)
SetInputMode(INPUT_GAME)
end
AddRemoteEvent('Kuzkay:AtmCloseUI', CloseAtm)

function CheckInAtm()

inside = false
local x,y,z = GetPlayerLocation()
local distance = 0

local currentAtm = 0

local i = 1
for _ in pairs(Atms) do
if not inside then
if GetDistance3D(x,y,z,Atms[i].x, Atms[i].y, Atms[i].z) <= 120 then
distance = GetDistance3D(x,y,z,Atms[i].x, Atms[i].y, Atms[i].z)
inside = true

CallEvent("KNotify:SendPress", "Press [E] to open atm")

currentAtm = i
end
end
i = i + 1
end

if not inside or IsPlayerInVehicle() then
if atmOpen then
CloseAtm()
end
end
if last_check and not inside then
CallEvent("KNotify:HidePress")
end
last_check = inside
end

function OnKeyPress(key)
if key == "E" and inside and not GetPlayerPropertyValue(GetPlayerId(), 'cuffed') and not GetPlayerPropertyValue(GetPlayerId(), 'dead') then
if atmOpen then
CloseAtm()
else
OpenAtm()
end
end
end
AddEvent("OnKeyPress", OnKeyPress)

AddEvent("Kuzkay:OnWithdraw", function (amount)
CallRemoteEvent("Kuzkay:AtmWithdraw", amount)
end)
AddEvent("Kuzkay:OnDeposit", function (amount)
CallRemoteEvent("Kuzkay:AtmDeposit", amount)
end)

function UpdateAtmData(money_, bank_, role, level, experience)
bank = bank_
cash = money_
ExecuteWebJS(ui, "SetFields('"..math.floor(bank).."','"..math.floor(cash).."');")
end
AddRemoteEvent("Kuzkay:UpdateVisualData", UpdateAtmData)
21 changes: 21 additions & 0 deletions OKAYY Framework Basic/kuz_Essentials/atm/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Atm = {}
Atm.atms = {}



Atm.atms = {

{x=-181944 ,y=-40246,z=1163},
{x=129099,y=77949,z=1576},
{x=-15091,y=-2416,z=2065},
{x=43783,y=133267,z=1569},
{x=42244,y=137938,z=1581},
{x=-189247,y=-51745,z=1148},
{x=212899,y=190039,z=1309},
{x=213426,y=190578,z=1309}

}




Loading

0 comments on commit 9540316

Please sign in to comment.