I want to print the ammotypes of a server on DarkRP.
So far I have tried
[CODE]concommand.Add( "ammotypes", function( ply, cmd, args )
print(GAMEMODE.AmmoTypes)
end )[/CODE]
and that prints a single random "table: 0x68547f30"
I tried
[CODE]concommand.Add( "ammotypes", function( ply, cmd, args )
for k,v in pairs (GAMEMODE.AmmoTypes) do
print(k, v)
end
end )[/CODE]
and that prints three of them.
What can I use instead that will print the actual contents of GAMEMODE.AmmoTypes???
Thanks for the help.
Call [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/game/BuildAmmoTypes]game.BuildAmmoTypes[/url] to get the table
[QUOTE=code_gs;51554986]Call [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/game/BuildAmmoTypes]game.BuildAmmoTypes[/url] to get the table[/QUOTE]
Sorry, I never received an email notifying me of a response. Thank you for the post but I'm not sure how to use this. When I try this it gives me tables again. I don't want to get 'ID' of a table if that's what that is... I want to get the actual readable contents.
[CODE]print(game.BuildAmmoTypes())[/CODE] returns "table: 0x1497d1f0"
To display table uses [URL="http://wiki.garrysmod.com/page/Global/PrintTable"]PrintTable[/URL]
[code]PrintTable(GAMEMODE.AmmoTypes)[/code]
or use
[code]
for k, v in pairs(GAMEMODE.AmmoTypes) do
print(v)
end
[/code]
[QUOTE=Packages;51753214]To display table uses [URL="http://wiki.garrysmod.com/page/Global/PrintTable"]PrintTable[/URL]
[code]PrintTable(GAMEMODE.AmmoTypes)[/code][/QUOTE]
Thank you, worked wonderfully!
Sorry, you need to Log In to post a reply to this thread.