Jump to content

getPedAnimationData doesn't exists?


arezu

Recommended Posts

It says: attempt to call global 'getPedAnimationData' (a nil value)..

here is how i tried it:

local x, y, z = getElementPosition(getLocalPlayer()) 
  
local npc = {} 
npc.shop = {} 
npc.shop.ped = createPed(171, x + 3, y + 5, z) 
setPedAnimation(npc.shop.ped, "BAR", "Barserve_loop", -1, true, false, true, false) 
local name, block_name, loop, update_position, iterruptible, time, start_time, finished = getPedAnimationData(npc.shop.ped) 

does it exist, but wiki is outdated and the function has different arguments?

Link to comment
It says: attempt to call global 'getPedAnimationData' (a nil value)..

here is how i tried it:

local x, y, z = getElementPosition(getLocalPlayer()) 
  
local npc = {} 
npc.shop = {} 
npc.shop.ped = createPed(171, x + 3, y + 5, z) 
setPedAnimation(npc.shop.ped, "BAR", "Barserve_loop", -1, true, false, true, false) 
local name, block_name, loop, update_position, iterruptible, time, start_time, finished = getPedAnimationData(npc.shop.ped) 

does it exist, but wiki is outdated and the function has different arguments?

It's because getPedAnimationData is a Clientside function.

In your xml file you should add: type="client"

Example:

I am 110% sure that the problem is caused by that.

Without the "type="client"", the script will run as a serverside script.

Link to comment
It says: attempt to call global 'getPedAnimationData' (a nil value)..

here is how i tried it:

local x, y, z = getElementPosition(getLocalPlayer()) 
  
local npc = {} 
npc.shop = {} 
npc.shop.ped = createPed(171, x + 3, y + 5, z) 
setPedAnimation(npc.shop.ped, "BAR", "Barserve_loop", -1, true, false, true, false) 
local name, block_name, loop, update_position, iterruptible, time, start_time, finished = getPedAnimationData(npc.shop.ped) 

does it exist, but wiki is outdated and the function has different arguments?

It's because getPedAnimationData is a Clientside function.

In your xml file you should add: type="client"

Example:

I am 110% sure that the problem is caused by that.

Without the "type="client"", the script will run as a serverside script.

it is : , otherwise it would say error on 'getLocalPlayer()' too

Link to comment

try this

local x, y, z = getElementPosition(source) 
local npc = {} 
npc.shop = {} 
npc.shop.ped = createPed(171, x + 3, y + 5, z) 
setPedAnimation(npc.shop.ped, "BAR", "Barserve_loop", -1, true, false, true, false) 
local name, block_name, loop, update_position, iterruptible, time, start_time, finished = getPedAnimationData(npc.shop.ped) 

Link to comment
try this
local x, y, z = getElementPosition(source) 
local npc = {} 
npc.shop = {} 
npc.shop.ped = createPed(171, x + 3, y + 5, z) 
setPedAnimation(npc.shop.ped, "BAR", "Barserve_loop", -1, true, false, true, false) 
local name, block_name, loop, update_position, iterruptible, time, start_time, finished = getPedAnimationData(npc.shop.ped) 

Works for me :)

Link to comment
try this
local x, y, z = getElementPosition(source) 
local npc = {} 
npc.shop = {} 
npc.shop.ped = createPed(171, x + 3, y + 5, z) 
setPedAnimation(npc.shop.ped, "BAR", "Barserve_loop", -1, true, false, true, false) 
local name, block_name, loop, update_position, iterruptible, time, start_time, finished = getPedAnimationData(npc.shop.ped) 

The only problem is at getPedAnimationData! i can see the ped at the position i set it and with the animation i set it to, no problem there, but getPedAnimationData is the only thing that doesn't work

Link to comment

try this then

local x, y, z = getElementPosition(source) 
local npc = {} 
npc.shop = {} 
npc.shop.ped = createPed(171, x + 3, y + 5, z) 
setPedAnimation(npc.shop.ped, "BAR", "Barserve_loop", -1, true, false, true, false) 
local name, block_name, loop, update_position, iterruptible, time, start_time, finished = getPedAnimation(npc.shop.ped) 

Link to comment
try this then
local x, y, z = getElementPosition(source) 
local npc = {} 
npc.shop = {} 
npc.shop.ped = createPed(171, x + 3, y + 5, z) 
setPedAnimation(npc.shop.ped, "BAR", "Barserve_loop", -1, true, false, true, false) 
local name, block_name, loop, update_position, iterruptible, time, start_time, finished = getPedAnimation(npc.shop.ped) 

getPedAnimation only returns the current playing animation block and animation name, not these:

time: float - duration of the animation

start_time: float - starting point

finished: boolean - has animation finished playing?

i tested it anyways and wiki was correct on getPedAnimation, so it didn't work.

Link to comment
It says: attempt to call global 'getPedAnimationData' (a nil value)..

here is how i tried it:

local x, y, z = getElementPosition(getLocalPlayer()) 
  
local npc = {} 
npc.shop = {} 
npc.shop.ped = createPed(171, x + 3, y + 5, z) 
setPedAnimation(npc.shop.ped, "BAR", "Barserve_loop", -1, true, false, true, false) 
local name, block_name, loop, update_position, iterruptible, time, start_time, finished = getPedAnimationData(npc.shop.ped) 

does it exist, but wiki is outdated and the function has different arguments?

It's because getPedAnimationData is a Clientside function.

In your xml file you should add: type="client"

Example:

I am 110% sure that the problem is caused by that.

Without the "type="client"", the script will run as a serverside script.

it is : , otherwise it would say error on 'getLocalPlayer()' too

Oh yeah, forgot the ".lua" part O_o

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...