Jump to content

Auto Spam


Monument

Recommended Posts

Hello

 

i want to create Objects
But in an organized way

maybe

 

Creation = 10
X Change = 5
Y Change = 6

when Creation = 10

then Automatically Create 10 Objects
When Create 10 Objects

The difference between each Object 1 and Object 2  = ' 5 x '

And in Y ' 6 y '

 

 

Thanks !
 

Link to comment
  • Moderators

Something like:

local creation  = 10
local x_change  = 5
local y_change  = 6

local object_id = 955
local start_x, start_y, start_z = 0, 0, 3

for i = 1, creation do
    createObject(object_id, start_x + i*x_change, start_y + i*y_change, start_z)
end

 

Link to comment
9 minutes ago, Patrick said:

Something like:


local creation  = 10
local x_change  = 5
local y_change  = 6

local object_id = 955
local start_x, start_y, start_z = 0, 0, 3

for i = 1, creation do
    createObject(object_id, start_x + i*x_change, start_y + i*y_change, start_z)
end

 

thx its work good

can i make name for it ?
maybe object and it number

Link to comment
  • Moderators
5 hours ago, Monument said:

the script make 10 object right ?

for example i want getElementPosition

to object number 2
but i can't because the element without name

i try to do that




Object[i] = createObject(..................)
-- i = number from 1 to 10 In the example above
getElementPosition(Object[2])

 

local creation  = 10
local x_change  = 5
local y_change  = 6

local object_id = 955
local start_x, start_y, start_z = 0, 0, 3

local objects   = {}

for i = 1, creation do
    objects[i] = createObject(object_id, start_x + i*x_change, start_y + i*y_change, start_z)
end

function getPositionOf(index)
    return (index and objects[index]) and getElementPosition(objects[index]) or false
end

local x, y, z = getPositionOf(2)
iprint(x, y, z)

 

Here are some excellent resources to learn the basics of Lua scripting:

- https://wiki.multitheftauto.com/wiki/Main_Page
- https://wiki.multitheftauto.com/wiki/Scripting_Introduction
- https://www.lua.org/manual/5.1/
- https://wiki.multitheftauto.com/wiki/Category:Tutorials
- https://forum.multitheftauto.com/topic/34453-manuals

- https://forum.multitheftauto.com/topic/64228-the-ultimate-lua-tutorial/
- https://forum.multitheftauto.com/topic/121619-lua-for-absolute-beginners
- https://forum.multitheftauto.com/topic/95654-tut-debugging/
- https://forum.multitheftauto.com/topic/114541-tut-events/
- https://forum.multitheftauto.com/topic/117472-tut-scaling-dx/

Videos: https://www.youtube.com/watch?v=Goqj5knKLQM&list=PLY2OlbN3OoCgTGO7kzQfIKPj4tJbYOgSR

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