• Content Count

  • Joined

  • Last visited

Community Reputation

4 Neutral


About Xwad

  • Rank
  • Birthday 10/04/1998


  • Gang

Recent Profile Visitors

1,379 profile views
  1. Xwad

    shader issue

    Hello, is there anybody who's good with shaders? I have this UV scroll shader code that is scrolling a texture, but i have no clue how to create parameters for mta lua. I want to create a parameter to set the speed of the texture scrolling. float gTime : TIME; float3x3 getTextureTransform() { float posU = -fmod( gTime/20 ,1 ); float posV = 0; return float3x3( 0, 1, 0, 1, 0, 0, posU, posV, 1 ); } technique tec0 { pass P0 { TextureTransform[0] = getTextureTransform (); TextureTransformFlags[0] = Count2; } }
  2. Xwad

    UV Scroll Shader

    https://wiki.multitheftauto.com/wiki/Shader_examples#UV_scroll how can i set the scrolling direction? Should i use dxSetShaderValue? Thanks in advance.
  3. Xwad

    Synch question

    If i create a weapon in client side and fire it through server side, will other players see the gun firing? with other words (to be sure) if the createWeapon is not synched but the fireWeapon is, will other players see the gun firing?
  4. Xwad

    loop question

    That's not exactly what i need. I want to loop throught all peds and get the one that is the closest to a given position. Its not that difficult, i just wanna know if theres any simpler way to do it, so i dont have to loop twice
  5. Xwad

    loop question

    I want to check which ped is the closest to the wx,wy,wz position. Is there any easier way do it then this method? local wx = 0 local wy = 0 local wz = 0 function test() for i,v in ipairs(getElementsByType("ped")) do local x,y,z = getElementPosition(v) local distance = getDistanceBetweenPoints3D(x,y,z,wx,wy,wz) for i,v2 in ipairs(getElementsByType("ped")) do local x,y,z = getElementPosition(v) local distance2 = getDistanceBetweenPoints3D(x,y,z,wx,wy,wz) if distance < distance2 then --- end end end
  6. Xwad


    Yes thats it. It was not working because the script had other gui static elements that didnt have the data.
  7. Xwad


    But i need the data[2].
  8. Xwad


    local gui1 = {"496","Pz.Kpfw. II","pz2","50","40","11","50","30","20","15"} local gui2 = {"401","Pz.Kpfw. III","pz3","50","64","70","40","50","30","50"} local gui3 = {"517","Hetzer","hetzer","50","42","110","40","50","30","50"} local img1 = guiCreateStaticImage( 100, 100, 175, 127.5, "files/images/pz2.png", false, tab2 ) local img2 = guiCreateStaticImage( 500, 200, 175, 127.5, "files/images/pz3.png", false, tab2 ) local img3 = guiCreateStaticImage( 100, 300, 175, 127.5, "files/images/hetzer.png", false, tab2 ) setElementData(img1, "data", gui1) setElementData(img2, "data", gui2) setElementData(img3, "data", gui3) for i,v in ipairs(getElementsByType("gui-staticimage")) do local data = getElementData(v,"data") local x,y = guiGetPosition(v, false) local label = guiCreateLabel ( x,y, 150,20, data[2], false, tab2 ) end Inside the looping, the data variable has no value (a boolean value). Its a mystery for me. I checked everythink 100x times, but does not work.
  9. Xwad

    Math question

    YES i did it+! Thanks for the hint!
  10. Xwad

    Math question

    i have a table with elements inside it. if the number of elements inside the table are 0 or 1 then do a calculation with the number (#table) which will be the result of 10. If the number of elements are 2 or 3 then do the same calculation which will be the result of 20. And the same with result 30,40,50,60, etc.... Is this possible? (i need it for an auto positioning gui element)
  11. Xwad


    And which function should i use for getting the angle?
  12. Xwad


    Hello. I wan't to determine which side of the vehicle was shooted (front or rear). My problem is that the front and the rear will be the opposite when the vehicle is rotated 180 deegres. I know, i have to use getOffsetFromXYZ but i dont really understand the logic. function onFire(weapon,ammo,ammoInClip,hitX,hitY,hitZ,hitElement) if getElementType(hitElement) == "vehicle" then local x,y,z = getOffsetFromXYZ( getElementMatrix(hitElement), getElementPosition(hitElement) ) local offsetX = hitX - x local offsetY = hitY - y local offsetZ = hitZ - z if offsetX > 0 then outputChatBox("rear") elseif offsetX < 0 then outputChatBox("front") end end end addEventHandler("onClientPlayerWeaponFire", root, onFire) function getOffsetFromXYZ( mat, vec ) -- make sure our matrix is setup correctly 'cos MTA used to set all of these to 1. mat[1][4] = 0 mat[2][4] = 0 mat[3][4] = 0 mat[4][4] = 1 mat = matrix.invert( mat ) local offX = vec[1] * mat[1][1] + vec[2] * mat[2][1] + vec[3] * mat[3][1] + mat[4][1] local offY = vec[1] * mat[1][2] + vec[2] * mat[2][2] + vec[3] * mat[3][2] + mat[4][2] local offZ = vec[1] * mat[1][3] + vec[2] * mat[2][3] + vec[3] * mat[3][3] + mat[4][3] return {offX, offY, offZ} end
  13. yeah but i get the value with getVehicleComponentRotation, so why is it not working?
  14. Well, although this problem is fixed, i got a new one haha line 4: attempt to perform arithmetic on local rh a nil value this means that rh does not have a value?