Jump to content

Peds problem


AjaxFTW

Recommended Posts

when i did, the players told me that they see ped just moving, can't see ped have any weapon.
function cmdArmedPed(player,_) 
    local x, y, z = getElementPosition(player) -- Get your position 
    local thePed = createPed(0, x + 1, y, z) -- Create a CJ ped nearby 
    setTimer ( function ( ped ) 
        giveWeapon( ped, 31, 5000, true) -- Give him 5000 rounds of M4 
         -- Make him shoot continuously 
        triggerClientEvent(root,"onPedShoot",root,ped) 
    end, 100, 1, thePed ) 
end 
addCommandHandler("armedped", cmdArmedPed) 

Link to comment

Use onClientElementStreamIn on the triggered ped and use givePedWeapon and setPedControlState there.

addEvent("onPedShoot",true) 
addEventHandler("onPedShoot",root, 
function (ped) 
     setPedControlState( ped, "fire", true) 
     addEventHandler ( "onClientElementStreamIn", ped, function () 
           givePedWeapon ( source, 31, 5000, true ) 
           setPedControlState ( source, "fire", true ) 
end) 

Edit:

Its onClientElementStreamIn, not StreamedIn

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