Jump to content

car save


Wei

Recommended Posts

Posted

ok. 1 question more. How can add on gridlist vehicle IDs.

I know that I need to make some kind of table.

Posted
getElementModel 
or 
getVehicleModelFromName 

But how can I add or wich table i need to create...

I've worked with players but not with vehicles

Posted

You want all server vehicles currently created? if so

use:

for index, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do 
    -- Code here 
end 

Posted
  
local vehs = getElementsByType("vehicle") 
for i,v in ipairs (vehs) do 
     local carId = getVehicleNameFromModel(v) 
     local row = guiGridListAddRow(yourList) -- change yourList to your list's name.. 
     guiGridListSetItemText (yourList, row, 1, carID, false, true) 
     guiGridListSetItemText (yourList, row, 2, v, false, true) 
end 

Posted
function carSpawn () 
    local Acc = getPlayerAccount( source ) 
    local x,y,z = getElementPosition (source) 
    local theFar = getAccountData( Acc, "theCar" ) 
    veh = createVehicle(tonumber (theFar), x,y,z) 
    warpPedIntoVehicle( source, veh ) 
end 
addCommandHandler( "spawnMyCar", carSpawn) 

whats the problem ?

Posted
function carSpawn () 
    local acc = getPlayerAccount(source) 
    local x,y,z = getElementPosition(source) 
    local theCar = getAccountData(Acc,"theCar") 
    veh = createVehicle(tostring(theCar),x,y,z) 
    warpPedIntoVehicle(source,veh) 
end 
addCommandHandler( "spawnMyCar", carSpawn) 

Posted
function carSpawn (source) --  
    local Acc = getPlayerAccount( source ) 
    local x,y,z = getElementPosition (source) 
    local theFar = getAccountData( Acc, "theCar" ) 
    veh = createVehicle(tonumber (theFar), x,y,z) 
    warpPedIntoVehicle( source, veh ) 
end 
addCommandHandler( "spawnMyCar", carSpawn) 

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