python name is not defined_PythonNameError: global name 'NAME' is not not defined这个问题怎么解决?...
这是我的Python代码:import es, popuplib, cmdlib
info = es.AddonInfo()
info['name'] = "bilbodog Vaaben Menu"
info['version'] = "1.1"
info['author'] = "bilbodog"
info['url'] = ""
info['description'] = "En vaaben menu der kan give vaaben til spillere"
def load():
es.regclientcmd('bm_version', 'bm/bm_version')
cmdlib.registerSayCommand('!wpa', sendBmMenu, 'Send BM Menu')
es.msg('#multi', '#green[bilbodog Vaaben Menu] #defaultblev loaded!')
global bilbodog, bilbodogSelf, bilbodogOther, bilbodogSelf2, bilbodogSelf3, bilbodogSelf4, bilbodogSelf5, bilbodogSelf6, bilbodogSelf7, bilbodogSelf8, bilbodogSelf9, bilbodogOther2, bilbodogOther3, bilbodogOther4, bilbodogOther5, bilbodogOther6, bilbodogOther7, bilbodogOther8, bilbodogOther9, bilbodogadmins
bilbodogadmins = ('STEAM_0:1:25150824', 'STEAM_ID_LAN', 'STEAM_ID_PENDING')
bilbodog = popuplib.create('bilbodog')
bilbodog.addline('---------------bilbodog Vaaben Menu---------------')
bilbodog.addline('Weapon Menu - Hvem vil De give et vaaben?')
bilbodog.addline('->1. Mig selv')
bilbodog.addline('->2. Andre spillere')
bilbodog.addline('------------------------------')
bilbodog.addline('0 Luk')
bilbodog.menuselect = bilbodogscript
bilbodogSelf = popuplib.create('bilbodogSelf')
bilbodogSelf.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogSelf.addline('Weapon Menu - Mig selv')
bilbodogSelf.addline('->1. Haandpistoler')
bilbodogSelf.addline('->2. Stormgevaerer')
bilbodogSelf.addline('->3. Haglgevaerer')
bilbodogSelf.addline('->4. Maskinepistoler')
bilbodogSelf.addline('->5. Sniper Vaaben')
bilbodogSelf.addline('->6. Maskingevaer')
bilbodogSelf.addline('->7. Udstyr')
bilbodogSelf.addline('->8. Vaaben Saet')
bilbodogSelf.addline('------------------------------')
bilbodogSelf.addline('0 Luk')
bilbodogSelf.menuselect = bilbodogSelfscript
bilbodogSelf2 = popuplib.create('bilbodogSelf2')
bilbodogSelf2.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogSelf2.addline('Weapon Menu - Mig selv - Haandpistoler')
bilbodogSelf2.addline('->1.G18')
bilbodogSelf2.addline('->2.USP45')
bilbodogSelf2.addline('->3.P228')
bilbodogSelf2.addline('->4.Desert Eagle')
bilbodogSelf2.addline('->5.Five-Seven')
bilbodogSelf2.addline('->6.Dual Elite')
bilbodogSelf2.addline('------------------------------')
bilbodogSelf2.addline('->8.Tilbage')
bilbodogSelf2.addline('0.Luk')
bilbodogSelf2.menuselect = bilbodogSelf2script
# ...SNIP...
bilbodogSelf9 = popuplib.create('bilbodogSelf9')
bilbodogSelf9.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogSelf9.addline('Weapon Menu - Mig selv - Udstyr')
bilbodogSelf9.addline('->1.M4A1, Deagle, Nades, Armor')
bilbodogSelf9.addline('->2.M4A1, Elite, Nades, Armor')
bilbodogSelf9.addline('->3.AK47, Deagle, Nades, Armor')
bilbodogSelf9.addline('->4.AK47, Elite, Nades, Armor')
bilbodogSelf9.addline('->5.AWP, Deagle, Nades, Armor')
bilbodogSelf9.addline('->6.AWP, Elite, Nades, Armor')
bilbodogSelf9.addline('------------------------------')
bilbodogSelf9.addline('->8.Tilbage')
bilbodogSelf9.addline('0.Luk')
bilbodogSelf9.menuselect = bilbodogSelf9script
bilbodogOther = popuplib.create('bilbodogOther')
bilbodogOther.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogOther.addline('Weapon Menu - Andre spillere')
bilbodogOther.addline('->1. Haandpistoler')
bilbodogOther.addline('->2. Stormgevaerer')
bilbodogOther.addline('->3. Haglgevaerer')
bilbodogOther.addline('->4. Maskinepistoler')
bilbodogOther.addline('->5. Sniper Vaaben')
bilbodogOther.addline('->6. Maskingevaer')
bilbodogOther.addline('->7. Udstyr')
bilbodogOther.addline('->8. Vaaben Saet')
bilbodogOther.addline('------------------------------')
bilbodogOther.addline('0 Luk')
bilbodogOther.menuselect = bilbodogOtherscript
bilbodogOther2 = popuplib.create('bilbodogOther2')
bilbodogOther2.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogOther2.addline('Weapon Menu - Andre spillere - Haandpistoler')
bilbodogOther2.addline('->1.G18')
bilbodogOther2.addline('->2.USP45')
bilbodogOther2.addline('->3.P228')
bilbodogOther2.addline('->4.Desert Eagle')
bilbodogOther2.addline('->5.Five-Seven')
bilbodogOther2.addline('->6.Dual Elite')
bilbodogOther2.addline('------------------------------')
bilbodogOther2.addline('->8.Tilbage')
bilbodogOther2.addline('0.Luk')
bilbodogOther2.menuselect = bilbodogOther2script
# ...SNIP...
bilbodogOther9 = popuplib.create('bilbodogOther9')
bilbodogOther9.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogOther9.addline('Weapon Menu - Andre spillere - Udstyr')
bilbodogOther9.addline('->1.M4A1, Deagle, Nades, Armor')
bilbodogOther9.addline('->2.M4A1, Elite, Nades, Armor')
bilbodogOther9.addline('->3.AK47, Deagle, Nades, Armor')
bilbodogOther9.addline('->4.AK47, Elite, Nades, Armor')
bilbodogOther9.addline('->5.AWP, Deagle, Nades, Armor')
bilbodogOther9.addline('->6.AWP, Elite, Nades, Armor')
bilbodogOther9.addline('------------------------------')
bilbodogOther9.addline('->8.Tilbage')
bilbodogOther9.addline('0.Luk')
bilbodogOther9.menuselect = bilbodogOther9script
def sendBmMenu(userid, args):
steam = es.getplayersteamid(userid)
if steam in bilbodogadmins:
bilbodog.send(userid)
else:
es.tell(event_var['userid'], '#multi', '#greenDe har ikke adgang til denne kommando!')
def bilbodogscript(userid, choice, popupid):
if choice == 1:
bilbodogSelf.send(userid)
elif choice == 2:
bilbodogOther.send(userid)
def bilbodogSelfscript(userid, choice, popupid):
if choice == 1:
bilbodogSelf2.send(userid)
elif choice == 2:
bilbodogSelf3.send(userid)
elif choice == 3:
bilbodogSelf4.send(userid)
elif choice == 4:
bilbodogSelf5.send(userid)
elif choice == 5:
bilbodogSelf6.send(userid)
elif choice == 6:
bilbodogSelf7.send(userid)
elif choice == 7:
bilbodogSelf8.send(userid)
elif choice == 8:
bilbodogSelf9.send(userid)
def bilbodogOtherscript(userid, choice, popupid):
if choice == 1:
bilbodogOther2.send(userid)
elif choice == 2:
bilbodogOther3.send(userid)
elif choice == 3:
bilbodogOther4.send(userid)
elif choice == 4:
bilbodogOther5.send(userid)
elif choice == 5:
bilbodogOther6.send(userid)
elif choice == 6:
bilbodogOther7.send(userid)
elif choice == 7:
bilbodogOther8.send(userid)
elif choice == 8:
bilbodogOther9.send(userid)
def bm_version():
es.msg('#multi', '#green[bilbodog Vaaben Menu] #defaultVersion 1.0')
es.msg('#multi', '#green[bilbodog Vaaben Menu] #defaultLavet af bilbodog')
def unload():
cmdlib.unregisterSayCommand('!wpa')
我收到一个错误:NameError: global name 'bilbodogOther' is not not defined
错误就发生在这里:def bilbodogscript(userid, choice, popupid):
if choice == 1:
bilbodogSelf.send(userid)
elif choice == 2:
bilbodogOther.send(userid)
但我不明白,这是什么意思?
python name is not defined_PythonNameError: global name 'NAME' is not not defined这个问题怎么解决?...相关推荐
- python全局变量(模块法和global)
python全局变量(模块法和global) python中全局变量使用,一般有两种方法,使用global和使用模块 global 在python中,可以使用global声明一个变量为全局变量 1. ...
- python中引入包的时候报错AttributeError: module ‘sys‘ has no attribute ‘setdefaultencoding‘解决方法?
python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法? 参考文章: (1)pyth ...
- Python中 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape错误解决方法
Python中 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape错误解决方法: ...
- Python使用pip安装报错ModuleNotFoundError: No module named ‘pip._internal.cli.main‘的解决方法
Python使用pip安装报错ModuleNotFoundError: No module named 'pip._internal.cli.main'的解决方法 大家好,我叫亓官劼(qí guā ...
- python爬虫selenium爬不到frame 的tag标记下#document==0的内容解决
python爬虫selenium爬不到frame 的tag标记下#document==0的内容解决 前言 按理来说,selenium可以获取当前页面的所有源代码,但却爬不到frame 的tag标记下# ...
- Python:OSError [WinError 123] 文件名、目录名或卷标语法不正确。解决方法。
Python:OSError: [WinError 123] 文件名.目录名或卷标语法不正确.解决方法. 我的错误代码: folder = "D:\aatest" files = ...
- 运行python脚本时,报错InsecurePlatformWarning: A true SSLContext object is not available,解决方法
运行python脚本时,报错InsecurePlatformWarning: A true SSLContext object is not available,解决方法 参考文章: (1)运行pyt ...
- python函数 global_**Python的函数参数传递 和 global
函数的参数到底是传递的一份复制的值,还是对内存的引用? 我们看下面一段代码: a = [] def fun(x): x.append(1) fun(a) print(a) 想想一下:如果传递的是一份复 ...
- python nonlocal的用法_python global和nonlocal用法解析
这篇文章主要介绍了python global和nonlocal用法解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 ◆global和nonloca ...
最新文章
- 使用bash工具创建ssh key
- opengl加载显示3D模型STL类型文件
- mats显存测试软件linux环境,Mats显存检测软件下载-Mats显存检测软件最新版下载-微侠手游网...
- Keil综合(03)map文件全解析
- 一个表格,一部分允许编辑,有公式的单元格不允许编辑
- 操作系统—进程的状态与状态的转换
- mysql中DateTime、Date、Time、TimeStamp区别
- 字节跳动《算法中文手册》高清版.pdf
- 英语模板作文,词组,句子,句型,开头
- oracle裁员原因_导致Oracle全球性裁员的原因有哪些?
- 抖音:技术优化打造最佳创作体验
- delphi低级键盘钩子(delphi2009测试通过)
- cocos 躲避球游戏(3) --群组碰撞
- Scrapy第三(②)篇:创建scrapy项目
- Kubernetes一致性认证
- 关于gps测量精度的分析
- 四大门户免费企业邮箱用户端基础参数对比
- visual studio下设置驱动开发环境
- 一次网站的性能优化之路 -- 天下武功,唯快不破
- How tomcat works 读书笔记十四 服务器组件和服务组件