Jump to content

Making Peds Throw Molotovs


Recommended Posts

  
  
  
addEvent("startPedThrowing",true) 
addEventHandler("startPedThrowing",getRootElement(),function(ped) 
    setPedAnimation(ped, nil, nil)     
    setPedControlState ( ped, "fire", true) 
    setTimer(function() 
setPedControlState(ped,"fire",false) 
    end, 1000, 1) 
randomAnimation = math.random(1,5) 
  
            if(randomAnimation==1)then 
    setPedAnimation(ped,"RIOT","RIOT_ANGRY",-1,true,true,true,true) 
            elseif(randomAnimation==2)then 
    setPedAnimation(ped,"RIOT","RIOT_ANGRY_B",-1,true,true,true,true) 
            elseif(randomAnimation==3)then 
    setPedAnimation(ped,"RIOT","RIOT_shout",-1,true,true,true,true) 
            elseif(randomAnimation==4)then 
    setPedAnimation(ped,"RIOT","RIOT_CHANT",-1,true,true,true,true) 
            elseif(randomAnimation==5)then 
    setPedAnimation(ped,"RIOT","RIOT_challenge",-1,true,true,true,true) 
            end 
end) 
  

The peds already have animations going and this has no effect on it, and i cant figure out why

Link to comment

Hold on, now i amc reateing projectile client side and triggering a server side event to make a explosion.

  
addEvent("startPedThrowing",true) 
addEventHandler("startPedThrowing",getRootElement(),function(ped) 
setTimer(function() 
    x,y,z=getElementPosition(ped) 
    molly = createProjectile ( ped,18,x,y,z+1,1.2) 
    setTimer(function() 
        x,y,z=getElementPosition(molly) 
        triggerServerEvent("syncBoom",getRootElement(),x,y,z) 
    end,3000,1) 
end,math.random(1000,5000),0) 
end) 
  
  

I can not get the x,y,z positions of it

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