Jump to content

[Help] Stack overflow


Miika

Recommended Posts

in the line 3 you define a function called createPed and in the line 8 you call createPed(...), this cause an infinite loop.

you could do something like this:

defaultCreatePed = createPed 
  
function createPed() 
    for i=1,#ped do 
        if (isElement(worker[i])) then 
            destroyElement(worker[i]) 
        else 
            worker[i] = defaultCreatePed (ped[i][5], ped[i][1], ped[i][2], ped[i][3], ped[i][4]) 
        end 
    end 
end 

Link to comment
in the line 3 you define a function called createPed and in the line 8 you call createPed(...), this cause an infinite loop.

you could do something like this:

defaultCreatePed = createPed 
  
function createPed() 
    for i=1,#ped do 
        if (isElement(worker[i])) then 
            destroyElement(worker[i]) 
        else 
            worker[i] = defaultCreatePed (ped[i][5], ped[i][1], ped[i][2], ped[i][3], ped[i][4]) 
        end 
    end 
end 

Or you could avoid cancer code like that and simply not name your function "createPed".

Link to comment
in the line 3 you define a function called createPed and in the line 8 you call createPed(...), this cause an infinite loop.

you could do something like this:

defaultCreatePed = createPed 
  
function createPed() 
    for i=1,#ped do 
        if (isElement(worker[i])) then 
            destroyElement(worker[i]) 
        else 
            worker[i] = defaultCreatePed (ped[i][5], ped[i][1], ped[i][2], ped[i][3], ped[i][4]) 
        end  
    end 
end 

Or you could avoid cancer code like that and simply not name your function "createPed".

Yeah, i renamed the function.

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