Jump to content

Stijger

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by Stijger

  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)
  16. Another try, Anybody?? if not, it's okay. but just curious.
  17. Nobody has any idea why the second code doesn't work?
  18. Okey, found one solution. I use a different vehicle (a baggagecar in this case) and use the function attachElements (with offsets) to attach this to the trailer. And the other trailer I attach to this baggage so it's nice and straight. Used Code function attachTrailer ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 515 ) then -- if its a roadtrain trailer = createVehicle ( 591, 1990, -2390, 18 ) -- create a trailer veh2 = createVehicle (485, 1990, -2392, 18 ) -- create tugtrailer for coupling setVehicleWheelStates ( veh2, 2, 2, 2, 2) trailer2 = createVehicle ( 591, 1990, -2395, 18 ) -- create a trailer veh3 = createVehicle (485, 1990, -2397, 18 ) -- create tugtrailer for coupling setVehicleWheelStates ( veh3, 2, 2, 2, 2) trailer3 = createVehicle ( 435, 1990, -2400, 18 ) -- create a trailer setTimer (attachTrailerToVehicle, 5000, 1, theVehicle, trailer) -- Attach trailer to car after 5 sec setTimer (attachElements, 6000, 1, veh2, trailer, 0, -1.1, 0.1) -- Attach trailer to car after 7.5 sec setTimer (attachTrailerToVehicle, 7000, 1, veh2, trailer2) -- Attach trailer to car after 10 sec setTimer (attachElements, 8500, 1, veh3, trailer2, 0, -1.1, 0.1) -- Attach trailer to car after 12.5 sec setTimer (attachTrailerToVehicle, 10000, 1, veh3, trailer3) -- Attach trailer to car after 15 sec detachTrailerFromVehicle(theVehicle, trailer2) --detach the newly attached trailer detachTrailerFromVehicle(theVehicle, trailer3) --detach the newly attached trailer detachTrailerFromVehicle(theVehicle, veh2) --detach the newly attached trailer detachTrailerFromVehicle(theVehicle, veh3) --detach the newly attached trailer end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), attachTrailer ) function textTrailer () outputChatBox("A couple of trailers will be attached") end addEventHandler ( "onResourceStart", getRootElement(), textTrailer ) So that code works, but i wanted it to start when the countdown started, so I wrote this: --------------Multiple Trailers---------------- -----------------By: Stijger------------------- local trailer = createVehicle ( 591, 1990, -2390, 15 ) -- create a trailer local veh2 = createVehicle (485, 1990, -2391.1, 15.1 ) -- create bagagecar for coupling trailers setElementAlpha ( veh2, 0) --make the baggagecar invisble local trailer2 = createVehicle ( 591, 1990, -2400, 15 ) -- create a trailer local veh3 = createVehicle (485, 1990, -2401.1, 15.1 ) -- create bagagecar for coupling trailers setElementAlpha ( veh3, 0) --make the baggagecar invisble local trailer3 = createVehicle ( 435, 1990, -2410, 15 ) -- create a trailer addEvent('onRaceStateChanging', true) addEventHandler('onRaceStateChanging', getRootElement(), function(newstate, oldstate) if newstate == 'GridCountdown' then --start timer attaching at start countdown outputChatBox("A couple of trailers will be attached", getRootElement(), 255, 0 , 0) for _,veh in pairs(getElementsByType("vehicle")) do if getElementModel(veh) == 515 then -- if its a roadtrain setTimer (attachTrailerToVehicle, 1500, 1, veh, trailer) -- Attach trailer to roadtrain after 1.5 sec setTimer (attachElements, 2000, 1, veh2, trailer, 0, -1.1, 0.1) -- Attach trailer to car after 2 sec setTimer (attachTrailerToVehicle, 2500, 1, veh2, trailer2) -- Attach trailer to car after 2.5 sec setTimer (attachElements, 3000, 1, veh3, trailer2, 0, -1.1, 0.1) -- Attach trailer to car after 3 sec setTimer (attachTrailerToVehicle, 3500, 1, veh3, trailer3) -- Attach trailer to car after 3.5 sec end end end end ) And that kinda works, but only for the player that enters the server first. Any ideas guys to why this code don't work?
  19. Hey guys, Quick question. Is there any chance you can put an offset to the attachTrailerToVehicle function like in the attachElements function. Would be awesome to like attach a trailer to another without it being attached weird to the bottom of the other trailer. Like it is now. Code used: function attachTrailer ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 515 ) then -- if its a roadtrain trailer = createVehicle ( 435, 305, 1855, 18 ) -- create a trailer trailer2 = createVehicle ( 435, 305, 1855, 18 ) -- create another trailer attachTrailerToVehicle (theVehicle, trailer) -- Attach trailer to car attachTrailerToVehicle (trailer, trailer2) -- Attach trailer2 to trailer outputChatBox("Trailers attached, don't lose it or you blow up!") end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), attachTrailer )
  20. Hey Kenix, Thanks for your help man, Found that in the wiki for setVehicleHandling there's a explantion too (so sry for that) But still lot's of thanks. Lua as it now. function handling ( ) for _,veh in pairs(getElementsByType("vehicle")) do if getElementModel(veh) == 560 then setVehicleHandling (veh, "mass", 1600) setVehicleHandling(veh, "turnMass", 3921.3) setVehicleHandling(veh, "dragCoeff", 1.8 ) setVehicleHandling(veh, "centerOfMass", { 0, -0.4, 0 } ) setVehicleHandling(veh, "percentSubmerged", 75) setVehicleHandling(veh, "tractionMultiplier", 0.75) setVehicleHandling(veh, "tractionLoss", 0.85) setVehicleHandling(veh, "tractionBias", 0.52) setVehicleHandling(veh, "numberOfGears", 5) setVehicleHandling(veh, "maxVelocity", 400) setVehicleHandling(veh, "engineAcceleration", 20 ) setVehicleHandling(veh, "engineInertia", 10) setVehicleHandling(veh, "driveType", "rwd") setVehicleHandling(veh, "engineType", "petrol") setVehicleHandling(veh, "brakeDeceleration", 10) setVehicleHandling(veh, "brakeBias", 0.53) setVehicleHandling(veh, "steeringLock", 35) setVehicleHandling(veh, "suspensionForceLevel", 1.3) setVehicleHandling(veh, "suspensionDamping", 0.12) setVehicleHandling(veh, "suspensionHighSpeedDamping", 0) setVehicleHandling(veh, "suspensionUpperLimit", 0.28 ) setVehicleHandling(veh, "suspensionLowerLimit", -0.12) setVehicleHandling(veh, "suspensionFrontRearBias", 0.38 ) setVehicleHandling(veh, "suspensionAntiDiveMultiplier", 0) setVehicleHandling(veh, "seatOffsetDistance", 0.2) setVehicleHandling(veh, "collisionDamageMultiplier", 0.24) setVehicleHandling(veh, "monetary", 25000) setVehicleHandling(veh, "modelFlags", 0x40000000) setVehicleHandling(veh, "handlingFlags", 0x10200008 ) setVehicleHandling(veh, "headLight", 0) setVehicleHandling(veh, "tailLight", 1) setVehicleHandling(veh, "animGroup", 0) end end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), handling ) Crazy Acceleration and maxspeed for sultan This makes putting mod on the map with the intented handling lot's easier.
  21. Still WARNING: race-turningpoint2\handling2.lua:2: Bad 'ped' pointer @ 'isPedInVehicle'(1)
  22. Hey guys, After finding this site to convert a handling.cfg into lua code, (http://www.potholestudios.com/Content/pid=45.html) i have been trying to get it working. But no luck. First noob mistake was that setVehicleHandling is a serverfunction, not clientside. So i began on the serverside script, but all i get is a bad argument or bad 'ped' pointer. This is the latest script i got, function handling ( ) local isVeh = isPedInVehicle( source ) if isVeh then local veh = getPedOccupiedVehicle ( source ) local handling = getVehicleHandling(veh) setVehicleHandling(veh, "mass", 1600) setVehicleHandling(veh, "turnMass", 3921.3) setVehicleHandling(veh, "dragCoeff", 1.8 ) setVehicleHandling(veh, "centerOfMass", { 0, -0.4, 0 } ) setVehicleHandling(veh, "percentSubmerged", 75) setVehicleHandling(veh, "tractionMultiplier", 0.75) setVehicleHandling(veh, "tractionLoss", 0.85) setVehicleHandling(veh, "tractionBias", 0.52) setVehicleHandling(veh, "numberOfGears", 5) setVehicleHandling(veh, "maxVelocity", 200) setVehicleHandling(veh, "engineAcceleration", 8.8 ) setVehicleHandling(veh, "engineInertia", 10) setVehicleHandling(veh, "driveType", "rwd") setVehicleHandling(veh, "engineType", "petrol") setVehicleHandling(veh, "brakeDeceleration", 10) setVehicleHandling(veh, "brakeBias", 0.53) setVehicleHandling(veh, "ABS", 0) setVehicleHandling(veh, "steeringLock", 35) setVehicleHandling(veh, "suspensionForceLevel", 1.3) setVehicleHandling(veh, "suspensionDamping", 0.12) setVehicleHandling(veh, "suspensionHighSpeedDamping", 0) setVehicleHandling(veh, "suspensionUpperLimit", 0.28 ) setVehicleHandling(veh, "suspensionLowerLimit", -0.12) setVehicleHandling(veh, "suspensionFrontRearBias", 0.38 ) setVehicleHandling(veh, "suspensionAntiDiveMultiplier", 0) setVehicleHandling(veh, "seatOffsetDistance", 0.2) setVehicleHandling(veh, "collisionDamageMultiplier", 0.24) setVehicleHandling(veh, "monetary", 25000) setVehicleHandling(veh, "modelFlags", 0x40000000) setVehicleHandling(veh, "handlingFlags", 0x10200008 ) setVehicleHandling(veh, "headLight", 0) setVehicleHandling(veh, "tailLight", 1) setVehicleHandling(veh, "animGroup", 0) end end addEventHandler ( "onResourceStart", getRootElement ( ), handling ) and that gives the error: WARNING: race-turningpoint2\handling2.lua:2: Bad 'ped' pointer @ 'isPedInVehicle'(1) Please help out, guys. I really don't know what i am doing wrong and thanks in advance.
  23. Stijger

    God like car

    Hey SDK, Awesome, it works after taking one hit. Made it into this. addEventHandler("onVehicleDamage", root, function() cancelEvent() outputChatBox ( getVehicleName ( source ) .. " was damaged and made god-like" ) setVehicleDamageProof ( source, true ) end) Thank you very much. For helping with the script and the explaining about scripting, you really helped a lot.
  24. Stijger

    God like car

    And the race script is why it does work with the maker ofcourse, cause that after the unfreeze. (maybe a bit obvious, but still learning ) isn't there a command to start it after the countdown? could that work? And thanks for explaining how you debug, it's pretty standard actually, almost the same with electronics debugging (more my area)
×
×
  • Create New...