Is there a way to get all the tables on the client?
Specificly, I'd like to get the tables for DarkRP, so I can PrintTable. But if there is a simple way to print all the current tables the client knows I can search through and use whatever I want.
I already have one, ammotypes. PrintTable(GAMEMODE.AmmoTypes) works great, and has a nicely readable layout with some useful information(i.e I can /buyammo thegivinid and skip opening the server's sometimes messy / clunky menus ).
The AmmoTypes table was givin to me by someone who helped me previously, but I don't even know how they got it :\
Example:
1:
ammoType = smg1
amountGiven = 30
category = Other
default = true
id = 3
model = models/Items/BoxMRounds.mdl
name = Rifle ammo
price = 80
I'd like to use this same function on the rest just because, but I don't know how to go about finding all the tables, especially the jumbled up files of the gamemode itself. Thanks!
It totally depends on what info you want - tables are just a Lua structure and there is no way to get all of them.
Ok.. Well I've found out how to printtable for the shipments on the server, and I've found PrintTable(DarkRP.getCategories()) and that does in fact print every category on the gamemode, including weapons. PrintTable(DarkRP.getCategories().weapons) works to print the weapons, but has a mess at the beginning.
1:
canSee = function: 0x33d96f60
categorises = weapons
color:
a = 255
b = 0
g = 107
r = 0
members:
name = Pistols
sortOrder = 100
startExpanded = true
2:
canSee = function: 0x33d94b48
categorises = shipments
color:
a = 255
b = 0
g = 107
r = 0
members:
name = Rifles
sortOrder = 100
startExpanded = true
3:
canSee = function: 0x33d95818
categorises = shipments
color:
a = 255
b = 0
g = 107
r = 0
members:
name = Shotguns
sortOrder = 101
startExpanded = true
4:
canSee = function: 0x33d94760
categorises = shipments
color:
a = 255
b = 0
g = 107
r = 0
members:
name = Snipers
sortOrder = 102
startExpanded = true
5:
canSee = function: 0x33d978f8
categorises = weapons
color:
a = 255
b = 0
g = 107
r = 0
members:
1:
allowed:
1 = 19
amount = 10
category = Other
entity = m9k_acr
model = models/weapons/w_masada_acr.mdl
name = ACR
noship = false
price = 55000
pricesep = 8250
separate = true
seperate = true
shipmodel = models/Items/item_item_crate.mdl
2:
allowed:
1 = 29
amount = 10
category = Other
entity = m9k_ak47
model = models/weapons/w_ak47_m9k.mdl
name = AK-47
noship = false
price = 22500
pricesep = 3300
separate = true
seperate = true
shipmodel = models/Items/item_item_crate.mdl
3:
allowed:
1 = 19
amount = 10
category = Other
entity = m9k_ak74
model = models/weapons/w_tct_ak47.mdl
name = AK-74
noship = false
price = 22500
pricesep = 3500
separate = true
seperate = true
shipmodel = models/Items/item_item_crate.mdl
As you an see it prints the entire category section of weapons, including the labels of them... is there a better way to get the table of weapons specificly? Like the shipments, which come out clean like ammotypes? Maybe it has something to do with how the weapons are listed under 'members' above... Idk this is kinda
1:
allowed:
1 = 18
amount = 10
category = Other
entity = lockpick
model = models/weapons/w_crowbar.mdl
name = Lockpick
noship = false
price = 10000
pricesep = 1500
separate = true
seperate = true
shipmodel = models/Items/item_item_crate.mdl
2:
allowed:
1 = 18
amount = 10
category = Other
entity = csgo_m9
model = models/weapons/w_csgo_m9.mdl
name = M9 Bayonet
noship = false
price = 30000
pricesep = 4750
separate = true
seperate = true
shipmodel = models/Items/item_item_crate.mdl
That's just how the tables are structured; PrintTable is just a utility that prints formatted key-values. DarkRP.getCategories().weapons is probably the best way.
That's probably the cleanest you'll see the tables. You could use util.TableToJSON if JSON is easier for you to understand.
Ok, well at least I found it! Thanks
I'll give it a try when I'm back to messing with that stuff. Thanks for the idea
Sorry, you need to Log In to post a reply to this thread.