Jump to content

Create marker over and over again


Tete omar

Recommended Posts

Hello there.

function trucko(thePlayer) 
    setElementData(thePlayer,"loling",0) 
        destroyElement( Marker ) 
            givePlayerMoney( thePlayer ,3000 ) 
    local Marker2 = createMarker( 2642.740234375, -1791.4304199219, 9.734375, "cylinder", 2, 0, 0, 0 ) 
        addEventHandler("onMarkerHit", Marker2, function() 
            setElementData(thePlayer,"lolingsz",1) 
                destroyElement( Marker2 ) 
                    givePlayerMoney( thePlayer ,4000 ) 
        end) 
end 
addEventHandler("onMarkerHit", Marker, trucko) 

here's if the player hit Marker then create Marker2

i want here if the player hit Marker2 then create Marker again etc.. etc.. etc..

Link to comment

sorry !! i forgot something

local Marker = createMarker( 2642.814453125, -1739.0861816406, 9.734375, "cylinder", 2, 0, 0, 0 ) 
  
function Trucko(thePlayer) 
    setElementData(thePlayer,"wder",0) 
        destroyElement( Marker ) 
            givePlayerMoney( thePlayer ,3000 ) 
    local Marker2 = createMarker( 2642.740234375, -1791.4304199219, 9.734375, "cylinder", 2, 0, 0, 0 ) 
        addEventHandler("onMarkerHit", Marker2, function() 
            setElementData(thePlayer,"wderz",1) 
                destroyElement( Marker2 ) 
                    givePlayerMoney( thePlayer ,4000 ) 
        end) 
end 
addEventHandler("onMarkerHit", Marker, Trucko) 

I don't understand what are you trying to do.

i made here when the player hit the " Marker " then create another marker and it's "Marker2"

if i hit "Marker2" i think everything done , i want to repeat the action and recreate " Marker " again you understand me now ?

Link to comment
sorry !! i forgot something
local Marker = createMarker( 2642.814453125, -1739.0861816406, 9.734375, "cylinder", 2, 0, 0, 0 ) 
  
function Trucko(thePlayer) 
    setElementData(thePlayer,"wder",0) 
        destroyElement( Marker ) 
            givePlayerMoney( thePlayer ,3000 ) 
    local Marker2 = createMarker( 2642.740234375, -1791.4304199219, 9.734375, "cylinder", 2, 0, 0, 0 ) 
        addEventHandler("onMarkerHit", Marker2, function() 
            setElementData(thePlayer,"wderz",1) 
                destroyElement( Marker2 ) 
                    givePlayerMoney( thePlayer ,4000 ) 
        end) 
end 
addEventHandler("onMarkerHit", Marker, Trucko) 

I don't understand what are you trying to do.

i made here when the player hit the " Marker " then create another marker and it's "Marker2"

if i hit "Marker2" i think everything done , i want to repeat the action and recreate " Marker " again you understand me now ?

local Marker = createMarker( 2642.814453125, -1739.0861816406, 9.734375, "cylinder", 2, 0, 0, 0 ) 
  
function Trucko(thePlayer) 
    setElementData(thePlayer,"wder",0) 
        destroyElement( Marker ) 
            givePlayerMoney( thePlayer ,3000 ) 
Marker2 = createMarker( 2642.740234375, -1791.4304199219, 9.734375, "cylinder", 2, 0, 0, 0 ) 
        addEventHandler("onMarkerHit", Marker2, function() 
            setElementData(thePlayer,"wderz",1) 
                destroyElement( Marker2 ) 
                    givePlayerMoney( thePlayer ,4000 ) 
Marker = createMarker( 2642.814453125, -1739.0861816406, 9.734375, "cylinder", 2, 0, 0, 0 ) 
        end) 
end 
addEventHandler("onMarkerHit", Marker, Trucko) 

Link to comment

Not really sure with this but considering the lot of other options, It would not be surprising to see how they are going to pan out just like that.

WIth regard to the markers, there are some hits and misses that you might as well consider as blunders with putting everything together. Hope that helps you out with the issue.

Looks really interesting to see it actually.

Link to comment
You mean a route system?

route system ??

what about it ?

-------------------------------------------------------------------------------------------------------------------

