Kenix Posted March 27, 2011 Share Posted March 27, 2011 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
eAi Posted March 27, 2011 Share Posted March 27, 2011 You know, map files are designed exactly for this and require you to write 0 lines of code. Link to comment
Dre-+- Posted March 27, 2011 Share Posted March 27, 2011 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
Kenix Posted March 27, 2011 Author Share Posted March 27, 2011 this not work not create peds but i fixing problem thx Citizen for old code Link to comment
Moderators Citizen Posted March 27, 2011 Moderators Share Posted March 27, 2011 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
Moderators Citizen Posted March 28, 2011 Moderators Share Posted March 28, 2011 Ok so good work ^^ Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now