Garry's Mod

Garry's Mod

gmDoom
Knife Kitty 2016 年 3 月 20 日 下午 2:12
[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?
最后由 Knife Kitty 编辑于; 2016 年 3 月 20 日 下午 2:21
< >
正在显示第 1 - 2 条,共 2 条留言
ghor  [开发者] 2016 年 3 月 20 日 下午 5:10 
引用自 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 2016 年 3 月 21 日 上午 1:58 
this is what I needed
thank you very much!
< >
正在显示第 1 - 2 条,共 2 条留言
每页显示数: 1530 50