Just make a table of positions and then make the function(s) call the table and create the next marker when you hit a marker. Easy as what.

didn't you understand what i want yet ?

Link to comment

Please, learn LUA first before starting to ask these questions which can be solved with one function.

Commands

  • /playmarker - Warps you to the marker play thing..

local marker1 = createMarker(-18.08, 25.42, 2.11, "cylinder", 3, 255, 0, 255, 100) 
  
addEventHandler("onMarkerHit", root, 
    function(hitElement, matchingDimension) 
        if getElementType(hitElement) == "player" and matchingDimension then 
            if source == marker1 then 
                destroyElement(marker1) 
                marker2 = createMarker(-13.13, 33.48, 2.11, "cylinder", 3, 255, 0, 255, 100) 
                playSoundFrontEnd(hitElement, 1) 
                givePlayerMoney(hitElement, 4000) 
            elseif source == marker2 then 
                destroyElement(marker2) 
                marker1 = createMarker(-18.08, 25.42, 2.11, "cylinder", 3, 255, 0, 255, 100) 
                playSoundFrontEnd(hitElement, 1) 
                givePlayerMoney(hitElement, 4000) 
            end 
        end 
    end 
) 
  
addCommandHandler("playmarker", 
    function(player, cmd) 
        if getPedOccupiedVehicle(player) then removePedFromVehicle(player) end 
        setElementPosition(player, -8.83, 26.15, 3.11) 
        setElementInterior(player, 0) 
        setElementDimension(player, 0) 
    end 
) 

Link to comment
Please, learn LUA first before starting to ask these questions which can be solved with one function.

Commands

  • /playmarker - Warps you to the marker play thing..

local marker1 = createMarker(-18.08, 25.42, 2.11, "cylinder", 3, 255, 0, 255, 100) 
  
addEventHandler("onMarkerHit", root, 
    function(hitElement, matchingDimension) 
        if getElementType(hitElement) == "player" and matchingDimension then 
            if source == marker1 then 
                destroyElement(marker1) 
                marker2 = createMarker(-13.13, 33.48, 2.11, "cylinder", 3, 255, 0, 255, 100) 
                playSoundFrontEnd(hitElement, 1) 
                givePlayerMoney(hitElement, 4000) 
            elseif source == marker2 then 
                destroyElement(marker2) 
                marker1 = createMarker(-18.08, 25.42, 2.11, "cylinder", 3, 255, 0, 255, 100) 
                playSoundFrontEnd(hitElement, 1) 
                givePlayerMoney(hitElement, 4000) 
            end 
        end 
    end 
) 
  
addCommandHandler("playmarker", 
    function(player, cmd) 
        if getPedOccupiedVehicle(player) then removePedFromVehicle(player) end 
        setElementPosition(player, -8.83, 26.15, 3.11) 
        setElementInterior(player, 0) 
        setElementDimension(player, 0) 
    end 
) 

Are you kidding me ? , this is absolutely out of the subject and you telling me learn lua ?

thanks anyway it's not what i want also it's not working correctly.

sorry !! i forgot something
local Marker = createMarker( 2642.814453125, -1739.0861816406, 9.734375, "cylinder", 2, 0, 0, 0 ) 
  
function Trucko(thePlayer) 
    setElementData(thePlayer,"wder",0) 
        destroyElement( Marker ) 
            givePlayerMoney( thePlayer ,3000 ) 
    local Marker2 = createMarker( 2642.740234375, -1791.4304199219, 9.734375, "cylinder", 2, 0, 0, 0 ) 
        addEventHandler("onMarkerHit", Marker2, function() 
            setElementData(thePlayer,"wderz",1) 
                destroyElement( Marker2 ) 
                    givePlayerMoney( thePlayer ,4000 ) 
        end) 
end 
addEventHandler("onMarkerHit", Marker, Trucko) 

I don't understand what are you trying to do.

i made here when the player hit the " Marker " then create another marker and it's "Marker2"

if i hit "Marker2" i think everything done , i want to repeat the action and recreate " Marker " again you understand me now ?

Just make a table of positions and then make the function(s) call the table and create the next marker when you hit a marker. Easy as what.

Edited by Guest
Link to comment

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...