Jump to content

Einheit-101

Distinguished Members
  • Posts

    661
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by Einheit-101

  1. Ok sorry, but i am not really experienced in scripting. I dont know what to do else to make it work
  2. Hello Community, I try to calculate a Position offset and a vector from a given Position X, Y, Z and Rotation X, Y, Z: http://i.imgur.com/4HUOGMg.jpg I hope you know what i mean. My plan is to remove the original Rhino grenade and replace it with my own: 1. Get position and Rotation of the Turret (That works very well now) 2. Get position of the barrel (I have no idea how to do that) 3. Create an RC-Cam on that Position, setElementVelocity to this object, playSound3D and let it explode after impact Problem is, that MTA has no function like "getVehicleMuzzlePosition" (Why ever...) so it is not easy to calculate an offset from the Turret center to the end of the cannon. The original Rhino Projectile is just annoying the way it is. This is what i have: function getPosRot() x, y, z = getElementPosition (getPedOccupiedVehicle ( getLocalPlayer())) xc, yc, zc = getVehicleComponentPosition ( getPedOccupiedVehicle ( getLocalPlayer()), "misc_b" ) --misc_b = barrel local rx, ry_unused, rz_unused = getVehicleComponentRotation ( getPedOccupiedVehicle ( getLocalPlayer()), "misc_b" ) local rotX, ry, rotZ = getElementRotation (getPedOccupiedVehicle ( getLocalPlayer())) local rx_unused, ry_unused, rz = getVehicleComponentRotation ( getPedOccupiedVehicle ( getLocalPlayer()), "misc_a" ) --misc_a = turret rz = rotZ - rz rx = rotX - rx z = z + zc --now we have the exact Position and Rotation of the Turret (tested) xv,yv,zv = getPositionFromElementOffset(getPedOccupiedVehicle(getLocalPlayer()),0,2,0) --call the other Function, which should calculate the Y offset (0,2,0) from turret center to the end of the barrel grenade = createVehicle (594, xv, yv, zv, rx, ry, rz ) --create the Custom Projectile engineSetModelLODDistance ( 594, 170 ) --increase visible Distance of the Projectile (doesnt work correctly) setElementVelocity (grenade, 0, 10, 0 ) --set Velocity, those are just some values because i have no idea how to calculate it end addCommandHandler("get", getPosRot) function getSpecialMatrix(vehicle) --this function should return the Matrix of the Barrel, it gets 3 different Rotations (x from Barrel, y from Rhino, z from Turret) local rx, ry_unused, rz_unused = getVehicleComponentRotation (vehicle, "misc_b" ) local rotX, ry, rotZ = getElementRotation (vehicle) local rx_unused, ry_unused, rz = getVehicleComponentRotation (vehicle, "misc_a" ) rz = rotZ - rz rx = rotX - rx --local rx, ry, rz = math.rad(rz), math.rad(ry), math.rad(rz) local matrix = {} matrix[1] = {} matrix[1][1] = math.cos(rz)*math.cos(ry) - math.sin(rz)*math.sin(rx)*math.sin(ry) matrix[1][2] = math.cos(ry)*math.sin(rz) + math.cos(rz)*math.sin(rx)*math.sin(ry) matrix[1][3] = -math.cos(rx)*math.sin(ry) matrix[2] = {} matrix[2][1] = -math.cos(rx)*math.sin(rz) matrix[2][2] = math.cos(rz)*math.cos(rx) matrix[2][3] = math.sin(rx) matrix[3] = {} matrix[3][1] = math.cos(rz)*math.sin(ry) + math.cos(ry)*math.sin(rz)*math.sin(rx) matrix[3][2] = math.sin(rz)*math.sin(ry) - math.cos(rz)*math.cos(ry)*math.sin(rx) matrix[3][3] = math.cos(rx)*math.cos(ry) matrix[4] = {} matrix[4][1], matrix[4][2], matrix[4][3] = getElementPosition(vehicle) return matrix end function getPositionFromElementOffset(element,offX,offY,offZ) --this function should calculate the offset, but it doesnt work correctly. local m = getSpecialMatrix ( element ) --get the barrel matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z --return the wanted offset end
  3. Can you tell me why this doesn`t work? I just get the following message: attempt to call global "setElementExtraHealth (a nil value) function pedLoad ( thePlayer ) exports.extrahealth:setElementExtraHealth ( thePed, value ) local x, y, z = getElementPosition(thePlayer) x = x+1 local thePed1 = createPed ( 120, x, y, z ) setElementExtraHealth ( thePed1, 50 ) x = x+1 local thePed2 = createPed ( 0, x, y, z ) setElementExtraHealth ( thePed2, 250 ) y = y+1 local thePed3 = createPed ( 0, x, y, z ) setElementExtraHealth ( thePed3, 1000 ) local stat3 = getElementHealth (thePed3) outputChatBox("Stat3: " ..stat3) end addCommandHandler ( "probe", pedLoad ) I try to reduce the Health of Peds, but it doesnt work. setElementHealth, setPedStat(thePed, 24, 50), nothing works. The Ped always has the same Health.
  4. Hey Ren_712, awesome work. I really like your Sky Shader and the Car reflection /Watershader. I have installed your Shader_Panel resource, but i can not choose to enable the radial_blur and the detail shader, it is missing in the GUI. Is there a way to enable it? €DIT::: I found the small line in your Readme, i downloaded the missing 2 options, now it works very well Awesome work! Mfg Einheit-101
  5. Is the DKR Freeroam now finally down? :( This was the most funny server and i had a MTA pause for a long time. Now i dont know what to do anymore
  6. Very good job. The only thing missing is, that it is impossible to make damage to Rhinos with any weapon, except Fire. I need that for my server, then MTA will be perfect!
  7. Aww, yes okay, ive searched WIKI already and found nothing... This would be a useful function i think setSoundEnabled(string type, bool enabled) Types: Gun_snd Vehicle_snd Ped_snd etc. etc. etc.
  8. Hello community, i am searching a way to disable the GTA weapon sounds with a Lua function. Is that possible? (i want to make custom sounds)
  9. https://wiki.multitheftauto.com/wiki/Fil ... essbar.png That is the Original Progress bar with high Contrast -.- But anyway, good to see that you know what I mean (Im German, not English) €DIT::: CHANGING THE SKIN HAS SOLVED THE PROBLEM. Go to settings, Interface and change skin from "Default" to "Classic" and you got the Original Progress Bar! BUT. If i attach a label to this Bar and the Font Color is white, you wont see it because your Default bar is white, too I think the Best Font Color for Both (Black/White) Bars is RED. (any other ideas?) If not, SOLVED
  10. Does your Progress bar look like mine? I hate the new style, its hard to see the Progress -.- €dit: could someone upload a picture of his bar?
  11. ... This Progress bar in the Picture HAS already a Progress (look at it!!) BUT THIS PROGRESS IS WHITE The Picture shows it exactly I want the old Progress bar, which shows its Progress in Black
  12. I created a standard Progress Bar xBar = guiCreateProgressBar( 0.3, 0.96, 0.5, 0.03, true ) But for some months now it s not Black/White (you were able to see the Progress well) Now it is White/Grey (You cant see the Progress ) I upload a screenshot of it, then you see my Problem. I use MTA 1.2, Windows 7 64 Bit (But the problem is on XP aswell) €DIT::: http://imageshack.us/photo/my-images/51 ... 53746.png/
  13. hey guys. I have a problem with the Gui Progress bar, I want to change the Color of the Bar into Black again because MTA Team has changed into white, so i almost cant see the Progress of the Bar. Some months ago the outer bar was white and the inner Bar was black, i wonder why they changed it o0
  14. I want to do it onSpawn, so i will test it with the following code onZombieSpawn SERVER SIDE: setTimer(setElementHealth,500,1,zomb,20) i will tell you in 2 weeks if it works or not (work -.-)
  15. setElementHealth(ped,20) CAN NOT WORK. setElementHealth only works for vehicles and Players, not Peds and i tested it, the zombies still have 100% i dont know what youre doing: viewtopic.php?f=102&t=26375 (not my topic) https://wiki.multitheftauto.com/wiki/SetElementHealth setPedStat(zomb,24, 400) does not work. setPedStat(zomb,24, 40) does also not work. in 1 week i will post the zombie spawn code because i dont have my own pc atm.
  16. Could you please show me your line?
  17. Solidsnake, this doesnt work, because setElementHealth does not work for PEDs (only Players and Vehicles)
  18. ***PUSH*** I got a Problem. At the beginning it worked well, but then i got more and more problems with that method. Now is my question: how is it possible to get setPedStat ( source, 24, 1000 ) to work? I tested some values like: setPedStat ( source, 24, 2000 ) setPedStat ( source, 24, 500 ) setPedStat ( source, 24, 100 ) setPedStat ( source, 24, 50 ) But Nothings happening! Waste of Time! All Zombies have still very high health! It doesnt Work!
  19. Castillo, youre noticing right. Im replacing the correct image with an non-existing one, i just dont know how i came to this stupid idea. I fixed it and it works fine, i just have to test it with more than one player and all pictures. Thanks to all who tried to help me! I will ask again if i need further help
  20. Yes, the image is created correctly, i can see it on the screen. Or does that not mean, that it is created correctly? o_O EDIT::: I changed the created picture`s name to "r2" (it was "r1" before) and now it creates the second picture correctly.
  21. It still does not work Maybe the error is in the server script, but Everything works fine, the sound plays, the debug outputChatBox works, it draws the first picture. But it does no "guiStaticImageLoadImage".
  22. Hmm the only difference is the deleted "image = nil" ? i have tried it, but still -> warning: cscript.lua:15: Bad argument @ 'guiStaticImageLoadImage' [Expected gui-element at argument 1, got nil]
  23. Hey guys, I got a little Problem and dont know why. This part of my script creates a static image called "image". the Server calls the second function and wants to replace this image with another one. But the script returns: warning: cscript.lua:15: Bad argument @ 'guiStaticImageLoadImage' [Expected gui-element at argument 1, got nil] But this gui element is defined in "function imager()" with "image = guiCreateStaticImage( x,y, 150, 150, "rang/r1.png", false )" why does it say "nil"? image = nil function imager() local xp,yp = guiGetScreenSize() x = xp/2 - 150/2+500 y = yp/2 - 250 image = guiCreateStaticImage( x,y, 150, 150, "rang/r1.png", false ) end addEventHandler ( "onClientResourceStart",getResourceRootElement(getThisResource()), imager) for i = 1, 23 do addEvent ( "r"..tostring ( i ), true ) addEventHandler ( "r"..tostring ( i ), getRootElement ( ), function ( image ) guiStaticImageLoadImage( image, "rang/r"..tostring( i )..".png" ) lvlup = playSound("lvlup.mp3",false) setSoundVolume(lvlup,1) end ) end
  24. So you tested "setPedStat ( source, 24, 1000 )" and it worked? lol! Btw. How much HP does an PED have? 1000? and whats the minimum Value for "setPedStat"? they should have about 50% less than normal...
  25. onClientPlayerWeaponFire(hitX, hitY, hitZ)--->x,y,z = getPedWeaponMuzzlePosition----> createMarker(corona, x,y,z) MoveObject(marker, hitX,hitY,hitZ) Something like that^^ You move a Marker very fast from your Muzzle Position to hit position.
×
×
  • Create New...