• Couple of questions regarding vehicle scripts + keyvalues.
    0 replies, posted
Hello, I ran into an issue the other day when trying to grab info about some vehicles I had installed. (serverside) I noticed that there were some really awesome commands added for vehicle entities such as: [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vehicle/GetMaxSpeed]Vehicle:GetMaxSpeed[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vehicle/GetRPM]Vehicle:GetRPM[/url] ( which I don't think works :(( ) Anyways, I wanted a way to grab info like this, without an actual entity needing to be spawned. Is there an easy way to read all script information? Just read it as a table? It seems that you cannot using file.Read on vehicle scripts, or the scripts folder in general (from my limited testing) Obviously that meta function can do it, but how exactly does it work? None of the functions seem to be on the GitHub either. [editline]6th October 2016[/editline] I seriously hate whenever I decide to post something after an hour of not figuring it out, I get it right within 10 minutes after. :nope: For those wondering, I used this setup: [code] local contents = file.Read( "scripts/vehicles/lwcars/ford_f350_ambu.txt", "GAME" ) local tbl = util.KeyValuesToTable( contents, false, false ) PrintTable( tbl ) [/code] Thank god for util.KeyValuesToTable
Sorry, you need to Log In to post a reply to this thread.