apocalyptic 发表于 2007-3-7 20:30:11

请问版主,如何区分两个玩家是否敌人?为何会报错?

我想在插件中区分一次攻击是杀敌还是伤害队友。我的方法如下:

if(cs_get_user_team(Attacker)==cs_get_user_team(Victim))

通过cs_get_user_team(Attacker)获取攻击者所在的队伍信息,同样道理,通过cs_get_user_team(Victim)获取被攻击者所在的队伍信息,然后进行比较,如果属于同一队伍则意味着伤害队友。
先前版主告诉我,cs_get_user_team()返回值属于枚举类型,只有固定的几个值,这样应该如何进行对比?上面的方法并没有导致编译工具的报错,但在实验中看见CS服务器控制台提示:

L 03/07/2007 - 20:18:51: Run time error 10: native error (native "cs_get_user_team")

请问这样的情况应如何对付?

PEnTiuMsK 发表于 2007-3-10 18:00:50

回复: 请问版主,如何区分两个玩家是否敌人?为何会报错?

用get_user_team他可以把队伍名字放到字串里去
get_user_team ( index, [ team[], len ] )

index is a player index from 1 to 32.

If supplied, the team string name is stored in team for a maximum length of len characters.
页: [1]
查看完整版本: 请问版主,如何区分两个玩家是否敌人?为何会报错?