Jump to content

setElementData on resource start?


Xwad

Recommended Posts

why is the data not saving when i start the resource?

server sided

function create() 
local main = createObject ( 2983, -1330.6999511719, -29.39999961853, 13, 0, 1.5, 0 ) 
local top = createObject ( 2985, -1331.0999755859, -29.39999961853, 12.9, 0, 13.75, 0 ) 
local veh = createVehicle ( 457, -1330.7998046875, -31.099609375, 14.2, 0, 0, 271.99951171875 ) 
  
attachElements(veh, top, 0,-1.6,2,0,0,271.99951171875) 
setElementAlpha(veh, 0) 
  
setElementData(source, "top", top) 
end 
addEventHandler ( "onResourceStart", getRootElement(), create ) 
  
  
  
function check() 
local test = getElementData(source "top") 
destroyElement(test) 
end 
addCommandHandler("t", check) 
  
  
  

Link to comment
function create() 
    local main = createObject ( 2983, -1330.6999511719, -29.39999961853, 13, 0, 1.5, 0 ) 
    local top = createObject ( 2985, -1331.0999755859, -29.39999961853, 12.9, 0, 13.75, 0 ) 
    veh = createVehicle ( 457, -1330.7998046875, -31.099609375, 14.2, 0, 0, 271.99951171875 ) 
    if ( veh ) then 
        attachElements(veh, top, 0,-1.6,2,0,0,271.99951171875) 
        setElementAlpha(veh, 0) 
        setElementData(veh, "top", "21 nigga") 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, create ) 
  
  
  
function check(plr,cmd) 
    local test = getElementData(veh, "top") 
    outputChatBox(test) 
end 
addCommandHandler("t", check) 

Hopefully this helps,

by the way, you might wanna see what are 'elements'

https://wiki.multitheftauto.com/wiki/Element

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