Jump to content

[DKR]silverfang

Members
  • Posts

    88
  • Joined

  • Last visited

Everything posted by [DKR]silverfang

  1. 1. When you create the vehicle in the script, create the element to attach then attach it... vehicle = createVehicle(.....) object = createObject(......) --In DP2.3 use attachElementToElement(object, vehicle, x, y, z, rx, ry, rz) --or in the nightlies use attachElements(object, vehicle, x, y, z, rx, ry, rz)
  2. Well you could use getAttachedElements ( element theElement ) (link) And then check to see if the elements attached are objects then use detachElements on the objects. This will only work if you want to detach all objects from the vehicle...
  3. You have added it to the meta and everything?
  4. Thanks this is really quite useful Can't wait until I finish my Coursework/Exams then I'll be back to MTA!
  5. And what is the solution? Ah that's easy... LEARN!! Until you learn the syntax for lua then you will not be able to code properly... http://lua-users.org/wiki/LuaTutorial if you're still having trouble then: http://tinyurl.com/deny6a
  6. Yeah my mistake anyways try this. function parameterTest (player, command, ...) parameterTable = {...} parameterTableString = table.concat(parameterTable, " ") outputChatBox("You typed: " .. parameterTableString .. "!", player) end addCommandHandler("command", parameterTest)
  7. To make the last parameter more than one word, you have to make the last argument '...' then use table.concat(..., " ") to break the table into a phrase (the '...' is a table)
  8. @ 50p I appreciate you trying to help but that's not what I'm after, could you have a look at My Topic and see if that explains it any better...
  9. I don't really Understand what you said. Hope the image helps...
  10. No, its not strange. Yours involves much more complicated math. If anyone knew it properly perhaps they'd help. How is it more complicated? Perhaps I don't understand the complexity of it. What level of maths are we talking A Level? Degree?
  11. Is it strange that this guy gets a few replies within a couple of hours and I don't get a single example in any of the replies in my thread of a similar problem. Since people are in this thread I will post my problem. Using Sin and Cos, X and Y, How do you position an object relative to a person/object. Any help would be appreciated.
  12. Would you care to explain in a little more detail what "quatornion (quaternion?) math and matrices" do in order to move it around the object. Thanks
  13. Wiki Page Right the offset values are in X,Y and Z. I can get the offset values (relative to the parent object) by playing around with the trig functions, but that takes some time and I have yet to find a rule of thumb for it, Can someone give me a quick rundown on each (cos, sin, -cos, -sin) and explain how you would use them to position an object around another object/element. Thanks in advance (I lack the sideways thinking to work it out)
  14. That's not true. You can call setTimer anywhere and anytime you want. Even when it's in the body of your script. huh never knew that... but it's just as good to put it in a function handling onResourceStart...
  15. Hi there, there are a few problems with your code. Firstly timers have to be declared in a function, your best bet is to do that in a function linked to the onResourceStart Event Secondly you cannot call the variable 'source' unless it is from an event. Info: Source
  16. Yeah, I've been using alot of PHP lately and if you'd read my code you would have seen that I wasn't sure if it worked in LUA or not... Have edited the snippet now...
  17. function startRace () position = 1 enter3 = createMarker ( -1148.4782, 345.7957, 13.6835, "cylinder", 30, 125, 0, 0, 155, getRootElement() ) addEventHandler("onMarkerHit", enter3, MarkerHit) end addCommandHandler("race", startRace) function MarkerHit ( hitPlayer, matchingDimension ) if position = 1 then outputChatBox ( getClientName(hitPlayer).. " has won the race!" ) position = position + 1 elseif position = 2 then outputChatBox ( getClientName(hitPlayer).. " has come second!" ) position = position + 1 elseif position = 3 then outputChatBox ( getClientName(hitPlayer).. " has come third!" ) --remove event handler so this function doesn't get called again! removeEventHandler("onMarkerHit", enter3,MarkerHit) destroyElement(enter3) end end I've edited it a bit so it'll do exactly what you want for dp2.3
  18. If you can't follow the instructions posted to you then you aren't capable of running a server by yourself... Get Mummy to help.
  19. 2. Most people are tied to a server anyway, or have no time to script only help when needed. 3. mysql, nuff said 4. ^^ 8. start resource Type /objbrowser 9. There is only one way to have a car with a custom numberplate, that is create it... 10. Easier than you might think... have a /joinchannel and a /channelspeak command... I'll leave the rest to you...
  20. Seriously if you think that its so easy why don't you do it yourself? Here is a start! Wow there is no need for both of you to be aggressive especially scarface, I was just trying to think of a reasonable compromise for the arguments in this thread, this is the Suggestions forum after all... And Gamesnert < there is nothing to stop players using window mode and 'alt-tab'ing to give them an advantage... And it still ruins the sync, so it's kind of a void argument tbh...
  21. If it's easy enough in MTA to ban alt-tabbing then surely it would be easy to allow it, but have a scriptable function so in some gamemodes it could be banned if it gave a player an advantage...
  22. Yes that would work fine but for your purposes the onColShapeLeave Event would be more efficient. Also you might want to make it so it's only triggered by vehicles... like this: theToll = createObject ( 968, -1673.86, 522.395, 38.1261, 0, -90, -45 ) theBox = createObject ( 966, -1673.86, 522.395, 37.2995, 0, 0, -45 ) theSphere = createColSphere ( -1676.54, 525.193, 37.67, 5 ) tollOpen = false --Add variable to show the status of the toll function tollUp (theVehicle) if getElementType ( theVehicle ) == "vehicle" and (not tollOpen) then --Test to see if it is a vehicle that hit it and the toll is closed vehicleElement = theVehicle moveObject ( theToll, 1000, -1673.86, 522.395, 38.1261, 0, 90, 0 ) --setTimer ( tollDown, 2000, 1 ) tollOpen = true end end function tollDown (theElement) if theElement == vehicleElement and (tollOpen) then -- Test to see if the Element leaving and the vehicle that triggered the toll are the same and the toll is open moveObject ( theToll, 1000, -1673.86, 522.395, 38.1261, 0, -90, 0 ) tollOpen = false end end addCommandHandler ( "sfseup", tollUp ) addCommandHandler ( "sfsedown", tollDown ) addEventHandler ( "onColShapeHit", theSphere, tollUp ) addEventHandler ( "onColShapeLeave", theSphere, tollDown ) Tested and it is perfect ... Have fun. EDITS: I have edited it a few times, as when many people arrived or left the the barrier would keep moving around so you had the barrier at funny angles. Should be perfect for what ever you want it for (NOW)
×
×
  • Create New...