Jump to content

[Help]Ped Animations


TheSmart

Recommended Posts

Hello guys!

i'm learning scripting today i make simple ped animation script but it not working here is my code.

function Ped() 
   ped1 = createPed(107, 2490.5, -1651.5, 13.5) 
   setPedRotation(ped1, 90.0041198) 
   setPedAnimation( ped1, "ped", "M_smklean_loop") 
end 
addEventHandler("onResourceStart", getRootElement(), makPed) 

or i want to give him gun or if player attack him, ped will shoot him with his gun please tell me how i can do it.

Link to comment
function makePed() 
   ped1 = createPed(107, 2490.5, -1651.5, 13.5) 
   setPedRotation(ped1, 90.0041198) 
   setPedAnimation( ped1, "ped", "M_smklean_loop") 
end 
addEventHandler("onResourceStart", getRootElement(), makePed) 

thnx but it not moving no error in debugscript

Link to comment
function makePed() 
   ped1 = createPed(107, 2490.5, -1651.5, 13.5) 
   setPedRotation(ped1, 90.0041198) 
   setPedAnimation( ped1, "SMOKING", "M_smklean_loop") 
end 
addEventHandler("onResourceStart", resourceRoot, makePed) 

like that? but it not working ped won't do anything and it on server side

Link to comment
  • Other Languages Moderators

Try with a timer.

function makePed() 
    ped1 = createPed(107, 2490.5, -1651.5, 13.5) 
    setTimer(function() 
        setPedRotation(ped1, 90.0041198) 
        setPedAnimation(ped1, "SMOKING", "M_smklean_loop") 
     end, 100, 1) 
end 
addEventHandler("onResourceStart", resourceRoot, makePed) 

Link to comment
Try with a timer.
function makePed() 
    ped1 = createPed(107, 2490.5, -1651.5, 13.5) 
    setTimer(function() 
        setPedRotation(ped1, 90.0041198) 
        setPedAnimation(ped1, "SMOKING", "M_smklean_loop") 
     end, 100, 1) 
end 
addEventHandler("onResourceStart", resourceRoot, makePed) 

Thank you man its working now but i want more thing tell me how i can make it that i want to give him gun or if player attack him, ped will shoot him with his gun please tell me how i can do it.

Link to comment
  • 2 weeks later...

Well in that case, it's a bit hard due to wired desync happens sometimes randomly because of ped not handling functions attached to it completely. But you can try these functions:

setPedLookAt or setPedAimTarget 
  

And build up a function to fire the aimed target, manually.

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...