|
发表于 2010-12-25 17:11:35
|
显示全部楼层
|阅读模式
来自 中国–湖北–武汉
本帖最后由 Osker Lee 于 2010-12-25 17:29 编辑
这是一个普通的记分牌插件(team_score.amxx),功能是显示CT和T的比分,插件的源代码如下:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Team Score"
#define VERSION "1.0"
#define AUTHOR "k1nader"
#define LOADING "^n^t%s v%s, Copyright (C) 2010 by %s^n"
new ct_score, terrorist_score;
new g_connected[33];
new CT_HUD;
new TR_HUD;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
server_print(LOADING,PLUGIN,VERSION,AUTHOR);
register_event("TeamScore", "team_score", "a");
CT_HUD = CreateHudSyncObj();
TR_HUD = CreateHudSyncObj();
}
public client_putinserver(id)
{
g_connected[id] = true;
new param[1];
param[0] = id;
set_task(1.0,"iTeamScore",35848+id,param,1,"b");
}
public client_disconnect(id)
g_connected[id] = false;
public iTeamScore(param[])
{
new id = param[0];
if(!g_connected[id])
{
remove_task(35848+id);
return PLUGIN_CONTINUE;
}
set_hudmessage(255, 255, 255, -1.0, 0.0, 0, 0.5, 10.0, 0.08, 2.0, -1);
ShowSyncHudMsg(id,CT_HUD,"-= CT [%d] ", ct_score);
set_hudmessage(255, 255, 255, -1.0, 0.0, 0, 0.5, 10.0, 0.08, 2.0, -1);
ShowSyncHudMsg(id,TR_HUD," [%d] TS =-", terrorist_score);
return PLUGIN_CONTINUE;
}
public team_score()
{
new team[32];
read_data(1,team,31);
if (equal(team,"CT"))
ct_score = read_data(2);
else if (equal(team,"TERRORIST"))
terrorist_score = read_data(2);
}
我想再增加两个功能,一是增加局数显示的功能,二是增加显示双方未阵亡玩家人数的功能,效果如图示。对于第一个功能,貌似增加这句代码就可以了:
ShowSyncHudMsg(id,"%d", terrorist_score+ct_score)
但第二个功能,对于获取双方未阵亡玩家人数的代码就不是很懂了,麻烦高手帮忙修改一下。 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|