Skip to content

Commit

Permalink
Improved search engine and graphics interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekhion76 authored Aug 19, 2022
1 parent cbcaad2 commit 5ee46c8
Show file tree
Hide file tree
Showing 11 changed files with 35,536 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ECO ANIM
[STANDALONE] FiveM developer helper script for animation search

Browse and search between 140,000 animations

Features:
- automatically copy the selected animation data to the clipboard
- search box
- setting multiple peds (with different flags)
- indicates the duration of animation
- movable UI
- Alexguirre uses an animation list (animations.js): JS: view-source:https://alexguirre.github.io/animations-list/js/animations.js HTML: https://alexguirre.github.io/animations-list/

Use:
- /anim command starts, show ui
- click on the anim name to appear three peds and play the animation
- ESC or close button turn off and delete peds

Casino animations out there are comment (animations.js)

![ecoanim preview](https://github.com/Ekhion76/eco_anim/blob/main/preview_images/eco_anim_1.jpg)
![ecoanim preview](https://github.com/Ekhion76/eco_anim/blob/main/preview_images/eco_anim_2.jpg)
![ecoanim preview](https://github.com/Ekhion76/eco_anim/blob/main/preview_images/eco_anim_3.jpg)
161 changes: 161 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
local _PlayerPedId, cam
local peds = {
{ hash = 'a_m_y_skater_01', flag = 16 },
{ hash = 'a_m_y_skater_02', flag = 0 },
{ hash = 'a_f_m_bevhills_01', flag = 0 },
}

RegisterCommand('anim', function()

SetNuiFocus(true, true)
SendNUIMessage({
subject = 'OPEN'
})
end)

function loadAnimDict(data)

if not DoesAnimDictExist(data.dict) then
return false
end

if not HasAnimDictLoaded(data.dict) then

RequestAnimDict(data.dict)

while not HasAnimDictLoaded(data.dict) do
Wait(10)
end
end

return true
end

function camRender()

if not cam then

local pos = GetEntityForwardVector(peds[2].npc) * 5 + GetEntityCoords(peds[2].npc)

local curCam = GetRenderingCam()
cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", pos.x, pos.y, pos.z + 0.5, -5.0, 0.0, peds[2].heading - 180, 60.00, false, 0)
SetCamActive(cam, true)
RenderScriptCams(true, 1, 1000, 1, 1);
SetCamActiveWithInterp(curCam, cam, 1, 1000, 1);
end
end

RegisterNUICallback('playAnim', function(data, cb)

_PlayerPedId = PlayerPedId()

stopAnim()

ClearPedTasksImmediately(_PlayerPedId)

if not loadAnimDict(data) then

cb({
loadAnim = false,
dict = data.dict,
name = data.name,
playTime = 0
})
return false
end

npcHandler(data.dict, data.name)
camRender()

cb({
loadAnim = true,
dict = data.dict,
name = data.name,
playTime = GetAnimDuration(data.dict, data.name)
})
end)

function modelLoader(model)

if not HasModelLoaded(model) then

RequestModel(model)
Wait(100)
while not HasModelLoaded(model) do
Wait(10)
end
end
end


-- NPC
function npcHandler(lib, anim)

_PlayerPedId = PlayerPedId()

local x, y
local forward = {}
local xDistance = 2.0

local offset = GetEntityForwardVector(_PlayerPedId) * 6
local pos = GetEntityCoords(_PlayerPedId)
local heading = GetEntityHeading(_PlayerPedId)
local npcHeading = heading - 180

forward.x = math.sin(math.rad(heading + 90.0))
forward.y = math.cos(math.rad(heading + 90.0))

for k, param in pairs(peds) do

if not param.npc then

modelLoader(param.hash)

x = pos.x - forward.x * (k - 2) * xDistance + offset.x
y = pos.y + forward.y * (k - 2) * xDistance + offset.y

local _, z = GetGroundZFor_3dCoord(x, y, pos.z, 0)
param.npc = CreatePed(6, param.hash, x, y, z, npcHeading, false, false)

param.pos = vector3(x, y, z)
param.heading = npcHeading
TaskPlayAnim(param.npc, lib, anim, 8.0, 8.0, -1, param.flag, 0, false, false, false)
else

SetEntityCoords(param.npc, param.pos)
SetEntityHeading(param.npc, param.heading)
TaskPlayAnim(param.npc, lib, anim, 8.0, 8.0, -1, param.flag, 0, false, false, false)
end
end
end

function npcDeleter()

for _, params in pairs(peds) do

DeletePed(params.npc)
params.npc = nil
end
end

function stopAnim()

for _, param in pairs(peds) do

if param.npc then

ClearPedTasksImmediately(param.npc)
end
end
end

RegisterNUICallback('exit', function(data, cb)

SetCamActive(cam, false)
DestroyCam(cam, true)
RenderScriptCams(false, 1, 1000, 1, 1);
cam = nil
SetNuiFocus(false, false)
npcDeleter()
cb('ok')
end)
19 changes: 19 additions & 0 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
fx_version 'cerulean'
game 'gta5'

author 'Ekhion'
description 'Animation Presentation'
version '1.0'

client_scripts {
'config.lua',
'client/main.lua'
}

ui_page 'html/ui.html'

files {
'html/ui.html',
'html/styles.css',
'html/js/*.js'
}
Loading

0 comments on commit 5ee46c8

Please sign in to comment.