Jump to content

not create peds on table


Kenix

Recommended Posts

script works but no create peds

bad argument@"createPed"

  
local pedstp1 = { 
{79,244, 1229, 16.14}, 
{78,247, 1227, 16.06}, 
{21,244, 1233, 16.31}, 
} 
  
function Createpeds( ) 
    local modelid1  = pedstp1[1] 
    local x1  = pedstp1[2] 
    local y1  = pedstp1[3] 
    local z1 = pedstp1[4] 
    createPed ( modelid1, x1, y1, z1 ) 
    outputChatBox("peds create")               
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Createpeds ) 
  

Link to comment
  
local pedstp1 = { {79,244, 1229, 16.14}, {78,247, 1227, 16.06}, {21,244, 1233, 16.31} } 
  
function Createpeds( ) 
    local pedstp = pedstp1[1] 
    local modelid1  = pedstp[1] 
    local x1  = pedstp[2] 
    local y1  = pedstp[3] 
    local z1 = pedstp[4] 
    createPed ( modelid1, x1, y1, z1 ) 
    outputChatBox("peds create")               
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Createpeds ) 
  

I think now it work

Link to comment
  • Moderators

Volk-rus,

I think I already tell you how to get values from a table:

It's yourTable[line][column] and not yourTable[column]

If you want to spawn the peds in the same time, it's like that:

local pedstp1 = { 
{79,244, 1229, 16.14},--the line #0 
{78,247, 1227, 16.06},--the line #1 
{21,244, 1233, 16.31},--the line #2 
} 
  
function Createpeds( ) 
    for k,i in ipairs ( pedstp1 ) do -- k start to 0 then 1, etc ... 
        -- local pedstp = pedstp1[k][1] -- what's that ? 
        local modelid1  = pedstp1[k][1] --  so if it's the 1st loop, k=0 so pedstp1[1][1] so 79 
        local x1  = pedstp1[k][2] -- at the 1st loop: 244     2nd Loop:1229 
        local y1  = pedstp1[k][3] -- etc 
        local z1 = pedstp1[k][4] -- etc 
        createPed ( modelid1, x1, y1, z1 ) 
        outputChatBox("Ped number "..(k+1).." created !") 
    end 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Createpeds ) 

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