我需要帮助!我试图修改一个游戏炸弹队,并试图建立一个禁止我的服务器系统。你知道吗
好吧,有一个功能拒绝人们进入
def onPlayerRequest(self, player):
"""
Called when a new bs.Player wants to join;
should return True or False to accept/reject.
"""
# limit player counts based on pro purchase/etc *unless* we're in a stress test
if bsUtils._gStressTestResetTimer is None:
if len(self.players) >= self._maxPlayers:
# print a rejection message *only* to the client trying to joinz
# (prevents spamming everyone else in the game)
bs.playSound(bs.getSound('error'))
bs.screenMessage(bs.Lstr(resource='playerLimitReachedText', subs=[('${COUNT}', bsInternal._getAccountDisplayString())]),
color=(0.8, 0.0, 0.0),
clients=[player.getInputDevice().getClientID()],
transient=True)
return False
bs.playSound(bs.getSound('dripity'))
return True
我需要从另一个文件的球员的名字,我会把它在if语句中,以检查它是否匹配的禁令和完成! 显示播放器名称的文件是
class DamnPartyWindow(PartyWindow):
def _onPartyMemberPress(self, clientID, isHost, widget):
# if we're the host, pop up 'kick' options for all non-host members
if bsInternal._getForegroundHostSession() is not None:
kickStr = bs.Lstr(resource='kickText')
else:
# kick-votes appeared in build 14248
if bsInternal._getConnectionToHostInfo().get('buildNumber', 0) < 14248:
return
kickStr = bs.Lstr(resource='kickVoteText')
for rst in self._roster:
cid = rst['clientID']
if cid == clientID:
bs.screenMessage(rst['displayString'])
break
p = PopupMenuWindow(position=widget.getScreenSpaceCenter(),
scale=2.3 if gSmallUI else 1.65 if gMedUI else 1.23,
choices=['kick'],
choicesDisplay=[kickStr],
currentChoice='kick',
delegate=self).getRootWidget()
self._popupPartyMemberClientID = clientID
self._popupPartyMemberIsHost = isHost
(这是另一个人的mod)我需要rst['displayString']的值并在第一个示例中检查它。。。救命啊!你知道吗
我尝试将xyz=rst['displayString']放入file1,然后使用
从file2导入xyz
文件1:
class DamnPartyWindow(PartyWindow):
def _onPartyMemberPress(self, clientID, isHost, widget):
# if we're the host, pop up 'kick' options for all non-host members
if bsInternal._getForegroundHostSession() is not None:
kickStr = bs.Lstr(resource='kickText')
else:
# kick-votes appeared in build 14248
if bsInternal._getConnectionToHostInfo().get('buildNumber', 0) < 14248:
return
kickStr = bs.Lstr(resource='kickVoteText')
for rst in self._roster:
cid = rst['clientID']
xyz = rst['displayString']
if cid == clientID:
bs.screenMessage(rst['displayString'])
break
p = PopupMenuWindow(position=widget.getScreenSpaceCenter(),
scale=2.3 if gSmallUI else 1.65 if gMedUI else 1.23,
choices=['kick'],
choicesDisplay=[kickStr],
currentChoice='kick',
delegate=self).getRootWidget()
self._popupPartyMemberClientID = clientID
self._popupPartyMemberIsHost = isHost
文件2:
def onPlayerRequest(self, player):
"""
Called when a new bs.Player wants to join;
should return True or False to accept/reject.
"""
# importing xyz i.e the value of client
from file2 import xyz
if bsUtils._gStressTestResetTimer is None:
if len(self.players) >= self._maxPlayers or xyz=="PC14567":
# print a rejection message *only* to the client trying to joinz
# (prevents spamming everyone else in the game)
bs.playSound(bs.getSound('error'))
bs.screenMessage(bs.Lstr(resource='playerLimitReachedText', subs=[('${COUNT}', bsInternal._getAccountDisplayString())]),
color=(0.8, 0.0, 0.0),
clients=[player.getInputDevice().getClientID()],
transient=True)
return False
bs.playSound(bs.getSound('dripity'))
return True
但是说不能导入xyz是行不通的。 请帮帮我!我可以提供你们需要的任何信息请帮帮我!你知道吗
尝试: 导入文件1
然后使用file1.xyz
相关问题 更多 >
编程相关推荐