Is it possible to read a vehicles script through lua, settings such as its max, of lets say prop_vehicle_jeep?
file.Read could work. I know that lua can get all the files in a directory such as the maps folder, but idk about reading them.
Never used file.Read before, ran this console cmd to see if it works:[CODE]lua_run print(file.Read(player.GetAll()[1]:GetVehicle().VehicleTable.KeyValues.vehiclescript))[/CODE] prints out nil. I'm in a vehicle, am I doing something wrong?
[editline]9th February 2011[/editline]
Just checked the gwiki for it, in additional notes: "Relative to garrysmod/data" :(
[QUOTE=freemmaann;27955340]Never used file.Read before, ran this console cmd to see if it works:[CODE]lua_run print(file.Read(player.GetAll()[1]:GetVehicle().VehicleTable.KeyValues.vehiclescript))[/CODE] prints out nil. I'm in a vehicle, am I doing something wrong?
[editline]9th February 2011[/editline]
Just checked the gwiki for it, in additional notes: "Relative to garrysmod/data" :([/QUOTE]
By the way,it's
[lua]
lua_run print(file.Read(player.GetAll()[1]:GetVehicle():GetKeyValues().VehicleScript,true))
[/lua]
file.Read will not output anything if the file is loaded from a .gcf,it should work fine if you are using a custom vehicle with a custom vehiclescript.
It will work on a dedicated server for sure.
[QUOTE=Jvs;27955429]By the way,it's
[lua]
lua_run print(file.Read(player.GetAll()[1]:GetVehicle():GetKeyValues().VehicleScript,true))
[/lua]
file.Read will not output anything if the file is loaded from a .gcf,it should work fine if you are using a custom vehicle with a custom vehiclescript.
It will work on a dedicated server for sure.[/QUOTE]GetKeyValues() is pretty expensive, I figured that with VehicleTable it just have to cycle through a small table. Tried it on SinglePlayer, doesn't work, anyway, I'm scrapping the idea that needs this, so thanks anyway.
Sorry, you need to Log In to post a reply to this thread.