I found your problem, you are using the wrong index, is 16 not 15.
local gasMaskActivation = function ( player )
local texture, model = getPedClothes ( player, 16 )
if not ( texture == "hockey" and model == "hockeymask" ) then
addPedClothes ( player, "hockey", "hockeymask", 16 )
else
removePedClothes ( player, 16 )
end
end
addEventHandler ( "onPlayerJoin",root,
function ( )
bindKey ( source, "h", "down", gasMaskActivation )
end
)
addEventHandler ( "onResourceStart", resourceRoot,
function ( )
for _, player in ipairs ( getElementsByType ( "player" ) ) do
bindKey ( player, "h", "down", gasMaskActivation )
end
end
)
Works perfect ( tested ).