Jump to content

Drakath

Members
  • Posts

    768
  • Joined

  • Last visited

Everything posted by Drakath

  1. I also had this problem but a computer restart fixed it for me. I assume you already tried that but if you didn't, be sure to do this.
  2. Okay, also is it better to do the most controlling of a ped via server-side using setPedAnimation or via client-side using setPedControlState?
  3. I quite often encounter desynced pedestrians. However today I checked them with getElementPosition and getElementSyncer and to my wonder, they had a syncer and position was correct but they were still invincible. I changed the syncer using setElementSyncer and then I was able to kill the ped. So how come pedestrians are desynced even though they have a syncer? Another problem is that I have a script which I put before spawning a ped so they don't spawn in radar areas: for theKey, radar in ipairs(getElementsByType("radararea")) do if getElementData(radar, "noPeds") then if isInsideRadarArea ( radar, x, y ) then return end end end It kind of works. Normal peds don't spawn there but desynced do. Why does the spawn code get executed even though I wrote return in the script above? Can anyone give me some tips on how to prevent desync?
  4. Alright but does that mean that there is no 100 % chance that the ped will exist in that loop?
  5. When I do: for i, ped in ipairs(getElementsByType("ped")) do end Is it possible that ped won't exist? Should I check it with isElement like so: for i, ped in ipairs(getElementsByType("ped")) do if isElement(ped) then end end ?
  6. Drakath

    Matrix rays

    I'm still not sure which ray should I increase. I guess it's not the intTargetZ ray. Also, isn't 3 meters out of the matrix limits?
  7. Drakath

    Matrix rays

    local t_Matrix = getElementMatrix (t_Data.ped) local int_RayX = t_Matrix[2][1] + t_Matrix[4][1] local int_RayY = t_Matrix[2][2] + t_Matrix[4][2] local int_RayZ = t_Matrix[2][3] + t_Matrix[4][3] for i = 1, 10 do local intSourceX, intSourceY, intSourceZ = t_PedPos[1], t_PedPos[2], t_PedPos[3] local intTargetX, intTargetY, intTargetZ = int_RayX, int_RayY, int_RayZ - 0.2 + i*0.2 dxDrawLine3D (intSourceX, intSourceY, intSourceZ, intTargetX, intTargetY, intTargetZ, tocolor(255,0,0,255)) end This script draws 10 lines of 1 meter length. How can I increase that length to 3 meters?
  8. By the way, how can I increase the length of rays? local t_Matrix = getElementMatrix (t_Data.ped) local int_RayX = t_Matrix[2][1] + t_Matrix[4][1] local int_RayY = t_Matrix[2][2] + t_Matrix[4][2] local int_RayZ = t_Matrix[2][3] + t_Matrix[4][3] for i = 1, 10 do local intSourceX, intSourceY, intSourceZ = t_PedPos[1], t_PedPos[2], t_PedPos[3] local intTargetX, intTargetY, intTargetZ = int_RayX, int_RayY, int_RayZ - 0.2 + i*0.2 dxDrawLine3D (intSourceX, intSourceY, intSourceZ, intTargetX, intTargetY, intTargetZ, tocolor(255,0,0,255)) end This script draws 10 lines of 1 meter length. Let's say I want to increase that to 3 meters.
  9. I got it working with processLineOfSight. Thank you all for helping
  10. The example doesn't make them jump if an obstacle is right in front of them. It will make the ped jump only if he is 1 meter away from the obstacle. I want to make him jump even if he is 0 meters away.
  11. Is it even possible to do this in GTA:SA?
  12. What should I define in endX, endY and endZ?
  13. And how do I get the position of the obstacle?
  14. local x, y, z = getElementPosition(peds) local matrix = getElementMatrix (peds) local isPathClear = true for i = 1, 10 do isPathClear = isLineOfSightClear (x, y, z, matrix[2][1] + matrix[4][1], matrix[2][2] + matrix[4][2], matrix[2][3] + matrix[4][3] - 0.8 + i*0.2, true, true, false, true) if (not isPathClear) then break end end This script detects if there is an obstacle. I make my ped jump when it detects it. But this script only works if a ped is 1 meter away from the obstacle. How can I make it to work if ped is right in front of the obstacle?
  15. I'll pm you my script and explain it better, alright?
  16. Is it possible to use isLineOfSightClear if obstacle is right in front of ped (0 meters)? If yes then how?
  17. Thanks for the information.
  18. I have a script which uses about 15 getDistanceBetweenPoints3D functions. Would it be more efficient to make this function: function getDistToElement(element,Px,Py,Pz) local x,y,z = getElementPosition(element) return getDistanceBetweenPoints3D(Px,Py,Pz,x,y,z) end and use it instead of all other getDistanceBetweenPoints3D?
  19. Drakath

    Local

    What is more efficient: This: function showMoney(source) local playermoney = getPlayerMoney ( source ) outputChatBox(playermoney) end or this: function showMoney(source) outputChatBox(getPlayerMoney ( source )) end Is it worth storing something in local if you are gonna use it only once?
  20. It looks fine to me: http://i.imgur.com/Iy1BejU.png I am a concerned about the traffic though. Here are the specs: RAM: 4 GB Bandwidth: 100 Mbps (10000 GB per month) CPU: 3 vCores
×
×
  • Create New...