Jump to content

[HELP]Army peds


Victor214

Recommended Posts

Posted (edited)

So, I'm working on army peds that will be able to aim and shoot (like an aimbot) on other moving peds (I'll create them later), I've already given them weapons, now my problem is to do the aimbot, I though about creating an weapon, attaching them to the ped, add the "holding weapon" animation, and then use setWeaponTarget, but it'd be too complicated and would probably fail, is there any other way to do it? Here you have the script:

army1 = createPed (287, 1799.6999511719, -1721.8000488281, 25.799999237061, 207.99983215332) 
army2 = createPed (179, 1813.1999511719, -1721.6999511719, 17.89999961853, 158.24719238281) 
army3 = createPed (191, 1759.6999511719, -1683.9000244141, 21.200000762939, 126.00411987305) 
army4 = createPed (73, 1758.5, -1705.5999755859, 18.39999961853, 63.998596191406) 
army5 = createPed (312, 1764.0999755859, -1709.6999511719, 28.89999961853, 72)       
army6 = createPed (287, 1793.1999511719, -1705.1999511719, 13.5, 0.25)    
army7 = createPed (179, 2021.4000244141, -1409.1999511719, 23.10000038147, 128.00091552734)  
army8 = createPed (287, 2041.1999511719, -1414.5999755859, 17.10000038147, 102.00103759766) 
army9 = createPed (73, 1030.5, -970.70001220703, 47.5, 10.003204345703) 
army10 = createPed (312, 1013, -943.29998779297, 48.200000762939, 176.00512695313)  
army11 = createPed (191, 1051.9000244141, -939.20001220703, 50.400001525879, 206.00508117676) 
armypeds = {army1, army2, army3, army4, army5, army6, army7, army8, army9, army10, army11} 
  
function aped () 
  
for _, ped in ipairs ( armypeds ) do setElementFrozen ( ped, true ) 
setTimer (giveWeapon, 50, 1, ped, 31, 200, true) 
end 
  
end 
addEventHandler("onResourceStart", resourceRoot, aped) 
  

Ps: I had to use the timer because it wasn't working without it (For no reason I think).

Edited by Guest
Posted (edited)

Are you sure it'll work? this function will set the ped's aim target to a fixed location, and I need a function to set his target in other moving peds (that I'll add later), not to a fixed location =X

Edited by Guest
Posted

Of course, it will work. No matter how you set the target, every moment of time the target destination point is fixed at some location anyway.

Posted

Y u no use table to spawn NPCs mate?

  
local soldiers = { 
    [1]={ skin=217, coords={0, 0, 3} } 
} 
  
for i = 1, #soldiers do 
    local x, y, z = unpack(soldiers[i].coords) 
    local skin = soldiers[i].skin 
    local soldier = createPed(skin, x, y, z+0.5) 
    setElementFrozen(soldier, true) 
    setTimer(giveWeapon, 750, 1, soldier, 31, 999, true) 
end 
  

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