Jump to content

[Help] How to get spawnpoint ID


BieHDC

Recommended Posts

Posted

Hello,

i wanted to know how to get the spawnpoint id from a map file

the id is given from a string...

...but how to get this string

Because if the string is in this example "THEID" i wanna do some sets for this.

i have already found !getElementsByType("spawnpoint")! , but i think this wont be neccersary :)

edit: or tell me how to use the full string like...

vehicle, x, y, z, rx, ry, rz = ineedsomeinfo ( THEID )

Please help me, thankes

Posted

Try this:

local element = getElementByID ( "THEID" ) 
if isElement ( element ) then 
    local allData = getAllElementData ( element ) 
    for data, value in pairs ( allData ) do 
        outputChatBox ( data ..": ".. value ) 
    end 
end 

Posted
    function getMapData(data,valueData) 
        if ( data and valueData ) then 
            for i,v in ipairs(getElementsByType(data)) do 
                if ( v ) then 
                    local value = getElementData(v,valueData) 
                    if ( value ) then 
                        return value 
                    else 
                        return outputDebugString("Bad Argument value data .",1) 
                    end 
                else 
                    return outputDebugString("Bad Argument data .",1) 
                end 
            end 
        else 
            return outputDebugString("Please Add data / value data .",1) 
        end 
    end 

id = getMapData("spawnpoint","id") 
vehicle = getMapData("spawnpoint","vehicle") 
posX = getMapData("spawnpoint","posX") 
posY = getMapData("spawnpoint","posY") 
posZ= getMapData("spawnpoint","posZ") 
rotX = getMapData("spawnpoint","rotX") 
rotY = getMapData("spawnpoint","rotY") 
rotZ = getMapData("spawnpoint","rotZ") 
outputChatBox("Id = "..id.." vehicle = "..vehicle.." posX = "..posX.." posY = "..posY.." posZ = "..posZ.." rotX = "..rotX.." rotY = "..rotY.." rotZ = "..rotZ 

Posted

ok thx i will try this

edit: but i wanna get the vehicle, posx ... from spawnpoint id

but what you wrote is only to get all spawnpoints and all data from them

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