Dzsozi (h03)

Members
  • Content Count

    633
  • Joined

  • Last visited

  • Days Won

    1

Dzsozi (h03) last won the day on December 25 2017

Dzsozi (h03) had the most liked content!

Community Reputation

68 Popular

About Dzsozi (h03)

  • Rank
    Pimp

Details

  • Location
    Hungary

Recent Profile Visitors

4,028 profile views
  1. https://community.mtasa.com/index.php?p=resources&s=details&id=15679 With this resource you are able to get/modify the position of a vehicle's cargo space. The position you get is the middle of for example a Bobcat's bed, so if you want to add lots of objects you will have to use some loops for positioning. Look at the exampleS.Lua in the resource. local function testFunction2() local vehicleObject if not isElement(vehicleObject) then local cargoPos = exports["vehiclecargo"]:getVehicleCargoPlacementPosition(source) if cargoPos then local x, y, z = getPositionFromElementOffset(source,cargoPos.x, cargoPos.y, cargoPos.z+0.285) local vehicleObject = createObject(1271, x, y, z, 0, 0, 0) setElementCollisionsEnabled(vehicleObject, false) setObjectScale(vehicleObject, 1.5) attachElements(vehicleObject, source, cargoPos.x, cargoPos.y, cargoPos.z+0.285) -- +value on Z because of the object scaling so the object doesn't collide with the vehicle addEventHandler("onVehicleExit", source, function() if isElement(vehicleObject) then destroyElement(vehicleObject) vehicleObject = nil end end ) end end end addEventHandler("onVehicleEnter", root, testFunction2)
  2. Thank you! I had to change some things up a little bit to match my needs and get it done correctly, it's working now just as I wanted to!
  3. Hello! While I was improving a resource, I came across a small problem; I would like to get the correct value based on vehicle health. I have a table similar like this: ["somekey"] = { [75] = "somevar1", -- view it as health limits, so when the health is lower or between the current and the next, more lower number, then I can add a property to my vehicle [50] = "somevar2", [25] = "somevar3", }, What I want to do is if the health of the vehicle goes under 75 then return "somevar1", when it goes under 50 then return "somevar2" and when it goes under 25 then return "somevar3" and so on. Basically I would like to check if the vehicle's health is between the given indexes/limits and return the correct table value for it. I am guessing that I will need a custom range function but I don't know how to get started and how to select between the indexes depending on a given number when calling the function. I hope I was understandable and someone can help me out, I really need to get this work, please help!
  4. I think the problem is the way you are trying to get the matching model id. In my opinion this would be a much simpler solution for this problem: local vehicleModelIDs = { [596] = true, [523] = true, } addEventHandler ("onVehicleExit", getRootElement (), function (thePlayer) if vehicleModelIDs[getElementModel(source)] then local passenger = getVehicleOccupant (source, 1) if passenger then removePedFromVehicle(passenger) end end end ) This way adding and removing vehicle ids in the future will be easier. Let me know if it works or not.
  5. I just noticed I didn't even use the given rotations at this line; setElementRotation(fx, rx-(elementRX+90)-180, elementRY-ry+90, elementRZ-rz) -- what do i actually write here? but I changed up the variables so many times, nothing seemed to work, probably I copied the wrong version of the script while I was trying to achieve what I wanted.
  6. Hello! I am asking for your help in rotation calculations, I am struggling to get done what I want. I made a script to attach effects to vehicles, but I noticed a problem with some specific effects (for example the one called "petrolcan", which is the effect you get when your character is peeing). I attached this effect to the position of the wheel_rb_dummy and wheel_lb_dummy, now the problem is that when my vehicle turns the effects do not keep their offset rotations, they turn in wrong directions. Here's my current calculations: vehicleEffectData = { ["smoke"] = { ["wheel_lb_dummy"] = { ["petrolcan"] = {x = -0.1, y = 0.3, z = 0.3, rx = -270, ry = 0, density = 1}, }, ["wheel_rb_dummy"] = { ["petrolcan"] = {x = 0.1, y = 0.3, z = 0.3, rx = 270, ry = 0, density = 1}, }, }, } local attachedEffects = {} local vehicleEffects = {} function attachEffect(effect, element, pos, rot) attachedEffects[effect] = { effect = effect, element = element, pos = pos, rot = rot } addEventHandler("onClientElementDestroy", effect, function() attachedEffects[effect] = nil end) addEventHandler("onClientElementDestroy", element, function() attachedEffects[effect] = nil end) return true end addEventHandler("onClientPreRender", root, function() for fx, info in pairs(attachedEffects) do local rx, ry, rz = info.rot.x, info.rot.y, info.rot.z local elementRX, elementRY, elementRZ = getElementRotation(info.element) local x, y, z = getPositionFromElementOffset(info.element, info.pos.x, info.pos.y, info.pos.z) setElementPosition(fx, x, y, z) setElementRotation(fx, rx-(elementRX+90)-180, elementRY-ry+90, elementRZ-rz) end end ) -- inside script: attachEffect(vehicleEffects[vehicle][effect][partName][effectName], vehicle, Vector3(partX+effectData.x, partY+effectData.y/(seatToEngineDifference*2), partZ+effectData.z), Vector3(effectData.rx or 0, effectData.ry or 0, effectData.rz or 0)) Images of the current version: This is the rotation I want to always achieve when I set the rotation inside the table, but this only happens when I am facing this or -(this) direction: When I face north (the effects rotate as well and they turn inside): Please help me out with the calculations!
  7. I think you could achieve something really similar to that single player feature by combining these functions: createProjectile setElementAlpha createObject setElementCollisionsEnabled attachElements
  8. I still got the scripts, I might continue and finish this project finally, I just have to plan what I want to do exactly. If you have any suggestions or ideas let me know!
  9. addEvent("UI.click", false) addEventHandler("UI.click", resourceRoot, function (widget) if widget == ui.playersList then local items = exports.UI:getItems(ui.playersList) local selectedItem = exports.UI:getActiveItem(ui.playersList) Panel.showPlayerInfo(items[selectedItem].player) elseif widget == ui.CanelButton then Panel.hide() elseif widget == ui.SendButton then local reason = UI:getText(ui.reasonInput) if client:getData("money") < reason then exports.UI:showMessageBox("Error", "Недостаточно средств") else triggerServerEvent("SendMoney", localPlayer, Panel.showPlayerInfo(items[selectedItem].player), reason) Panel.hide() end end end) addEvent("SendMoney",true) addEventHandler("SendMoney", root, function(selectedPlayer, reason) if not isElement(selectedPlayer) then return false end if type(reason) ~= "number" then return false end if client:getData("money") < reason then return end if not exports.Core:givePlayerMoney(client, -reason) then return false end if isElement(selectedPlayer) then exports.Core:givePlayerMoney(selectedPlayer, reason) end end) Try this one.
  10. @MrTasty helped me with the following useful function: https://wiki.multitheftauto.com/wiki/WordWrap I also needed it for a notification system. This could be useful if you want to do multiple line dx texts, this function also supports color codes going from the 1st line to the 2nd.
  11. Why don't you just use bone attach and attach a phone object to the player's hand?
  12. Very helpful, lots of beginner modellers will be grateful for your effort that you put into this video!
  13. ****Sighs**** Okay so you are trying to tell me to look up the wiki and community and basically the whole internet to create a new shader file, that - as I can see I must write it down again - can handle the replace of 4 textures at the same time. What kind of modeller are you if you couldn't find the default CJ textures in the game files bro? You are 100% right! But what does that have to do with my problem, nothing? It's a fact that peds vehicles and objects are being made in a modeling program bro, no sh#t! Have you ever checked this function on the wiki https://wiki.multitheftauto.com/wiki/EngineApplyShaderToWorldTexture ? I quote: so by that you probably already figured out that I am using the correct texture names, just because your HD downloaded CJ mod doesn't have its files named the same (let me guess they are called player_torso, player_legs, etc), it doesn't mean I am using the wrong textures, since MTA handles those texture names in a different way as we can see, with some quick semi enthusiastic research you could find the answer easy bro. Why are you linking me the MTA community site, I don't even know, so let's not talk about that. Well, about countless shader examples, I wouldn't say they are countless. But they are not examples for me in this case. Like you said, yes, those are shaders, and this is what I use them for in this case as well. REPLACE TEXTURES, which means I edit the default texture, for example the torso and REPLACE it with a shader. So what does modeling has to do with it, I still don't get it. I don't have to do any UV mapping nor any modeling, why would I? You yourself said that shaders are for applying a texture to an object ped or vehicle. Looks like you are not completely understanding how texture replacing works if you only edit the default texture(?) You can keep telling me to go on YouTube or MTA forum (well, in this case this is what I just did, and that's the reason for this topic being existent, so again, I don't understand you), but there's a reason I made this topic... Probably because I didn't find the proper help I need and I am hoping for someone to help me out, don't you think? I didn't create this topic because I was bored. So, from now on, please avoid telling me the same thing "over and over in different ways" bro. Because you are not helping me, you are just trying to prove me wrong, that I must go and learn from wiki and search up the whole internet for a solution to my problem. I just asked a simple question which is: HOW CAN I MAKE A SHADER THAT CAN HANDLE MULTIPLE TEXTURE REPLACES AT ONCE??? No modeling, no UV mapping, no Facebook or YouTube or Twitter search for help, just a simple question on MTA forum in a topic about shaders. You don't have to tell me that I am doing it wrong and must find a different way via modeling, (even if I already have my system ready, just willing to improve it) when you are the one who doesn't even know where to find the default game textures. And now, back to the main question again: HOW CAN I MAKE A SHADER THAT CAN HANDLE MULTIPLE TEXTURE REPLACES AT ONCE??? ???
  14. https://community.multitheftauto.com/index.php?p=resources&amp;s=details&amp;id=4413 https://community.multitheftauto.com/index.php?p=resources&amp;s=details&amp;id=6889