Jump to content

Clipper_

Members
  • Posts

    30
  • Joined

  • Last visited

About Clipper_

  • Birthday October 5

Details

  • Gang
    Avalanche

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Clipper_'s Achievements

Rat

Rat (9/54)

1

Reputation

  1. Clipper_

    Effect fix

    used your method, thanks
  2. Clipper_

    Effect fix

    Doesn't work. I just want to see the effect in dimension 0, not all dimensions
  3. Clipper_

    Effect fix

    I got a problem with created effects. In normal dimension I created an effect that is attached to the player's vehicle. The problem is that players from other dimensions can see it too moving around. Any idea how I can restrict the effects only for dimension 0? local attachedEffects = {} function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform 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 transformed point end function attachEffect(effect, element, pos) attachedEffects[effect] = { effect = effect, element = element, pos = pos } 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 x, y, z = getPositionFromElementOffset(info.element, info.pos.x, info.pos.y, info.pos.z) setElementPosition(fx, x, y, z) end end ) local fire = {} function createCustomEffect(player, vehicle, value) if value then local x, y, z = getElementPosition(vehicle) if not fire[player] then fire[player] = createEffect("fire_bike", x, y, z, 0, 0, 0, 0, true) attachEffect(fire[player], vehicle, Vector3(0, 0, 0)) setElementDimension(fire[player], 0) end else if fire[player] then attachedEffects[fire[player]] = nil destroyElement(fire[player]) fire[player] = nil end end end addEvent("triggerCustomEffect", true) addEventHandler("triggerCustomEffect", root, createCustomEffect) The event is triggered in server when a player enters a vehicle, motorcycle in this case. Attaching functions are taken from 'MTA Wiki > Suggested functions function onPlayerVehicleEnter(vehicle, seat, jacked) if getElementModel(vehicle) == 463 then if seat == 0 then triggerClientEvent("triggerCustomEffect", source, source, vehicle, false) end end end addEventHandler("onPlayerVehicleExit", root, onPlayerVehicleEnter)
  4. The best solution I could implement is with predefined position. Although I have to create a database for those, which is not hard at all. The ped solution is similar with getGroundPosition function, eliminated from first try.
  5. I want to create a random supply drop script that moves a certain object from a position in the air to the ground position vertically. -- SERVERSIDE local object = {id = 1271, x = 1000, y = 1000, z = 200} function moveSupply(source, command) local box = createObject(object.id, object.x, object.y, object.z, 0, 0, 0) -- here it should be something that calculates 'ground' as the z coordonate of the ground object point moveObject(box, 10000, object.x, object.y, ground) -- etc end addCommandHandler("supply", moveSupply) . The problem is that there is no support for getting the specific ground position in serverside, only in clientside. Waiting an idea or any other method that can work.
  6. Solved with element data. Thanks
  7. Can you tell me how can I send the hat to client? In this way I can fix other bugs that are related to local player only.
  8. Big thanks to people that gave me ideas for creating this resource. Developped a mode where you can set/remove the hat, but in the real test, I've found this bug when aiming specific weapons that change your camera. Is there any event that can be called when player aims the weapon, in order to make the hat dissapear from screen? (serverside)
  9. Clipper_

    Santa Hat

    For Christmas I want to create a script which adds a Santa Hat on the head of the local player by a command. During the development, I had 2 ideas: 1. Replacing the model of an existing Hat cloth is impossible and leads to a game crash. MTA seem to not have support for clothes ID, only for texture replacement. 2. Positioning another small object (with replaced texture and model) on top of the player's head is another solution. Here, the problem is the position where the hat should be placed: getting the coordonates of the highest "bone" of the ped with getPedBonePosition leads to small changes through the vales, so the hat is not moving with the head like it should behave. If you have a solution for getting the position of any body part (in this case the head), it will be a big help I will comment with the code if needed.
  10. I finished my script, restricting some cases when player could have felt off the bike in another way. I request topic closed
  11. So, in my server i have configured "glue" script, which attach players to my vehicle. Recently, i found a bug that throws me away if I do backflips and if i have another player glued on. What i want to do is to force myself to not fall of when i do rotations and when i have someone glued on my bike
  12. I want to create a script that prevents the fall of the player from the bike while doing backflips and while having another player glued. The thing is it doesn't do what it is supposed to. function onClientRender() if (isElementAttached(localPlayer) == true) then local naElement = getElementAttachedTo(localPlayer) if (getElementType(naElement) == "vehicle") then if (getVehicleType(naElement) == "Bike" or getVehicleType(naElement) == "BMX" or getVehicleType(vehicle) == "Quad") then local driver = getVehicleOccupant(naElement, 0) if (driver) then local rX, rY, rZ = getElementRotation(naElement) --outputChatBox("Bike rotation: x = " .. rX .. " y = " .. rY .. " z = " .. rZ) if (rX > 90 and rX < 300) then setPedCanBeKnockedOffBike(driver, true) outputChatBox(getPlayerName(driver) .. " is fixed") else setPedCanBeKnockedOffBike(driver, false) outputChatBox(getPlayerName(driver) .. " is not fixed") end end end end end end addEventHandler("onClientRender", root, onClientRender)
  13. i tried this to custom weapon names local weaponlist = { [ 31 ] = "M4A1", } local weaponID = getWeaponNameFromID (weaponlist) it is good?
  14. Hello Guys! I wanna get the current weapon name of player and to draw it on my hud local weapon = getPedWeapon (getLocalPlayer()) local weaponID = getWeaponNameFromID (getLocalPlayer(), weapon) dxDrawText("Weapon: "..weaponID..".", (0.585)*sWidth, (0.087)*sHeight, (0.293)*sWidth, (0.263)*sHeight, tocolor (64, 64, 64, 255),1.4,"pricedown","left","top",false,false,false,true) only with line 1, it shows me the ID. then tried to convert the ID in Name by following function from line 2. TY
×
×
  • Create New...