Jump to content

Stijger

Members
  • Posts

    30
  • Joined

  • Last visited

Details

  • Gang
    [DRuG]
  • Location
    Netherlands

Stijger's Achievements

Rat

Rat (9/54)

0

Reputation

  1. Hey guys if you put these lines: <resource src="rcg" startup="1" protected="0"/> <resource src="rcg_core" startup="1" protected="0"/> <resource src="rcg_editor" startup="1" protected="0"/> into the editor.conf, it's loaded from the start. And i can save the maps like that, so maybe reinstall AleksCore?
  2. hmm okay good idea, thank you again Castillo. I will try that and maybe get back on it
  3. yeah I get that, but how should i get it then. Any suggestions?
  4. Any idea how i should get the towed vehicle then? Coz I have no idea. The player vehicle is no problem ofcourse.
  5. Hey, I need some help again. Iam still working on the trailer distance thing, but now i thought well wouldn't it be more awesome if you can dettach the trailer, but when you get too far from it, you blow up. So something like that checks the distance between the two vehicles a lot and then when you get too far, it goes BOOM!! Tried this but it don't remember the trailer after the dettachment. root = getRootElement () function attachedTrailer () local theTruckVehicle = getPedOccupiedVehicle ( getLocalPlayer () ) local theTruckTrailer = getVehicleTowedByVehicle ( theTruckVehicle ) local vehiclex, vehicley, vehiclez = getElementPosition (theTruckVehicle) local trailerx, trailery, trailerz = getElementPosition(theTruckTrailer) local dist = getDistanceBetweenPoints2D (trailerx, trailery, vehiclex, vehicley) if dist >= 20 then blowVehicle ( theTruckVehicle ) blowVehicle ( theTruckTrailer ) end end addEventHandler ( "onClientRender", root, attachedTrailer )
  6. Stijger

    God like car

    For people that are interested: function handling ( ) for _,veh in pairs(getElementsByType("vehicle")) do if getElementModel(veh) == 495 then setVehicleHandling(veh, "collisionDamageMultiplier", 0) end end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), handling ) This makes the sandking (id: 495) godlike for all collisions. Right from the start.
  7. okay, I totally lost it. I got as far as this. local trailers = {} addEventHandler("onPlayerJoin",root, function () trailers[source] = {} end ) players = getElementsByType("player") function attachTrailer () for _,player in pairs(players) do local veh = getPedOccupiedVehicle (player) trailers[source][1] = createVehicle ( 435, 2682, -2127.5, 15, 0, 0, 90) -- create a trailer outputChatBox ( "A trailer will be attached", getRootElement(), 255, 0, 0 ) setTimer (attachTrailerToVehicle, 5000, 1, veh, trailer) -- Attach trailer to roadtrain after 5 sec end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), attachTrailer ) But that gave me this error: ERROR: editor_test\trialertable.lua:14: attempt to index field '?' (a nil value) And really me head spins, I could like maybe figure out how to get them in the table. But how are you using them? like: "setTimer (attachTrailerToVehicle, 5000, 1, veh, trailer)" what should I put on the part of the "trailer"
  8. okay, the tables are a step to high, i guess. local players = getElementsByType("player") local trailers = { createVehicle ( 435, 2682, -2127.5, 15, 0, 0, 90), createVehicle ( 435, 2682, -2127.5, 15, 0, 0, 90), createVehicle ( 435, 2682, -2127.5, 15, 0, 0, 90), createVehicle ( 435, 2682, -2127.5, 15, 0, 0, 90), createVehicle ( 435, 2682, -2127.5, 15, 0, 0, 90), } function attachTrailer () outputChatBox ( "A trailer will be attached, don't lose it or you will blow up!", getRootElement(), 255, 0, 0 ) for _,player in pairs(players) do veh = getPedOccupiedVehicle (player) setTimer (attachTrailerToVehicle, 3000, 1, veh, _,trailer in pairs(trailers)) -- Attach trailer to roadtrain after 1.5 sec end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), attachTrailer ) tried this, but that didn't work ofcourse. Can you guys give me a little help?
  9. Thank you so much, it works. so that tostring turns my variable into a string?? Cause i read something about it, but didn't quite understand it.
  10. Hello again, Apparently I really suck at scripting, so i need your help again guys. I got this code, and what I want is if the trailer and truck get to far from eachother on trailerdetach (so on like big high speed crash) they blow up. function trailerGone ( theTruck ) theTruckVehicle = theTruck theTruckTrailer = source trailerx, trailery, trailerz = getElementPosition(source) vehiclex, vehicley, vehiclez = getElementPosition (theTruckVehicle) outputChatBox ("X coordinate of trailer is " ..trailerx) outputChatBox ("X coordinate of vehicle is " ..vehiclex) dist = getDistanceBetweenPoints2D (vehiclex, vehicley, trialerx, trailery) if(getDistanceBetweenPoints2D (vehiclex, vehicley, trialerx, trailery) <= 20) then blowVehicle ( theTruckVehicle ) blowVehicle ( theTruckTrailer ) end end addEventHandler( "onTrailerDetach", getRootElement(), trailerGone ) Gives these errors: WARNING: race-convoytrucking\trailerattach.lua:8: Bad argument @ 'getDistanceBetweenPoints2D' WARNING: race-convoytrucking\trailerattach.lua:9: Bad argument @ 'getDistanceBetweenPoints2D' ERROR: race-convoytrucking\trailerattach.lua:9: attempt to compare boolean with number Now the problem is, I get a bad argument on the trailerx when it's compared to the vehiclex. (same with the y coordinates i guess) the outputbox trailerx and vehiclex is working fine thou, so why doesn't it work in the getDistanceBetweenPoints2D? edit: the source and theTruckTrailer part I switched already, don't make any difference.
  11. A table for each player? Not really familiar with tables yet, but okay thanks for the advice. Will try that.
  12. Hey Solidsnake, Thanks for the explanation, and I guess there's no way of fixing this right? (btw my solution for the trailers is good right? or do you have another solution?)
  13. Hey guys, back again, so now i adjusted the code (or rather just started from scratch) Now i create as many trailers and bagages as needed. And that all works (not for people entering during a race, but what the hell) --------------Multiple Trailers---------------- -----------------By: Stijger------------------- players = getElementsByType("player") addEvent("onRaceStateChanging", true) addEventHandler("onRaceStateChanging", getRootElement(), function(newStateName, oldStateName) if newStateName == "GridCountdown" then for _,player in pairs(players) do veh = getPedOccupiedVehicle (player) trailer = createVehicle ( 591, 1960, -2430, 15 ) veh2 = createVehicle (485, 1960, -2431.1, 15.1 ) setElementAlpha ( veh2, 0) trailer2 = createVehicle ( 591, 1960, -2439, 15 ) veh3 = createVehicle (485, 1960, -2441.1, 15.1 ) setElementAlpha ( veh3, 0) trailer3 = createVehicle ( 435, 1960, -2449, 15 ) setTimer (attachTrailerToVehicle, 1500, 1, veh, trailer) setTimer (attachElements, 2000, 1, veh2, trailer, 0, -1.1, 0.1) setTimer (attachTrailerToVehicle, 2500, 1, veh2, trailer2) setTimer (attachElements, 3000, 1, veh3, trailer2, 0, -1.1, 0.1) setTimer (attachTrailerToVehicle, 3500, 1, veh3, trailer3) end end end ) But now it's seems like i have a sync problem. At least I think, cause i have no idea. It seems for the player that the trailers of the other player come loose if they drive too fast. Which isn't the case, cause on the other players screen there's nothing wrong. And also the detached trailer appears to be dragged along but at a great distance, so they arent really loose. Youtube video: http://www.youtube.com/watch?v=rQxfTC9veSs
  14. Glad to hear you are still working on it. If you ever need a tester or anything, just let me know. Would love to help in any way possible .
  15. It really looks Awesome dude, how is the progress going on this? (oh and love the Hunter Bot also)
×
×
  • Create New...