Garry's Mod

Garry's Mod

gmDoom
Knife Kitty 20 Mar, 2016 @ 2:12pm
[question][lua] getting player inventory information
Hi, Ive wanted to do my own hud indicator for gm doom keycards but I cant find any related functions. Is there any clientside function like player:hasitem("itemname") returning bools?
Last edited by Knife Kitty; 20 Mar, 2016 @ 2:21pm
< >
Showing 1-2 of 2 comments
ghor  [developer] 20 Mar, 2016 @ 5:10pm 
Originally posted by Knife Kitty:
Hi, Ive wanted to do my own hud indicator for gm doom keycards but I cant find any related functions. Is there any clientside function like player:hasitem("itemname") returning bools?
I don't put any functions directly on the player object, for the sake of keeping it clean and avoiding conflicts with other addons. Instead, there is a table you can grab with:
local doom_playerinfo = DOOM.GetPlayerInfo( pl )
where 'pl' is the player entity. From there, you can use the function:
doom_playerinfo:HasCard( iCard, bOnlyCareAboutColor )
where 'iCard' is one of the constants:
DOOM.it_bluecard -- Blue Keycard DOOM.it_yellowcard -- Yellow Keycard DOOM.it_redcard -- Red Keycard DOOM.it_blueskull -- Blue Skull Key DOOM.it_yellowskull -- Yellow Skull Key DOOM.it_redskull -- Red Skull Key
and 'bOnlyCareAboutColor' is a boolean indicating whether or not you only care if the player has a key of the same color as the first argument, ignoring whether it's a skull or a keycard.
Knife Kitty 21 Mar, 2016 @ 1:58am 
this is what I needed
thank you very much!
< >
Showing 1-2 of 2 comments
Per page: 1530 50