Jump to content

Dzsozi (h03)

Members
  • Posts

    696
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Dzsozi (h03)

  1. Hello everyone! Today I played a little with camera functions and I found smoothMoveCamera in useful functions section. My question is that how can I attach this moving camera to the player? Here's the code: local sm = {} sm.moov = 0 sm.object1, sm.object2 = nil, nil local function removeCamHandler () if(sm.moov == 1) then sm.moov = 0 removeEventHandler ( "onClientPreRender", getRootElement(), camRender ) end end local function camRender () local x1, y1, z1 = getElementPosition ( sm.object1 ) local x2, y2, z2 = getElementPosition ( sm.object2 ) setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) end function smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time ) if(sm.moov == 1) then return false end sm.object1 = createObject ( 1337, x1, y1, z1 ) sm.object2 = createObject ( 1337, x1t, y1t, z1t ) setElementAlpha ( sm.object1, 0 ) setElementAlpha ( sm.object2, 0 ) setObjectScale(sm.object1, 0.01) setObjectScale(sm.object2, 0.01) moveObject ( sm.object1, time, x2, y2, z2, 0, 0, 0, "InOutQuad" ) moveObject ( sm.object2, time, x2t, y2t, z2t, 0, 0, 0, "InOutQuad" ) addEventHandler ( "onClientPreRender", getRootElement(), camRender ) sm.moov = 1 setTimer ( removeCamHandler, time, 1 ) setTimer ( destroyElement, time, 1, sm.object1 ) setTimer ( destroyElement, time, 1, sm.object2 ) return true end bindKey("k", "down", function() local px, py, pz = getElementPosition(localPlayer) local x, y, z, lx, ly, lz = getCameraMatrix (localPlayer) local x2, y2, z2, lx2, ly2, lz2 = getCameraMatrix (localPlayer) smoothMoveCamera(x, y, z, lx, ly, lz, x2, y2, z2 + 50, lx2, ly2, lz2 - 50, 12000) end ) I binded K button to test it, it's working, but I want to attach the smoothMoveCamera to the player. How is this even possible?
  2. Okay, thank you for you answers! I will try something else. Thank you again.
  3. Not working Did I wrote something bad? tLogUsername = guiCreateEdit(0.38, 0.255, 0.45, 0.06, "", true, tabLogin) guiSetProperty(tLogUsername, "NormalTextColour", "FFFFFFFF") guiSetAlpha(tLogUsername, 0) guiEditSetMaxLength(tLogUsername, 32) No but you can try another color try this ffff0000 also i remembered that it's working with memo not sure about edit's . P.S: Check wiki. Not working Memo's are the same, I can't see the text.
  4. Not working Did I wrote something bad? tLogUsername = guiCreateEdit(0.38, 0.255, 0.45, 0.06, "", true, tabLogin) guiSetProperty(tLogUsername, "NormalTextColour", "FFFFFFFF") guiSetAlpha(tLogUsername, 0) guiEditSetMaxLength(tLogUsername, 32)
  5. I think I have to do something with guiSetProperty, but I don't know what.
  6. Helllo, I have a quick question. Is this possible to change the guiCreateEdit's text colour? For example if I set the guiCreateEdit's alpha to 0 the | thingy is still there, and I can see how I write, but I can't see the text. How to change the editbox's text colour? Or how to remove the white background, because I just want to see the text. Thank you!
  7. Yes, I want to draw it on everyone's head who is away from keyboard. And what do you mean in value? You mean where is this element data defined? local afk = getElementData(getLocalPlayer(),"afk")
  8. Hello, I made an AFK script, which is checks if the player is afk or not. But the image rendering is not working. It should draw an image upper the player's head if he is afk. Here's the rendering part: function renderAfk() local x, y, z = getElementPosition(getLocalPlayer()) if (isElement(value)) then if getElementType(value) == "player" then local px, py, pz = getPedBonePosition(value, 6) local dist = getDistanceBetweenPoints3D(x, y, z, px, py, pz) local lx, ly, lz = getCameraMatrix() local vehicle = getPedOccupiedVehicle(value) local collision, cx, cy, cz, element = processLineOfSight(lx, ly, lz, px, py, pz+1, true, true, true, true, false, false, true, false, vehicle) if not (collision) then local screenX, screenY = getScreenFromWorldPosition(px, py, pz+0.5) if (screenX and screenY) then dist = dist / 5 if (dist<1) then dist = 1 end if (dist>4 and reconx) then dist = 4 end local offset = 70 / dist local afk = getElementData(getLocalPlayer(),"afk") if afk then dxDrawImage(screenX, screenY, 100 / dist, 85 / dist, "afk.png") end end end end end end addEventHandler("onClientRender", getRootElement(), renderAfk) If someone could help, please help me!
  9. I don't really know what do you mean.
  10. Yeah, I saw them all, but it's not helped me And there's one where the codes are removed. And yes, I mean what this guy mean viewtopic.php?f=91&t=71784&p=668760&hilit=radar+blips#p668760 I want to do the blips like this, but on this resource: https://community.multitheftauto.com/ind ... ls&id=8883
  11. No, I mean how to make the blips visible when it's out of sight on the rectangular radar, which I found on community. Like in GTA V... Look at this picture: The white house blip, the house not in sight, but it's visible on the radar, inside the rectangle.
  12. 84 views and no one writes nothing. Please help!
  13. It draws a little line, but it not changes when nitro is activated
  14. So how can I make the nitro level visible with dx functions to players when they enter a vehicle?
  15. Hey guys! So today i tried to make a nitro-o-meter thing. So when you enter a vehicle and if it has nitro in it you should see a rectangle which is displays the nitro level. But it's not working for some reason, and I don't know why. Can somebody help me please? Here's my code: function drawNitro() dxDrawRectangle(1330, 950, fNitroLevel, 45, tocolor(0, 255, 0, 255), false) end function displayNitroLevel(pPlayer) if pPlayer == localPlayer then if getVehicleUpgradeOnSlot( source, 8 ) then -- Check if the vehicle has nitro installed local fNitroLevel = getVehicleNitroLevel(source) addEventHandler("onClientRender", root, drawNitro) --outputChatBox("The nitro level of this " .. getVehicleName(source) .. " is " .. fNitroLevel .. ".", 255, 180, 20, false) end end end addEventHandler("onClientVehicleEnter", root, displayNitroLevel) P.S.: I used wiki's example of 'getVehicleNitroLevel'.
  16. Hello, so today I found a picture on the web which is about a rectangular, GTA V style radar on MTA, here's a bit of the picture: My question is that how can I make the blips always visible inside the rectangle and rotate with the camera in this resource: https://community.multitheftauto.com/in ... ls&id=8883 So as you can see in the picture, the forklift icon is at the left bottom corner inside the rectangle radar, I think this icon is on the other island, maybe at the chilliad or something. So how can I make this instead of simple images on the map? I would be really grateful if someone could help me in this. Thank you!
  17. Hello everyone! Today I tried the triggering stuff, but it's not working. I don't know why. Can somebody help me please? This script is about when the engine is broken and you try to start it, it should start play a sound. Here's this part of the code: Server if (vehKey) or (owner < 0) and (faction == -1) or (playerFaction == faction) and (faction ~= -1) or (exports.global:isPlayerAdmin(source)) then local fuel = getElementData(veh, "fuel") local broke = getElementData(veh, "enginebroke") if broke == 1 then exports.global:sendLocalMeAction(source, "megpróbálja beindítani a jármûvet, de nem sikerül.") exports["notifications"]:showBox(source, "error", "A jármű motorja sérült.") triggerClientEvent ("onMotorSerult",getRootElement()) end end Client addEvent ("onMotorSerult",true) addEventHandler ("onMotorSerult",getRootElement(), function () local jatekosjarmu = getPedOccupiedVehicle(localPlayer) local x, y, z = getElementPosition(jatekosjarmu) motor = playSound3D("startup.mp3", x, y, z, false) setSoundMaxDistance(motor, 30) end )
  18. Not working and my fps jumped to 7 from 60 How can I do this with guiCreateStaticImage?
  19. Hello guys, so today I made a new hud. My problem is that I need to get the player's skin in picture, so how can I say... The image should be match with the ID and draw it in a picture on the hud. But mine is not working. Can somebody help me please? Here's a part of the code where this skin part is. local screenX, screenY = guiGetScreenSize() local skinID = tonumber(getPlayerSkin(localPlayer)) dxDrawImage(screenX*0.8505 , screenY*0.0915, 104, 104, "img/" .. skinID .. ".png")
  20. Okay, thank you, I'll try it tomorrow and tell you what's the result
  21. Hi guys, so I have a skin shop resource, my problem is that it doesn't contains a "Cancel" function, which is about to get your skin back, which was before you entered a marker. I hope you understand me. So I tried to make it, but it's not working. It's like when you press enter (the button which select the skin), it not gets your skin back. I would be grateful if somebody could help me in this! Thanks. local skinek = { 2, 7, 12, 13, 16, 19, 20, 21, 22, 23, 24, 25, 26, } local index = { } local skinshopmarker = createMarker ( 199.1015625, -127.908203125, 1002.4151977539, "cylinder", 1.5, 245, 140, 20, 200 ) setElementInterior(skinshopmarker, 3) setElementDimension(skinshopmarker, 128) model = getElementModel(player) function Kivalaszt ( player ) showCursor ( player, true ) bindKey ( player, "backspace", "down", MegseSkin ) bindKey ( player, "enter", "down", Spawn ) bindKey ( player, "arrow_l", "down", ValasztasSkin ) bindKey ( player, "arrow_r", "down", ValasztasSkin ) fadeCamera ( player, true ) index [ player ] = 1 setElementPosition ( player, 215.9755859375, -132.9267578125, 1003.5078125 ) setPedRotation ( player, 90 ) --setElementRotation ( palyer, 0, 0, 0 ) setElementInterior(player, 3) setElementDimension(player, 128) setElementFrozen ( player, true ) setCameraMatrix ( player, 211.48049926758, -132.75520324707, 1003.0266723633, 212.47685241699, -132.76715087891, 1003.1111450195 ) setCameraInterior( player, 3 ) end addEventHandler("onMarkerHit", skinshopmarker, Kivalaszt) function MegseSkin ( player ) setElementModel(player, model) showCursor ( player, false ) setElementPosition ( player, 207.9072265625, -132.1884765625, 1003.3125 ) setPedRotation ( player, 173 ) setElementInterior(player, 3) setElementDimension(player, 128) setElementFrozen ( player, false ) setCameraTarget ( player, player ) end function ValasztasSkin ( player, key ) if ( key == "arrow_l" ) then if ( index [ player ] == 1 ) then index [ player ] = #skinek else index [ player ] = ( index [ player ] - 1 ) end else if ( index [ player ] == #skinek ) then index [ player ] = 1 else index [ player ] = ( index [ player ] + 1 ) end end --outputChatBox ( index [ player ] ) setElementModel ( player, skinek [ index [ player ] ] ) playSoundFrontEnd ( player, 32 ) end function Spawn ( player ) showCursor ( player, false ) playSoundFrontEnd ( player, 44 ) --outputChatBox("!", player, 0, 255, 0) unbindKey ( player, "backspace", "down", MegseSkin ) unbindKey ( player, "enter", "down", Spawn ) unbindKey ( player, "arrow_l", "down", ValasztasSkin ) unbindKey ( player, "arrow_r", "down", ValasztasSkin ) setElementPosition ( player, 207.9072265625, -132.1884765625, 1003.3125 ) setPedRotation ( player, 173 ) setElementInterior(player, 3) setElementDimension(player, 128) setElementFrozen ( player, false ) setCameraTarget ( player, player ) end
  22. Not excatly what I'm thinking about I mean, if somebody gets injured, his nametag color turns to red, but if somebody shoots someone else, the attacker's nametag is purple, but the injured's nametag is red.
×
×
  • Create New...