Jump to content

Give weapons to peds?


Ruma

Recommended Posts

Hi i want to ask how its possible to give weapons to a ped? i know the comand must be giveWeapon but it doesn´t work,

this is the default MTA Wiki example i tryed to adapt it to an eventHandler but i cant. Can someoneExplain me how?

ped = createPed( 19, -1634.5775, 1203.85, 7.1796 ) 
  
addCommandHandler( "give", 
  function ( player, command, id, amount ) 
    if not tonumber ( id ) then return end 
  
    if not tonumber ( amount ) then 
        amount = 9001 
    end 
  
    giveWeapon( ped, id, amount, true ) 
  end 
) 

Link to comment

I used makePed instead of an eventHandler

makePed (120,0,0,5,31,200) 
  
function makePed (skin,x,y,z,id,amount ) 
    if not tonumber ( id ) then return end 
    if not tonumber ( amount ) then amount = 500 end  
    ped = createPed (skin,x,y,z) 
    giveWeapon(ped, id, amount, true ) 
end 
  

Link to comment
I used makePed instead of an eventHandler
makePed (120,0,0,5,31,200) 
  
function makePed (skin,x,y,z,id,amount ) 
    if not tonumber ( id ) then return end 
    if not tonumber ( amount ) then amount = 500 end  
    ped = createPed (skin,x,y,z) 
    giveWeapon(ped, id, amount, true ) 
end 
  

You must declare function first, and then call 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...