|
发表于 2008-6-26 19:18:05
|
显示全部楼层
来自 中国–北京–北京–海淀区
回复: 求插件一方连输5局时,每人一次性补贴奖金1500
- #include <amxmodx>
- #include <cstrike>
-
- #define PLUGIN "Test"
- #define AUTHOR "Jim"
- #define VERSION "1.0"
-
- new g_last_lost_team
- new g_team_losts[3]
-
- new g_cvar_round
- new g_cvar_money
-
- new g_maxplayers
-
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- g_cvar_round = register_cvar("lost_rounds", "5")
- g_cvar_money = register_cvar("award_money", "1500")
- register_event("TextMsg", "game_restart", "a", "1=4", "2&#Game_C", "2&#Game_w")
- register_event("SendAudio", "t_win", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin")
- g_maxplayers = get_maxplayers()
- }
-
- public game_restart()
- {
- g_last_lost_team = 0
- g_team_losts[1] = 0
- g_team_losts[2] = 0
- }
-
- public team_win()
- {
- new sz[20]
- read_data(2, sz, 19)
-
- new team = sz[7] == 't' ? 2 : 1
-
- if(!g_last_lost_team)
- {
- g_last_lost_team = team
- g_team_losts[team]++
- return
- }
-
- if(team == g_last_lost_team)
- {
- g_team_losts[team]++
- if(g_team_losts[team] == get_pcvar_num(g_cvar_round))
- {
- g_team_losts[team] = 0
- for(new i = 1; i <= g_maxplayers; ++i)
- {
- if(is_user_connected(i) && cs_get_user_team(i) == CsTeams:team)
- {
- cs_set_user_money(i, cs_get_user_money(i) + get_pcvar_num(g_cvar_money))
- }
- }
- }
- }
- else
- g_team_losts[team] = 0
- }
复制代码
两个参数
lost_rounds 5
award_money 1500 |
|