Jump to content

createMarker (corona).


bandi94

Recommended Posts

I just wanna ask if the "createMarker" atleast the corona tipe , is bugged ??

I am generating 8 corona type marker inside a "for" loop. But only 6 are created , so i changed the 8 to 6 , then only 4 are generated, alway's 2 are not generated.

And i am not hitting the 34 limit. Bk every created corona is destroyed after 4s. Even i made a lopp checking getElementsByType("Marker") , and there are only the marker's generated by me = 8 .

Is this happening to other's to ?

Link to comment
for i=1, 8 do 
    local newX, newY = getPointFromDistanceRotation(x, y, 15, 360 * (i/8)); 
  
        local marker_round =createMarker(x,y,z,"corona",3,math.random(255),math.random(255),math.random(255),255) 
        local dumy_round =  createObject(1235,x,y,z) 
        attachElements(marker_round,dumy_round) 
        moveObject(dumy_round,4000,newX,newY,z-20,0,0,0,"OutQuad")  
       setTimer(destroyElement,4000,1,marker_round) 
        setTimer(destroyElement,4000,1,dumy_round) 
  
 end 

object 1235 is a small trash bin , created to can move the marker. The trash bin is created and i can see it moveing but the marker is not created / attached to it

Link to comment
  • Moderators

You should watch out with those timers, they can destroy your whole server performance.

I don't know what the problem is, every seems fine except for the amount of timers for some elements.

Try this and make check if the markers got created:

local elementTable = {} 
for i=1, 8 do 
    local newX, newY = getPointFromDistanceRotation(x, y, 15, 360 * (i/8)); 
  
    local marker_round = createMarker(x,y,z,"corona",3,math.random(255),math.random(255),math.random(255),255) 
    local dumy_round =  createObject(1235,x,y,z) 
     
    attachElements(marker_round,dumy_round) 
    moveObject(dumy_round,4000,newX,newY,z-20,0,0,0,"OutQuad") 
     
    elementTable[#elementTable+1]=marker_round 
    elementTable[#elementTable+1]=dumy_round 
  
    if marker_round then 
        outputChatBox("marker successfully created, marker number: " .. i) 
    end 
end 
  
setTimer(function() 
    for i=1,#elementTable do 
        local element = elementTable[i] 
        if isElement(element) then 
            destroyElement(element) 
        end 
    end 
end,4000,1) 

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