chuchung712

|
分享:
▲
▼
下面是引用 a7811311622 于 2010-04-07 17:45 发表的 :
比较简单的说法是: PLUGIN_CONTINUE:可能只跳过程式里面的其中几段 PLUGIN_HANDLED:整段程式直接跳过 这要有例子才比较好讲解… 这是AlliedModders的黄金AK插件中的其中一部分 @@ 复制程式
public checkWeapon(id)
{
new plrClip, plrAmmo, plrWeap[32]
new plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if (plrWeapId == CSW_AK47 && g_HasAk[id])
{
checkModel(id)
}
else
{
return PLUGIN_CONTINUE
}
if (plrClip == 0 && get_pcvar_num(cvar_uclip))
{
// If the user is out of ammo..
get_weaponname(plrWeapId, plrWeap, 31)
// Get the name of their weapon
give_item(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
}
return PLUGIN_HANDLED
}
|
没有理想的世界
|
x0
[5 楼]
From:香港有线宽频 | Posted:2010-04-07 18:38 |
|
|
a7811311622
我…在工作了…

级别: 版主 
版区: CS提问区
x771
x2152
|
分享:
▲
▼
下面是引用 chuchung712 于 2010-04-07 18:38 发表的 :
这是AlliedModders的黄金AK插件中的其中一部分 @@
复制程式
public checkWeapon(id)
{
new plrClip, plrAmmo, plrWeap[32]
.......[/quote]
[code]
public checkWeapon(id)
{
new plrClip, plrAmmo, plrWeap[32]
new plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if (plrWeapId == CSW_AK47 && g_HasAk[id])
{
checkModel(id)
}
else
{
return PLUGIN_CONTINUE
/*
这段回传的结果是脱离「public checkWeapon(id)」这段假设,
如果条件符合,则从这段开始往下的内容就不会判断和执行
*/
}
if (plrClip == 0 && get_pcvar_num(cvar_uclip))
{
// If the user is out of ammo..
get_weaponname(plrWeapId, plrWeap, 31)
// Get the name of their weapon
give_item(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
}
return PLUGIN_HANDLED // 单纯让上面的「return PLUGIN_CONTINUE」有回传值罢了…
}
[ 此文章被a7811311622在2010-04-07 21:06重新编辑 ]
|
|
x0
[6 楼]
From:台湾教育部 | Posted:2010-04-07 18:58 |
|
|
|