Jump to content

AttachElements use in another function! Error!


Recommended Posts

Good evening, I'm having trouble at line 12 of my code.

you guys should be simple thing, I can not merge the elements using pedcol and ped, the problem is that because of the ped that is created in another function,

has somehow I use the ped that was created in another

function and use attachElements to join the "ColSphere" and the "PED"?

tried using getElementModel (source), and the

getElementData (source) and neither worked!

Error on line 15 "but it's on the line 12;

:15 : Bad arguments @ attachElements' [Expected element at argument 2, got number '68']

function createPedForPlayer(x, y, z) 
local ped = createPed ( 3 ,x, y,z) 
  
end 
setTimer(createPedForPlayer, 3000, 0) 
  
  
  
  
  
function pedKilled(killer, headshot, attacker, attackerweapon, bodypart, loss ) 
  local ped = getElementModel(source) 
  local pedCol = createColSphere(x, y, z, 1.5) 
  
  attachElements(pedCol, ped, 0, 0, 0) 
   
end 
addEvent("onPedGetsKilled", true) 
addEventHandler("onPedGetsKilled", getRootElement(), pedKilled)  
  

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