Jump to content

bovine3dom

Members
  • Posts

    20
  • Joined

  • Last visited

Details

  • Gang
    :S

bovine3dom's Achievements

Civilian

Civilian (7/54)

0

Reputation

  1. Yes, just change the "change camera" button in MTA's control options.
  2. Done in 0.1.2 - if you press change_camera (V by default afaik), you can cycle through views as you would normally (bodged it so that my camera pretends to be another mode). Thanks for the feedback Mr.Hankey: I have looked at that script, but the maths in it is going to take a rainy day for me to work through - so thanks, it is still on my to-do list.
  3. Genuine thanks for that link, I'm sure I'll learn lots from it - you do it very very differently to me. Version 0.0.3 out, fixes a few cockpits and now uses the default binds for look left/right/behind EDIT: 0.0.4 released, adds camera roll (toggleable). EDIT: 0.1.0 released - fixes the bug which stopped it from working well with the race gamemodes. hurrah! EDIT: 0.1.1 released, fixes a few bugs, cockpits and adds some binding options to fix conflicts with aircraft rudders.
  4. It will be my next project, once I've finished this one.
  5. Having had a nosy around the Valhalla server, I have to say I prefer my manually-set cockpits - yours don't work perfectly with every car, and the camera moves around with the neck - so it might not be the right function for me. I love your first person view, though (on foot).
  6. Mr. Hankey - that's a great idea, thanks (if only I'd known about the function before I spent all weekend setting up every cockpit by hand ). I'll have a punt at it tomorrow, when I'm more awake. 0.0.2 released, includes look left/right/behind binds (defaulted to q, e and c).
  7. Changelog: 0.1.2 Huge improvements to bike cockpits and changed the way the cockpit is accessed (now it pretends to just be another camera mode). I've tweaked the way the camera rolls too, now it feels a bit more fluid and natural rather than being solidly fixed. 0.1.1 Fixed a bug where the cockpit camera wasn't disabling in vehicles in which it wasn't enabled; added a new command (aircraftcompat) which allows you to bind the look commands to 'special_control' ones, fixed some cockpits. 0.1.0 Fixed the bug where cockpits didn't change when your vehicle did - i.e. the script should now work with the race gamemode! :DD 0.0.4 Added camera roll, fixed a few cockpits. 0.0.3 Changed controls as requested - they now use the default vehicle_look_[left/right/behind] binds. You need to set three controls though, I haven't yet figured out how to do get look left + right to make look behind. Also altered a few cockpits to correct incorrect camera position. 0.0.2 Added look left/right/behind commands bound to q, e, and c respectively. https://community.multitheftauto.com/index.php?p= ... ils&id=844 It should now work with the race gamemodes.
  8. I think I'll skip most of the maths and just use a 'fly on the nose' (i.e. create an invisible object, attach it to the train and have the camera look at that). That way I don't have to worry about the angle of elevation either, and it should be less resource hungry. Btw, the solution to this problem is to use tan(Z) to find the x co-ordinate for -45 Cheers to Doomed_Space_Marine, I didn't realise that the function worked that way. Code I'm using now (for those interested) function trainCam() local x, y, z = getElementPosition(gnat) local cx, cy, cz = getElementPosition(fly) setCameraMatrix(x, y, z, cx, cy, cz) end function trainStart(theVehicle, seat) if ((seat == 0) and (getElementModel(theVehicle) == 449)) then local x, y, z = getElementPosition(getLocalPlayer()) fly = createObject(3803, x, y, z) setElementAlpha(fly, 0) gnat = createObject(3803, x, y, z) setElementAlpha(gnat, 0) attachElements(fly, theVehicle, 0.7, 5, 0.6) attachElements(gnat, theVehicle, 0.7, 3.5, 0.6) addEventHandler("onClientPreRender", getRootElement(), trainCam) else end end addEventHandler("onClientPlayerVehicleEnter", getLocalPlayer(), trainStart) function trainStop(theVehicle, seat) if ((seat == 0) and (getElementModel(theVehicle) == 449)) then removeEventHandler("onClientPreRender", getRootElement(), trainCam) setCameraTarget(getLocalPlayer()) destroyElement(fly) destroyElement(gnat) else end end addEventHandler("onClientPlayerVehicleExit", getLocalPlayer(), trainStop)
  9. I'm trying to create a cockpit camera (like http://www.ps3informer.com/playstation- ... t-view.jpg ) for a tram. Here's the code so far: (This is all clientside btw) function trainCam() local theVehicle = getPedOccupiedVehicle(getLocalPlayer()) local x, y, z = getElementPosition(getLocalPlayer()) local rx, ry, rz = getElementRotation(getLocalPlayer()) local ry = y+1 local rx = x+(math.tan(math.deg(rz))) setCameraMatrix(x, y, z+1, rx, ry, z+1) end function trainStart(theVehicle, seat) if ((seat == 0) and (getElementModel(theVehicle) == 449)) then addEventHandler("onClientRender", getRootElement(), trainCam) else end end addEventHandler("onClientPlayerVehicleEnter", getLocalPlayer(), trainStart) function trainStop(theVehicle, seat) if ((seat == 0) and (getElementModel(theVehicle) == 449)) then removeEventHandler("onClientRender", getRootElement(), trainCam) setCameraTarget(getLocalPlayer()) else end end addEventHandler("onClientPlayerVehicleExit", getLocalPlayer(), trainStop) It kind of works along 0* and 90* lines (although it seems to go in fairly random directions), but when you go around a corner, it spins around crazyily. I can't see why though The logic behind the maths: http://j.imagehost.org/0403/MTA.png Where the point (a,b) is the x and y position of the tram, and (a+tan(Z), b+1) is a second point along the direction of travel. I know I haven't made any allowances for instances where the direction of travel is 90* Any ideas/solutions? Thanks.
  10. Thehookerkiller01: It's possible, but right now I have neither the time nor the ability to do so. LordAzamath: Thanks for the heads up but I had put it there so that people could hopefully learn a bit from my code (otherwise I wouldn't have defined it anywhere as a variable; I would have just put it in as an argument). I might make getNearbyPlayers() Nevermore: is it reproducible? It won't do it for me. I suspect that you have another resource that is stopping the cancelEvent() or that you have edited it by accident.
  11. Basically, it just uses string.find to find stuff within your message. <3 Download: https://community.multitheftauto.com/index.html?p ... ils&id=251 EDIT: 1.2.1 released
  12. Thanks Mr.Hankey, I was wondering why the accounts were dissappearing! Unfortunately, not all is well - on occasion, the stingers decide to sting the person who released them when someone else runs over the stingers - and sometimes the time is set to 0:00 when someone runs over the stingers. Also, the "Stingers Released!" is global i.e. everyone can see it. - Why? -- Stinger Release function releaseStingers ( thePlayer, commandName ) local theVehicle = getPlayerOccupiedVehicle ( thePlayer ) if (theVehicle ~= false) then x,y,z = getElementPosition ( theVehicle ) -- stores the location of the car rx, ry, rz = getVehicleRotation ( theVehicle ) -- stores the rotation of the car setTimer ( delayedStingerCreation, 100, 1, stingdc) -- make a timer using the delay time from above to start the function "delayedStingerCreation" else outputChatBox ( "You fail!" , source, 255, 0, 0 ) end end addCommandHandler ( "sting", releaseStingers ) function delayedStingerCreation ( source, stingdc) local z = z - 0.55 stingerCol = createColCuboid ( x, y, z, 1000.0, 1000.0, 500.0 ) addEventHandler ( "onColShapeHit", stingerCol, stingerHit ) -- When you hit a collision box, perform function "stingerHit" local rz = rz + 90 stingerObj = createObject( 2899, x, y, z, 0, 0, rz ) -- create the stinger (2892) outputChatBox ( "Stingers released!" , source, 0, 255, 0 ) setTimer (delayedStingerDeletion, 5000.0, 1, stingdd) end function delayedStingerDeletion (source, stingdd) destroyElement( stingerCol ) destroyElement( stingerObj ) end -- Stinger Collision! function stingerHit ( thePlayer, st ) -- If in a vehicle, make it spin out of control and pop all the tyres local theVehicle = getPlayerOccupiedVehicle ( thePlayer ) local r1 = randInt ( 1, 2 ) local r2 = randInt ( 1, 2 ) local r3 = randInt ( 1, 1 ) local r4 = randInt ( 1, 1 ) setVehicleWheelStates ( theVehicle, r1, r2, r3, r4 ) local velocityx,velocityy,velocityz = getElementVelocity ( thePlayer ) local speed = (velocityx^2 + velocityy^2 + velocityz^2)^(0.5) local turnvelocity = speed/5 local spin = randInt ( 0, 1 ) if (spin == 1 ) then setVehicleTurnVelocity ( theVehicle, 0, 0, turnvelocity ) else local turnvelocity = turnvelocity * -1 setVehicleTurnVelocity ( theVehicle, 0, 0, turnvelocity ) end end
×
×
  • Create New...