Wei Posted May 10, 2012 Author Posted May 10, 2012 ok. 1 question more. How can add on gridlist vehicle IDs. I know that I need to make some kind of table.
Wei Posted May 10, 2012 Author Posted May 10, 2012 getElementModel or getVehicleModelFromName But how can I add or wich table i need to create... I've worked with players but not with vehicles
Castillo Posted May 10, 2012 Posted May 10, 2012 You want all server vehicles currently created? if so use: for index, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do -- Code here end
Wei Posted May 10, 2012 Author Posted May 10, 2012 I want to make a list of vehicles. I want to make a kind of carshop.
Axel Posted May 10, 2012 Posted May 10, 2012 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
Wei Posted May 10, 2012 Author Posted May 10, 2012 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 ?
Axel Posted May 10, 2012 Posted May 10, 2012 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)
Edikosh998 Posted May 10, 2012 Posted May 10, 2012 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)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now