Jump to content

Map Script[HELP]


Kleonx

Recommended Posts

Posted (edited)

I'm trying to make a Script for my [DM](Race) Map. It should make that helicopter takes you to a other spot by moving in the air(like showed in the video), but i can't figure out how to do it

I tried it like that:

local marker2 = createMarker ( 3810.6022949219, -4888.4013671875, 56.759799957275, "corona", 10,0,0,0) 
  
function onMarkerHitt ( thePlayer, matchingDimension ) 
    if thePlayer == getLocalPlayer() then 
        if source == marker2 then 
            Copter = createObject( 1318, 3800.6022949219, 4888.4013671875, 56.759799957275, 334, 0, 260 ) 
            setElementInterior ( Copter, 1 ) 
            attachElements ( createVehicle ( 417, 3800.6022949219, 4888.4013671875, 56.759799957275, 334, 0, 260 ), Copter, 0, 0, 0, 0, 0, 0 ) 
            moveObject( Copter, 3100, 3810.6022949219, 4888.4013671875, 56.759799957275, 50, 50, 62 ) 
        end  
    end 
end 
addEventHandler ( "onClientMarkerHit", root, onMarkerHitt ) 

Can someone help me

(If you don't know what i mean, watch this video:

1:00-1:05 I want that the script makes that)

Thanks for every help guys!!!

Edited by Guest
Posted
Can you put the code between [lua ] [ /lua] tags?

And also tell us What exactly are you trying to do.

Teleport the heli or just move it.

Updated!

Posted

I made this for you, but i don't know how to "unattach" the vehicle, you can test it in grove street

marker = createMarker (2491.6806640625, -1668.9609375, 13.066841125488, "corona", 1, 255, 0, 0, 255) 
  
function onMarkerHit (thePlayer) 
    local vehicle = getPedOccupiedVehicle (thePlayer) 
    if thePlayer == getLocalPlayer () then 
        if source == marker then 
            copter = createObject (1318, 2491.6806640625, -1668.9609375, 16.066841125488, 334, 0, 260) 
            hunter = createVehicle (425, 2491.6806640625, -1668.9609375, 16.066841125488, 0, 0, 87.692321777344) 
            setElementCollisionsEnabled (hunter, false) 
            attachElements (hunter, copter, 0, 0, 0, 0, 0, 0 ) 
            attachElements (vehicle, copter, 0, 0, -2, 0, 0, 0 ) 
            moveObject (copter, 3100, 4000.6806640625, -1668.9609375, 160.066841125488, 0, 0, 0) 
        end 
    end 
end 
addEventHandler ("onClientMarkerHit", root, onMarkerHit) 

EDIT: I had not thought of this, you can now Unattach [sorry for bad english, i use translate xD]

marker = createMarker (2491.6806640625, -1668.9609375, 13.066841125488, "corona", 1, 255, 0, 0, 255) 
  
function onMarkerHit (thePlayer) 
    local vehicle = getPedOccupiedVehicle (thePlayer) 
    if thePlayer == getLocalPlayer () then 
        if source == marker then 
            copter = createObject (1318, 2491.6806640625, -1668.9609375, 16.066841125488, 334, 0, 260) 
            hunter = createVehicle (425, 2491.6806640625, -1668.9609375, 16.066841125488, 0, 0, 87.692321777344) 
            setElementCollisionsEnabled (hunter, false) 
            attachElements (hunter, copter, 0, 0, 0, 0, 0, 0 ) 
            attachElements (vehicle, copter, 0, 0, -2, 0, 0, 0 ) 
            moveObject (copter, 3100, 4000.6806640625, -1668.9609375, 160.066841125488, 0, 0, 0) 
            setTimer (function () destroyElement (copter) end, 3100, 1) 
            setTimer (function () destroyElement (hunter) end, 3100, 1) 
        end 
    end 
end 
addEventHandler ("onClientMarkerHit", root, onMarkerHit) 

adjust the timer :P

Posted

Why two timers here

f88674a236.png

  
setTimer (function ()  
if isElement(copter) and isElement(huter) then  
    destroyElement (copter)  
    destroyElement (hunter) 
    end 
end ,3100,1) 
  

Posted
Why two timers here

f88674a236.png

  
setTimer (function ()  
if isElement(copter) and isElement(huter) then  
    destroyElement (copter)  
    destroyElement (hunter) 
    end 
end ,3100,1) 
  

Sorry, I'm still learning, thanks for the clarification

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...