Jump to content

DiSaMe

Helpers
  • Posts

    1,461
  • Joined

  • Last visited

  • Days Won

    34

Everything posted by DiSaMe

  1. I think it's best to use two scripts, one client-side for canceling damage and another server-side for animation.
  2. The event must be onClientPlayerDamage. Unlike ped functions, ped events don't work with players.
  3. Another way (I think it's faster): function isElementInRangeOfPoint(element,range,x,y,z) local ex,ey,ez = getElementPosition(element) ex,ey,ez = ex-x,ey-y,ez-z return ex*ex+ey*ey+ez*ez <= range*range end Copy this code to the script and you can use this function on all physical elements.
  4. It's not the center, but near the center and it does not change.
  5. getWorldFromScreenPosition and processLineOfSight can be used to get world position without clicking.
  6. setElementModel can be used not only on peds and players, but also on objects and vehicles. setPedSkin is deprecated.
  7. removeCommandHandler destroys the command, but it's much easier to use isElementWithinMarker in the function attached to the command to check if the player is in the marker and if he's not, then don't execute further actions.
  8. Something like this: local we1,wx1,wy1,wz1,e1 = processLineOfSight(sx,sy,sz,dx,dy,dz) local we2,wx2,wy2,wz2,e2 = processLineOfSight(sx,sy,sz,dnx,dny,dnz) local angle = -math.deg(math.atan2(wx1-wx2,wy1-wy2)) sx,sy,sz are source coordinates, dx,dy,dz are destination coordinates and dnx,dny,dnz are coordinates near the destination. If you get dx,dy,dz from screen (let's say pixels are sx,sy), you can get dnx,dny,dnz from the pixel which is right from the first (sx+1,sy). edit: this is for vertical surfaces. It would need some more work to get vertical angle.
  9. MTA tends to crash with custom models.
  10. I searched on SA-MP wiki and found nothing about custom animations. As SA-MP can't replace DFFs, TXDs, COLs, add water squares and change other client-side stuff, it doesn't seem like it could support custom animations.
  11. SA-MP doesn't have custom animations, does it?
  12. If setPedAimTarget worked on players, there would be no problem.
  13. Do you see a way to flip car onto two wheels with matrices? There's no such function like setElementMatrix. But the code Antibird posted was for getting the rotation, not setting it, and I'm talking about another, similar way to do that.
  14. You say you don't want to flip it to the roof, but you see it as a problem when it's flipped and Y rotation is still shown to be below 90 degrees
  15. rotate 180 degrees by Z - reverse its direction rotate 180 degrees by Y - make it stand on its roof rotate 180 degrees by X - make it stand on its roof, but the direction will be the opposite than rotating by Y So if you flip car by X and Z, it will be the same as flipping it by Y. And the way of getting Y rotation Antibird wrote here is a bit similar to the one I suggested.
  16. That's because rotating vehicle 180 degrees on Y axes is the same as rotating it on X and Z axes, both 180 degrees. So you could use X rotation to check if the vehicle is upside down, and if it is, then ry value must be set to 180-ry.
  17. You could try changing dimension of the elements client-side. Every client will only see the changes locally. You won't need to copy elements.
  18. No, it doesn't. At least to me.
  19. Put setTimer into a function which is attached to onMarkerHit event.
  20. It's fine to name variables "source", as long as function isn't attached to any event. I always use "source" as a variable name for the player element in command functions and that doesn't cause any problems.
  21. Readme file updated and /clear bug fixed: http://www.sendspace.com/file/3owikg
  22. You can make elements invisible to clients with setElementVisibleTo, but AFAIK, there's some bug which makes this function don't work on custom elements.
  23. You can't replace DFF of the skin. I hope MTA developers will make that possible in the future.
  24. I thought of improving this script, but didn't change anything, so this is download link: http://www.sendspace.com/file/emhly9
×
×
  • Create New...