Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ Citizen.CreateThread(function()
else
DrawText3Ds(coordsObject.x, coordsObject.y, coordsObject.z, Config.Text.LieOnBed .. ' ~g~' .. Anim .. '~w~ | ' .. Config.Text.SwitchBetween)
end
if IsControlJustPressed(0, Config.objects.ButtonToLayOnBed) then
if IsControlJustPressed(0, Config.ButtonLayBed) then
TriggerServerEvent('ChairBedSystem:Server:Enter', current, coordsObject)
end
else
DrawText3Ds(coordsObject.x, coordsObject.y, coordsObject.z, Config.Text.SitOnChair)
if IsControlJustPressed(0, Config.objects.ButtonToSitOnChair) then
if IsControlJustPressed(0, Config.ButtonSitChair) then
TriggerServerEvent('ChairBedSystem:Server:Enter', current, coordsObject)
end
end
end

if (InUse) then
DrawText3Ds(coordsObject.x, coordsObject.y, coordsObject.z, Config.Text.Standup)
if IsControlJustPressed(0, Config.objects.ButtonToStandUp) then
if IsControlJustPressed(0, Config.ButtonStandUp) then
InUse = false
TriggerServerEvent('ChairBedSystem:Server:Leave', coordsObject)
ClearPedTasksImmediately(PlayerPed)
Expand Down
9 changes: 6 additions & 3 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

Config = {}

-- Default Keys (Refer to https://docs.fivem.net/game-references/controls/ for IDs)
Config.ButtonSitChair = 58
Config.ButtonLayBed = 38
Config.ButtonStandUp = 23

-- Objects for this script to work with
Config.objects = {
ButtonToSitOnChair = 58, -- // Default: G -- // https://docs.fivem.net/game-references/controls/
ButtonToLayOnBed = 38, -- // Default: E -- // https://docs.fivem.net/game-references/controls/
ButtonToStandUp = 23, -- // Default: F -- // https://docs.fivem.net/game-references/controls/
SitAnimation = {anim='PROP_HUMAN_SEAT_CHAIR_MP_PLAYER'},
BedBackAnimation = {dict='anim@gangops@morgue@table@', anim='ko_front'},
BedStomachAnimation = {anim='WORLD_HUMAN_SUNBATHE'},
Expand Down
7 changes: 3 additions & 4 deletions server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ AddEventHandler('playerDropped', function()
end
end)


-- Player lies down/sits on Object
RegisterServerEvent('ChairBedSystem:Server:Enter')
AddEventHandler('ChairBedSystem:Server:Enter', function(object, objectcoords)
local oSource = source
Expand All @@ -28,12 +28,11 @@ AddEventHandler('ChairBedSystem:Server:Enter', function(object, objectcoords)
end
end)


-- Player leaves Object
RegisterServerEvent('ChairBedSystem:Server:Leave')
AddEventHandler('ChairBedSystem:Server:Leave', function(objectcoords)
local oSource = source

oPlayerUse[oSource] = nil
oArray[objectcoords] = nil
end)

end)