leiminlm 发表于 2008-6-24 19:28:35

求插件一方连输5局时,每人一次性补贴奖金1500

不知道点通有没有这小插件.
主要是为了平衡一下,一方连续死了5局,然后给输的方每人奖励些钱.

jim_yang 发表于 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

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 = 0
    g_team_losts = 0
}

public team_win()
{
    new sz
    read_data(2, sz, 19)
   
    new team = sz == 't' ? 2 : 1
   
    if(!g_last_lost_team)
    {
      g_last_lost_team = team
      g_team_losts++
      return
    }
   
    if(team == g_last_lost_team)
    {
      g_team_losts++
      if(g_team_losts == get_pcvar_num(g_cvar_round))
      {
            g_team_losts = 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 = 0
}


两个参数
lost_rounds5
award_money1500
页: [1]
查看完整版本: 求插件一方连输5局时,每人一次性补贴奖金1500