Initial commit
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
|
||||
local isNearExersices = false
|
||||
local isAtExersice = false
|
||||
local isTraining = false
|
||||
|
||||
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
if Config.EnableBlip then
|
||||
local blip = AddBlipForCoord( Config.MapBlip.Pos.x, Config.MapBlip.Pos.y, Config.MapBlip.Pos.z)
|
||||
SetBlipSprite (blip, Config.MapBlip.Sprite)
|
||||
SetBlipDisplay(blip, Config.MapBlip.Display)
|
||||
SetBlipScale (blip, Config.MapBlip.Scale)
|
||||
SetBlipColour (blip, Config.MapBlip.Colour)
|
||||
SetBlipAsShortRange(blip, true)
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString(Config.MapBlip.Name)
|
||||
EndTextCommandSetBlipName(blip)
|
||||
end
|
||||
|
||||
while true do
|
||||
Citizen.Wait(350)
|
||||
local playerPed = PlayerPedId()
|
||||
local playerCoords = GetEntityCoords(GetPlayerPed(-1), false)
|
||||
|
||||
isNearExersices = false
|
||||
isAtExersice = false
|
||||
|
||||
for k, v in pairs(Config.Exersices) do
|
||||
local distance = Vdist(playerCoords, v.x, v.y, v.z)
|
||||
if distance < 20.0 then
|
||||
isNearExersices = true
|
||||
end
|
||||
if distance < 0.6 then
|
||||
isAtExersice = true
|
||||
currentExersice = v
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
if isNearExersices then
|
||||
for k, v in pairs(Config.Exersices) do
|
||||
DrawMarker(21, v.x, v.y, v.z, 0, 0, 0, 0, 0, 0, 0.301, 0.301, 0.3001, 0, 153, 55, 55, 0, 0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
if isAtExersice then
|
||||
if not isTraining then
|
||||
showInfobar(Config.ExersiceString .. '~y~' .. currentExersice.type)
|
||||
else
|
||||
showInfobar(Config.AbortString)
|
||||
end
|
||||
|
||||
if IsControlJustReleased(0, Config.ExersiceKey) then
|
||||
|
||||
if isTraining then
|
||||
isTraining = false
|
||||
ClearPedTasksImmediately(PlayerPedId())
|
||||
ShowNotification(Config.FinishString)
|
||||
else
|
||||
if currentExersice.type == 'chins' then
|
||||
SetEntityCoords(PlayerPedId(), currentExersice.fixedChinPos.x, currentExersice.fixedChinPos.y, currentExersice.fixedChinPos.z - 1)
|
||||
SetEntityHeading(PlayerPedId(), currentExersice.fixedChinPos.rot)
|
||||
end
|
||||
isTraining = true
|
||||
TaskStartScenarioInPlace(PlayerPedId(), currentExersice.scenario, 0, true)
|
||||
--workOut()
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
--[[function workOut()
|
||||
Citizen.Wait(Config.ExersiceDuration * 1000)
|
||||
ClearPedTasksImmediately(PlayerPedId())
|
||||
ShowNotification(Config.FinishString)
|
||||
isTraining = false
|
||||
end--]]
|
||||
|
||||
function ShowNotification(text)
|
||||
SetNotificationTextEntry('STRING')
|
||||
AddTextComponentString(text)
|
||||
DrawNotification(false, true)
|
||||
end
|
||||
|
||||
function showInfobar(msg)
|
||||
|
||||
CurrentActionMsg = msg
|
||||
SetTextComponentFormat('STRING')
|
||||
AddTextComponentString(CurrentActionMsg)
|
||||
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
|
||||
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
Config = {}
|
||||
|
||||
Config.EnableBlip = false
|
||||
Config.MapBlip = {
|
||||
Pos = {x = -1203.3242,y = -1570.6184,z = 4.6115},
|
||||
Sprite = 311, --icon
|
||||
Display = 4,
|
||||
Scale = 1.0,
|
||||
Colour = 26,
|
||||
Name = 'Beach Gym',
|
||||
}
|
||||
|
||||
Config.Exersices = {
|
||||
{type = 'arm exercises', scenario = "world_human_muscle_free_weights", x = -1202.9837,y = -1565.1718,z = 4.6115},
|
||||
{type = 'pushups', scenario = "world_human_push_ups", x = -1203.3242,y = -1570.6184,z = 4.6115},
|
||||
{type = 'yoga', scenario = "world_human_yoga", x = -1204.7958,y = -1560.1906,z = 4.6115},
|
||||
{type = 'situps', scenario = "world_human_sit_ups", x = -1206.1055,y = -1565.1589,z = 4.6115},
|
||||
{type = 'chins', scenario = "prop_human_muscle_chin_ups", x = -1200.1284,y = -1570.9903,z = 4.6115, fixedChinPos = {x = -1199.84, y = -1571.40, z = 4.61, rot = 40.0}},
|
||||
}
|
||||
|
||||
Config.ExersiceKey = 38 -- E
|
||||
Config.ExersiceString = 'Press ~g~E ~s~to do some '
|
||||
Config.AbortString = 'Press ~g~E ~s~to abort working out'
|
||||
Config.ExersiceDuration = 30 -- in seconds
|
||||
Config.FinishString = '~g~Exercise finished! ~s~Take a deep breath before continuing.'
|
||||
@@ -0,0 +1,17 @@
|
||||
fx_version 'cerulean'
|
||||
games { 'gta5' }
|
||||
|
||||
author 'RedTwo_'
|
||||
description 'Gym script'
|
||||
version '1.0.0'
|
||||
|
||||
-- What to run
|
||||
client_scripts {
|
||||
'config.lua',
|
||||
'client.lua',
|
||||
}
|
||||
|
||||
--[[server_scripts {
|
||||
'config.lua',
|
||||
'server.lua',
|
||||
}--]]
|
||||
Reference in New Issue
Block a user