Skip to content

Commit

Permalink
Stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
TerbSEC committed Nov 3, 2019
1 parent 867ddbd commit d060c52
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 20 deletions.
70 changes: 53 additions & 17 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,20 @@ CreateThread(function()
anim = "back"
end
end
if IsControlJustPressed(0, 38) then
if IsControlJustPressed(0, objects.ButtonToLayOnBed) then
PlayAnimOnPlayer(objects.object,objects.ObjectVertX,objects.ObjectVertY,objects.ObjectVertZ,objects.OjbectDir, objects.isBed, player, objectcoords)
end
else
DrawText3Ds(objectcoords.x, objectcoords.y, objectcoords.z+0.30, Config.Text.SitOnChair)
if IsControlJustPressed(0, 58) then
if IsControlJustPressed(0, objects.ButtonToSitOnChair) then
PlayAnimOnPlayer(objects.object,objects.ObjectVertX,objects.ObjectVertY,objects.ObjectVertZ,objects.OjbectDir, objects.isBed, player, objectcoords)
end
end
end
if using == true then
Draw2DText("~g~F~w~ to stand up!",0,1,0.5,0.92,0.6,255,255,255,255)
Draw2DText(Config.Text.Standup,0,1,0.5,0.92,0.6,255,255,255,255)

if IsControlJustPressed(0, 23) or IsControlJustPressed(0, 48) or IsControlJustPressed(0, 20) then
if IsControlJustPressed(0, objects.ButtonToStandUp) then
ClearPedTasksImmediately(player)
using = false
local x,y,z = table.unpack(lastPos)
Expand Down Expand Up @@ -128,29 +128,65 @@ function PlayAnimOnPlayer(object,vertx,verty,vertz,dir, isBed, ped, objectcoords
FreezeEntityPosition(ped, true)
using = true
if isBed == false then
TaskStartScenarioAtPosition(ped, Config.objects.SitAnimation, objectcoords.x+vertx, objectcoords.y-verty, objectcoords.z-vertz, GetEntityHeading(object)+dir, 0, true, true)
else
if anim == "back" then

if Config.objects.SitAnimation.dict ~= nil then
SetEntityCoords(ped, objectcoords.x, objectcoords.y, objectcoords.z+0.5)
SetEntityHeading(ped, GetEntityHeading(object)-180.0)
local dict = Config.objects.BedBackAnimation.dict
local anim = Config.objects.BedBackAnimation.anim
local dict = Config.objects.SitAnimation.dict
local anim = Config.objects.SitAnimation.anim

RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do
Citizen.Wait(0)
AnimLoadDict(dict, anim, ped)
else
TaskStartScenarioAtPosition(ped, Config.objects.SitAnimation.anim, objectcoords.x+vertx, objectcoords.y+verty, objectcoords.z-vertz, GetEntityHeading(object)+dir, 0, true, true)
end
else
if anim == "back" then
if Config.objects.BedBackAnimation.dict ~= nil then
SetEntityCoords(ped, objectcoords.x, objectcoords.y, objectcoords.z+0.5)
SetEntityHeading(ped, GetEntityHeading(object)-180.0)
local dict = Config.objects.BedBackAnimation.dict
local anim = Config.objects.BedBackAnimation.anim

Animation(dict, anim, ped)
else
TaskStartScenarioAtPosition(ped, Config.objects.BedBackAnimation.anim, objectcoords.x+vertx, objectcoords.y+verty, objectcoords.z-vertz, GetEntityHeading(object)+dir, 0, true, true)
end

TaskPlayAnim(ped, dict , anim, 8.0, 1.0, -1, 1, 0, 0, 0, 0 )
elseif anim == "stomach" then
TaskStartScenarioAtPosition(ped, Config.objects.BedStomachAnimation, objectcoords.x+vertx, objectcoords.y+verty, objectcoords.z-vertz, GetEntityHeading(object)+dir, 0, true, true)
if Config.objects.BedStomachAnimation.dict ~= nil then
SetEntityCoords(ped, objectcoords.x, objectcoords.y, objectcoords.z+0.5)
SetEntityHeading(ped, GetEntityHeading(object)-180.0)
local dict = Config.objects.BedStomachAnimation.dict
local anim = Config.objects.BedStomachAnimation.anim

Animation(dict, anim, ped)
else
TaskStartScenarioAtPosition(ped, Config.objects.BedStomachAnimation.anim, objectcoords.x+vertx, objectcoords.y+verty, objectcoords.z-vertz, GetEntityHeading(object)+dir, 0, true, true)
end
elseif anim == "sit" then
TaskStartScenarioAtPosition(ped, Config.objects.BedSitAnimation, objectcoords.x+vertx, objectcoords.y+verty, objectcoords.z-vertz, GetEntityHeading(object)+180.0, 0, true, true)
if Config.objects.BedSitAnimation.dict ~= nil then
SetEntityCoords(ped, objectcoords.x, objectcoords.y, objectcoords.z+0.5)
SetEntityHeading(ped, GetEntityHeading(object)-180.0)
local dict = Config.objects.BedSitAnimation.dict
local anim = Config.objects.BedSitAnimation.anim

Animation(dict, anim, ped)
else
TaskStartScenarioAtPosition(ped, Config.objects.BedSitAnimation.anim, objectcoords.x+vertx, objectcoords.y+verty, objectcoords.z-vertz, GetEntityHeading(object)+dir, 0, true, true)
end

end
end
end

function Animation(dict, anim, ped)
RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do
Citizen.Wait(0)
end


TaskPlayAnim(ped, dict , anim, 8.0, 1.0, -1, 1, 0, 0, 0, 0 )
end




Expand Down
10 changes: 7 additions & 3 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ Config.Healing = 3 -- // If this is 0, then its disabled.. Default: 3.. That mea

Config.objects = {
object = nil, ObjectVertX = nil, ObjectVertY = nil, ObjectVertZ = nil, OjbectDir = nil, isBed = nil, -- // Please don't change this line!;)
SitAnimation = 'PROP_HUMAN_SEAT_CHAIR_MP_PLAYER',
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 = 'WORLD_HUMAN_SUNBATHE',
BedSitAnimation = 'WORLD_HUMAN_PICNIC',
BedStomachAnimation = {anim='WORLD_HUMAN_SUNBATHE'},
BedSitAnimation = {anim='WORLD_HUMAN_PICNIC'},
locations = {
{object="v_med_bed2", verticalOffsetX=0.0, verticalOffsetY=0.0, verticalOffsetZ=-1.4, direction=0.0, bed=true},
{object="v_serv_ct_chair02", verticalOffsetX=0.0, verticalOffsetY=0.0, verticalOffsetZ=-0.0, direction=168.0, bed=false},
Expand All @@ -27,4 +30,5 @@ Config.Text = {
SitOnBed = '~g~E~w~ to sit on the bed',
LieOnBed = '~g~E~w~ to lie on your',
SwitchBetween = '~w~ Switch between the stomach, back and sit with the ~g~arrow keys',
Standup = '~g~F~w~ to stand up!'
}

0 comments on commit d060c52

Please sign in to comment.