Jump to content

Jesseunit

Members
  • Posts

    115
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jesseunit

  1. It depends on how you want to 'move' the car. You want the car to change to a completely different position/location? Use setElementPosition. If you want to change the cars' speed/velocity use setElementVelocity.
  2. It was a horrible script I wrote back then, dont even bother using it
  3. This should work. This snippet will create a weapon for every player though. To control the weapon's firing state you'll need to store the weapon element somehow and trigger another clientEvent when a player types the command. CLIENT addEvent("weapon:onClientCreateWeapon", true) function OnClientCreateWeapon(targetPlayer) local radius = 1 local x, y, z = getElementPosition(targetPlayer) local _, _, rz = getElementRotation(targetPlayer) local tx = x + -(radius) * math.sin(math.rad(rz)) local ty = y + radius * math.cos(math.rad(rz)) local weaponElem = createWeapon("m4", tx, ty, z) setElementRotation(weaponElem, 0, 0, rz + 90) setWeaponFlags(weaponElem, "shoot_if_blocked", false) setWeaponFiringRate(weaponElem, 35) setWeaponProperty(weaponElem, "damage", 25) setWeaponClipAmmo(weaponElem, 35) setWeaponAmmo(weaponElem, 100) setWeaponState(weaponElem, "firing") end function OnClientResourceStart() triggerServerEvent("weapon:onCreateWeapon", localPlayer) end addEventHandler("weapon:onClientCreateWeapon", root, OnClientCreateWeapon) addEventHandler("onClientResourceStart", resourceRoot, OnClientResourceStart) SERVER addEvent("weapon:onCreateWeapon", true) function OnCreateWeapon() triggerClientEvent(root, "weapon:onClientCreateWeapon", resourceRoot, client); end addEventHandler("weapon:onCreateWeapon", root, OnCreateWeapon)
  4. Jesseunit

    Help

    I'm sorry but I don't fully understand your reply. Do you want an object to behave the same as a door?
  5. Like SpecT said above, you have 2 functions in your code that do exactly the same as the other 2 functions in your code. I cleaned it up for you: local function onTrailerAttach(vehicle) local driver = getVehicleOccupant(vehicle) if (driver) then triggerClientEvent(driver, "TrailerAttach", resourceRoot) outputChatBox("The load has been attached", driver) end end local function onTrailerDetach(vehicle) local driver = getVehicleOccupant(vehicle) if (driver) then triggerClientEvent(driver, "TrailerDetach", resourceRoot) outputChatBox("The load has been detached", driver) end end addEventHandler("onTrailerAttach", root, onTrailerAttach) addEventHandler("onTrailerDetach", root, onTrailerDetach)
  6. Jesseunit

    Help

    bool setObjectProperty ( object theObject, string property, var value ) The function setObjectProperty needs 3 required arguments (theObject, property and value) to work. If you take a look at the setObjectProperty wiki page you'll see a `Required arguments` heading. Any of the below properties are supported: "mass" - float "turn_mass" - float "air_resistance" - float "elasticity" - float "center_of_mass" - Vector3D - (x, y, z) "buoyancy" - float The prefix before the variable name is the type.
  7. Are you serious man, learn to improvise instead of living off other people's answer. Anyway, the circle you're looking at is basically a full circle the only thing that is different, is that the lines start a bit higher which makes it look like it's not a full circle.
  8. https://wiki.multitheftauto.com/wiki/DxDrawCircle
  9. Yup, I don't really bother playing MTA anymore, all I'm doing is watching movies on Netflix and working on Sociuspirate.
  10. It's easier, download this resource, attach your attachment to ID 25 (Righthand) as the weapon is being held in the players' right hand, get the offsets right so it looks like the attachment is attached to the weapon. Now implement it into your script, vióla. EDIT: MTA has fixed the slope issue where if you would walk upon a hill attachments would glitch so it works even better now.
  11. That corona looks oddly familiar. Anyway... The best way to replace it is by using shaders, a documentation about how shaders work can be found on the Wiki, along with some examples. EDIT: You have to apply it to a world texture named 'coronastar' .
  12. Just tested it. The Camera freaks out and there's still no car. Hit me up on Skype, I'll help you out.
  13. He means that you'll need to use the onClientPreRender event to keep it updating, the function that you have right now will only execute it once.
  14. Here's a newer version of the code, now you can also use an element. local angle = 0 function renderCameraRotation( target, targetX, targetY, targetZ, cameraHeight, radius, speed, roll, fov ) local target = target or nil local cameraHeight = cameraHeight or 5 local radius = radius or 20 local speed = speed or 0.2 local roll = roll or 0 local fov = fov or 70 if isElement( target ) then targetX, targetY, targetZ = getElementPosition( target ) end local camX = targetX + radius * math.cos( math.rad( angle ) ) local camY = targetY + radius * math.sin( math.rad( angle ) ) if ( angle <= 360 ) then angle = angle + speed else angle = 0 end setCameraMatrix( camX, camY, targetZ + cameraHeight, targetX, targetY, targetZ, roll, fov ) end function renderCameraTest() renderCameraRotation( localPlayer ) -- This will make the camera follow and rotate around the player. -- renderCameraRotation( nil, 0, 0, 3 ) // Static X, Y, Z -- renderCameraRotation( nil, 0, 0, 3, 5, 15, 0.3, 0, 70 ) // Static X, Y, Z with optional arguments. end addEventHandler( "onClientRender", root, renderCameraTest )
  15. Thanks for the headsup, edited the quote.
  16. This can also be done with simple maths, and it looks cleaner. local angle = 0 function renderCameraRotation( targetX, targetY, targetZ, cameraHeight, radius, speed, roll, fov ) -- cameraHeight, radius, speed, roll and fov are optional arguments. local cameraHeight = cameraHeight or 5 local radius = radius or 20 local speed = speed or 0.2 local startangle = startangle or 0 local roll = roll or 0 local fov = fov or 70 local camX = targetX + radius * math.cos( math.rad( angle ) ) local camY = targetY + radius * math.sin( math.rad( angle ) ) if ( angle <= 360 ) then angle = angle + speed else angle = 0 end setCameraMatrix( camX, camY, targetZ + cameraHeight, targetX, targetY, targetZ, roll, fov ) end function renderCameraTest() renderCameraRotation( -1342.0641, -26.8057, 14.14844, 5, 10, 0.3, 0, 70 ) -- renderCameraRotation( -1342.0641, -26.8057, 14.14844 ) // Without optional arguments for the lazy people. end addEventHandler( "onClientRender", root, renderCameraTest )
  17. I made a similar resource a few months ago. https://forum.multitheftauto.com/viewtopic.php?f ... ht#p554785
  18. Yo FatalTerror get yo' ass back on this project, at least give us an update about the status of this project.
  19. Sometimes it doesn't even fit in the chatbox. Well in that case you can always output it in a GUI memo rather than a text file. There's always a slightly better solution.
  20. I don't see the purpose of storing it in a file when you can just output the code directly to the chatbox.
  21. Most people on MTA are too simple minded to know how a packet sniffer works, and if someone knows how to utilize a packet sniffer they would be smart enough to script their own scripts. Here's an example of how I protect my client-sided scripts though, it's basically the same as what the attribute 'cache' does. "Jesseunit" type="script" version="1.0.0" />
  22. Jesseunit

    Ladders

    Don't use markers man, markers are for the weak. I'd make an invisible colshape at the bottom and top of the ladder that waits until a player steps in the colshape and presses a certain key like 'H' and you'd actually start climbing up or down instead of just teleporting.
  23. huh, just calculate the position relatively to your guiGetScreenSize values. Like this: local x,y = guiGetScreenSize() local px,py = x-100,y-100 -- will stick to "-100" from any resultion or local x,y = guiGetScreenSize() local px,py = x/2,y/2 -- will keep middle here That'll only put the top left corner of the GUI in the center. If you actually want it to be centered, I suggest you to remove the width and height of the GUI from the width and height of the screen resolution and multiply by 0.5 or divide by 2. local sw, sh = guiGetScreenSize() -- Retrieve the client's screen resolution local width, height = 500, 250 -- Predefined width and height of the GUI local sx, sy = ( sw - width ) * 0.5, ( sh - height ) * 0.5 -- The actual centered width and height
  24. Because they have questions.. Well then, I guess I'll start asking questions in posts that are made in 2008.
×
×
  • Create New...