Jump to content

how


Wei

Recommended Posts

How can I make this working ?

local thePickups =  
{ 
"1236.14709, -1326.85632, 13.76983" 
} 
  
function createPickups() 
    for i, n in pairs(thePickups) do 
    infopointpickup = createPickup(n, 3, 1239, 0.1) 
    end 
end 
addEventHandler("onResourceStart", getRootElement(), createPickups) 
  

And how can I add the text to them. Like Pickup 1 has position 0,0,0 and when i hit pickup 1 it outputs Pickup 1 text

Link to comment
local thePickups = 
    { 
        { 1236.14709, -1326.85632, 13.76983 } 
    } 
  
function createPickups ( ) 
    for i, n in pairs ( thePickups ) do 
        infopointpickup = createPickup ( n [ 1 ], n [ 2 ], n [ 3 ], 3, 1239, 0.1 ) 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, createPickups ) 

You we're using a STRING instead of 3 values: X, Y, Z.

Link to comment
local thePickups = 
    { 
        { 1236.14709, -1326.85632, 13.76983, "Hello World!" } 
    } 
  
function createPickups ( ) 
    for i, n in pairs ( thePickups ) do 
        local infopointpickup = createPickup ( n [ 1 ], n [ 2 ], n [ 3 ], 3, 1239, 0.1 ) 
        if ( infopointpickup ) then 
            setElementData ( infopointpickup, "text", n [ 4 ] ) 
        end 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, createPickups ) 

Then you can use getElementData to get the text of the pickup.

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