|
发表于 2009-7-30 19:46:11
|
显示全部楼层
|阅读模式
来自 中国–河北–张家口
本帖最后由 btlive 于 2009-7-30 19:48 编辑
- Cvars -
amx_fps_display < 1 / 0 > < On / Off >
- Screenshots -
- Change log -
0.7.0
* Initial Release
0.7.1
* Little code optimization
*/
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
//Version
#define VERSION "0.7.1"
//Death Offset. Used to set player deaths.
#define OFFSET_DEATHS 444
//Maxplayers
#define MAXPLAYERS 32 + 1
//Handler Classname
#define HANDLER_CLASSNAME "玩家FPS显示"
//把玩家的死亡次数改为玩家FPS显示是
//Variable that contains entity ID used to recoginize handler entity in ham_think
new g_HandlerEnt
//Scoreboard Message
new g_ScoreMsg
//Current Player Frames
new g_PlayerFrames[MAXPLAYERS]
//On/Off
new c_On
public plugin_init() {
register_plugin("Player FPS Display",VERSION,"shine")
//Cvars
c_On = register_cvar("amx_fps_display","1")
register_cvar("player_fps",VERSION,FCVAR_SERVER|FCVAR_SPONLY)
//Fakemeta Forwards
register_forward(FM_PlayerPreThink,"PlayerPreThink")
//Ham Forwards
RegisterHam(Ham_Think,"info_target","PlayerFPSHandlerThink",1)
//Messages
g_ScoreMsg = get_user_msgid("ScoreInfo")
}
public plugin_cfg() {
g_HandlerEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
set_pev(g_HandlerEnt,pev_classname,HANDLER_CLASSNAME)
set_pev(g_HandlerEnt,pev_nextthink,get_gametime() + 1.0)
}
public PlayerPreThink(id) g_PlayerFrames[id]++
public PlayerFPSHandlerThink(Ent) {
if(Ent == g_HandlerEnt) {
if(get_pcvar_num(c_On)) {
static i,Frags,Team
for(i = 0; i < MAXPLAYERS; i++) {
if(is_user_connected(i)) {
Frags = get_user_frags(i)
Team = get_user_team(i)
set_pdata_int(i,OFFSET_DEATHS,g_PlayerFrames,5)
message_begin(MSG_ALL,g_ScoreMsg)
write_byte(i)
write_short(Frags)
write_short(g_PlayerFrames)
write_short(0)
write_short(Team)
message_end()
g_PlayerFrames = 0
}
}
}
set_pev(Ent,pev_nextthink,get_gametime() + 1.0)
}
}
这是个可以显示玩家FPS的插件它原先的显示位置在玩家死亡次数.可不可以让它显示在C4的位置啊 |
|