Depends on several factors. Old weapons like the AK-47 can be used in commercial games because the patents for them have lapsed and they’re public domain. Newer weapons that are still protected would require licensing, but many studios get around this by creating something that looks similar and giving it a different name.