恳求高手帮忙修正2个插件BUG
下面是错误日志文件中的内容, 插件代码在附件中,一个是管理员人物皮肤插件,另一个是网页风格的statsx插件。望高手帮下!L 11/08/2007 - 21:30:33: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 11/08/2007 - 21:30:52: Invalid player 7
L 11/08/2007 - 21:30:52: Run time error 10 (plugin "amx_adminmodel.amxx") (native "cs_get_user_team") - debug not enabled!
L 11/08/2007 - 21:30:52: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 11/08/2007 - 21:30:52: Invalid player 7
L 11/08/2007 - 21:30:52: Run time error 10 (plugin "amx_adminmodel.amxx") (native "cs_get_user_team") - debug not enabled!
这是管理员人物皮肤插件日志
L 11/09/2007 - 01:34:24: Start of error session.
L 11/09/2007 - 01:34:24: Info (map "de_dust2") (logfile "error_110907.log")
L 11/09/2007 - 01:34:24: replace() buffer not big enough (128>=127)
L 11/09/2007 - 01:34:24: Run time error 10 (plugin "statsx.amxx") (native "replace") - debug not enabled!
L 11/09/2007 - 01:34:24: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
这是网页风格插件日志
回复: 恳求高手帮忙修正2个插件BUG
服装插件Invalid player 7
应该判断玩家是否已连接.
if (get_user_flags(id) & ADMIN_LEVEL_B) {
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T) {
改为
Post by Rulzy
if (!is_user_connected(id)) return PLUGIN_CONTINUE
new flags = get_user_flags(id)
new CsTeams:userTeam = cs_get_user_team(id)
对于statsx,从你提供的错误日志来看,很难找到问题所在.
如果要找错误,你应该先debug运行.
回复: 恳求高手帮忙修正2个插件BUG
服装插件Invalid player 7
应该判断玩家是否已连接.
if (get_user_flags(id) & ADMIN_LEVEL_B) {
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T) {
改为
为什么不是改成
if (is_user_connected(id)&get_user_flags(id) & ADMIN_LEVEL_B) {
......
}
而是要按照你说的改成
public mModel(id, level, cid) {
if (!is_user_connected(id)) return PLUGIN_CONTINUE
if (get_user_flags(id) & ADMIN_LEVEL_B) {
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T) {
cs_set_user_model(id, "CVTMMT")
}
else if(userTeam == CS_TEAM_CT) {
cs_set_user_model(id, "CVTMMCT")
}
else {
cs_reset_user_model(id)
}
}
return PLUGIN_CONTINUE
}
回复: 恳求高手帮忙修正2个插件BUG
回Q6Q6Q6一时大意,不好意思.
回复: 恳求高手帮忙修正2个插件BUG
完整代码#include <amxmodx>
#include <amxmisc>
#include <cstrike>
public plugin_init() {
register_plugin("AMX Admin Model", "1.1.1", "whitemike | C.H.M")
register_event("ResetHUD", "resetModel","be");
return PLUGIN_CONTINUE
}
public plugin_precache() {
precache_model("models/player/cz_leet_t/cz_leet_t.mdl")
precache_model("models/player/cz_gsg9_ct/cz_gsg9_ct.mdl")
precache_model("models/player/CVTMMCT/CVTMMCT.mdl")
precache_model("models/player/CVTMMT/CVTMMT.mdl")
return PLUGIN_CONTINUE
}
public resetModel(id)
{
if (!is_user_connected(id)) return PLUGIN_CONTINUE
new flags = get_user_flags(id)
new CsTeams:userTeam = cs_get_user_team(id)
if (flags & ADMIN_LEVEL_B){
/* MM权限 */
if (userTeam == CS_TEAM_T)
cs_set_user_model(id, "CVTMMT")
else if(userTeam == CS_TEAM_CT)
cs_set_user_model(id, "CVTMMCT")
else
cs_reset_user_model(id)
}else if (flags & ADMIN_LEVEL_A) {
/* 此处设置你想设置的权限 */
if (userTeam == CS_TEAM_T)
cs_set_user_model(id, "cz_leet_t")
else if(userTeam == CS_TEAM_CT)
cs_set_user_model(id, "cz_gsg9_ct")
else
cs_reset_user_model(id)
}
return PLUGIN_CONTINUE
}
回复: 恳求高手帮忙修正2个插件BUG
Post by ceoguang回Q6Q6Q6
一时大意,不好意思.
呵呵,我一直也想弄服装插件,看到这个帖子,我很感兴趣,所以。。。
你的新代码中
register_event("ResetHUD", "resetModel","be");
是否需要将resetModel改成mModel?
还是说是系统默认的函数(我不懂的哈,如果说错了请谅解)?
我从今年8月才开始研究amxx(帐号借别人的,现在一直是我在使用,申请不了新帐号:) ),很多东西也不太懂,希望大家多指导指导。
回复: 恳求高手帮忙修正2个插件BUG
ceoguang你下面发的代码能用不? A权限是cz_leet_t B权限是MM的吗?
回复: 恳求高手帮忙修正2个插件BUG
已经加上附件,里面有注释.回复: 恳求高手帮忙修正2个插件BUG
ceoguang非常感谢您!我知道怎么弄了!回复: 恳求高手帮忙修正2个插件BUG
我来学习了,看看。。
页:
[1]