注册 登录
MOD中国同盟社 返回首页

编程爱好者 http://www.modchina.com/?25792 [收藏] [复制] [分享] [RSS] 空间主要记录一些AMXX代码

日志

重生和进度条

热度 3已有 800 次阅读2011-7-23 12:42 |个人分类:Amxx调试



new cvar_respawndelay

public plugin_init()
{
    register_event("DeathMsg", "event_deathmsg", "a")
    cvar_respawndelay = register_cvar("amx_respawndelay", "4.0") // Delay before respawning
}
public event_deathmsg() // 进度条
{
//new victim = read_data(2)
set_task(get_pcvar_float(cvar_respawndelay), "respawn_player",read_data(2))
message_begin(MSG_ONE,108,{0,0,0},read_data(2))
write_short(get_pcvar_num(cvar_respawndelay))
message_end()
}
public respawn_player(id) // 重生
{
// Disconnected, already spawned, or switched to Spectator
if (!is_user_connected(id) || is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)
return;
    
// (Debug only)
//client_print(0, print_chat, "Player %d is being respawned", id)

// Try to spawn the player setting the appropiate dead flag and forcing a think
switch( random_num(0,1))
{
case 0: cs_set_user_team( id, CS_TEAM_T );
case 1: cs_set_user_team( id, CS_TEAM_CT );
}
set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
dllfunc(DLLFunc_Think, id)
    
// Fix for CZ Bots: DLLFunc_Think won't work on them,
// but DLLFunc_Spawn does the job without any bugs.
// (for some reason I'm not suprised...)
if (is_user_bot(id) && pev(id, pev_deadflag) == DEAD_RESPAWNABLE)
{
dllfunc(DLLFunc_Spawn, id)
}
}
2

路过

鸡蛋
1

鲜花

握手

雷人

刚表态过的朋友 (3 人)

收藏 分享 转发到开心网 举报

发表评论 评论 (2 个评论)

回复 david0944 2011-7-25 15:33
  
回复 zhang2245 2012-1-13 03:21
  

facelist

您需要登录后才可以评论 登录 | 注册
验证问答 换一个 验证码 换一个

回顶部