Помогите с Плагином

smxnet

Участник
Сообщения
80
Реакции
4
Привет ребят нужна помощь в общем дело такое у меня стоит два плагина один Halftime teamswitch
меняет команды местами а другой Losing Team Slayer плагин будет убивать игроков проигравшей команды в конце раунда так вот ребят в чем проблема то что когда остается последний раунд до смены местами команд то вот например террористы заложили бомбу а контры ее разминируют и как тока они ее разминировали раунд кончается их резко перебрасывает за теров и они умирают то есть как бы что контры обезвредили бомбу и типа не выполнили задачу и плагин losing team slayer их убивает в исходнике поглядел вроде он убивает их через kill мне вот интересно как бы сделать что бы в конце раунда они не умирали при перемещение при разминирование бомбы или хотя бы сделать так что при этой смерти у них в табе не заносилась смерть то есть играл человек 20 убийств 0 смертей а потом у него в табе уже 1 смерть после перемещения или можно сделать что бы от команды kill не появлялась смерть в табе в общем кто знает подскажите как лучше и как в обще это можно сделать заранее благодарю

вот исходник halftime
PHP:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#define PLUGIN_VERSION "1.0.11"
#define MAX_FILE_LEN 80

public Plugin:myinfo =
{
  name = "Halftime teamswitch",
  author = "[30+]Gemeni",
  description = "Moves all players to the opposite team at halftime",
  version = PLUGIN_VERSION,
  url = "http://30plus.ownit.se/"
};

// Global variables
new mapTime;
new g_maxrounds;
new g_winlimit;
new g_roundCount;
new bool:halftime;
new Handle:g_CvarSoundName = INVALID_HANDLE;
new bool:g_soundEnabled;
new Handle:g_h_moneyReset = INVALID_HANDLE;
new Handle:g_h_mp_startmoney = INVALID_HANDLE;
new Handle:g_h_mp_maxrounds = INVALID_HANDLE;
new Handle:g_h_mp_winlimit = INVALID_HANDLE;
new g_mp_startmoney;
new bool:g_resetMoney;
new bool:g_halftime_do_resetMoney = false;
new Handle:g_CvarHalfTimeType = INVALID_HANDLE;
new String:g_HalfTimeType[MAX_FILE_LEN];
new String:g_soundName[MAX_FILE_LEN];
new g_CtScore, g_TScore;

/* forwards */
new Handle:g_f_on_ht = INVALID_HANDLE;

// Offsets
new g_iAccount = -1;


// Setting halftime to false
public OnMapStart(){
  //LogToGame(">>>>>Setting halftime to false, OnMapStart<<<<<");
  halftime = false;
  g_roundCount = 0;

  GetConVarString(g_CvarHalfTimeType, g_HalfTimeType, MAX_FILE_LEN);
  GetConVarString(g_CvarSoundName, g_soundName, MAX_FILE_LEN);
 
  if (StrEqual(g_soundName, "")) {
    g_soundEnabled = false;
  }
  else {
    g_soundEnabled = true;
  }
 
  if (g_soundEnabled) {
    decl String:buffer[MAX_FILE_LEN];
    PrecacheSound(g_soundName, true);
    Format(buffer, sizeof(buffer), "sound/%s", g_soundName);
    AddFileToDownloadsTable(buffer);
  }
 
  new tmp;
  tmp = GetConVarInt(g_h_moneyReset);
  if (tmp == 1) {
    g_resetMoney = true;
  }
  else {
    g_resetMoney = false;
  }

  g_mp_startmoney = GetConVarInt(g_h_mp_startmoney);
  g_maxrounds = GetConVarInt(g_h_mp_maxrounds);
  g_winlimit = GetConVarInt(g_h_mp_winlimit);


}

public OnConfigsExecuted(){
  //LogToGame(">>>>>Setting halftime to false, OnConfigsExecuted<<<<<");
  halftime = false;
}

// Hooking events at plugin start
public OnPluginStart(){
  CreateConVar("sm_halftime_teamswitch_version", PLUGIN_VERSION, "Halftime teamswitch version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
  HookEvent("round_start", Event_RoundStart);
  HookEvent("round_end", Event_RoundEnd);

  g_CvarSoundName = CreateConVar("sm_halftime_sound", "gem_sounds/teamswitch.mp3", "The sound to play");
  g_h_moneyReset = CreateConVar("sm_halftime_money_reset", "1", "If weapons should be removed and money reset to mp_startmoney");
  g_h_mp_startmoney = FindConVar("mp_startmoney");
  g_h_mp_maxrounds = FindConVar("mp_maxrounds");
  g_h_mp_winlimit = FindConVar("mp_winlimit");
 
  g_CvarHalfTimeType = CreateConVar("sm_halftime_teamswitch_type", "timelimit", "timelimit|maxrounds|winlimit to determin what critera halftime should be based on");
 
  g_f_on_ht = CreateGlobalForward("gemHalftime", ET_Ignore);
 
  // Finding offset for CS cash
  g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount");
  if (g_iAccount == -1)
    SetFailState("m_iAccount offset not found");

}

// RoundStart gets the maptime
// Checks to see if halftime has passed, if not then make sure halftime is 0
// Setting halftime false here as well since in some occasions when extending map
// team switch can occur again.
public Event_RoundStart (Handle:event, const String:name[], bool:dontBroadcast)
{
  new wepIdx;
  new playerTeam;

  g_roundCount++;
  //LogMessage(">>> Increasing roundCount %d<<<", g_roundCount);

  GetMapTimeLimit(mapTime);
  mapTime=mapTime*60;
 
  //  new mapTimeLeft;
  //  GetMapTimeLeft(mapTimeLeft);
  //  if(mapTimeLeft>mapTime/2) {
  //    halftime = false;
  //  LogToGame(">>>>>Setting halftime to false, RoundStart<<<<<");
  //  }
 
  if (g_resetMoney && g_halftime_do_resetMoney) {
      for (new client=1; client<=GetMaxClients(); client++)
      {
        if (IsClientInGame (client) && IsClientConnected(client) && !IsFakeClient(client)) {
          for (new w = 0; w < 6; w++)
          {
              if (w != 2 && w != 4 ) 
                  while((wepIdx = GetPlayerWeaponSlot(client, w)) != -1)
                    RemovePlayerItem(client, wepIdx);       
          }         
          playerTeam = GetClientTeam(client);
          if (playerTeam == CS_TEAM_T) {
            GivePlayerItem(client, "weapon_glock");
          }
          else if (playerTeam == CS_TEAM_CT) {
            GivePlayerItem(client, "weapon_usp");
            if ((wepIdx = GetPlayerWeaponSlot(client, 6)) != -1)
              RemovePlayerItem(client, wepIdx);       
          }
          SetEntProp(client, Prop_Send, "m_ArmorValue", 0, 1);
          SetEntProp(client, Prop_Send, "m_bHasHelmet", 0, 1);

          SetEntData(client, g_iAccount, g_mp_startmoney, 4, true);
      }
    }
  }
  g_halftime_do_resetMoney = false;
}

// At Round end we check if time left of the map is passed halftime.
// If so and we have not already switched teams before, switch teams and then set halftime to 1
public Event_RoundEnd (Handle:event, const String:name[], bool:dontBroadcast)
{
  new mapTimeLeft;
  new bool:doSwap = false;
//  new CTScore, TScore;
  new reason = GetEventInt(event, "reason");
  new winner = GetEventInt(event, "winner");

  // Make sure that we have a normal round end
  // reason 16 is game commencing
  // other reasons are real round ends
  if(reason == 15) {
    g_CtScore = 0;
    g_TScore = 0;
    g_roundCount = 0;
    return;
  }
 
  //LogMessage(">>> winner %d CT:%d T:%d<<<",winner, CS_TEAM_CT, CS_TEAM_T);

  if (winner==CS_TEAM_T)
    g_TScore++;
  if (winner==CS_TEAM_CT)
    g_CtScore++;

  GetMapTimeLeft(mapTimeLeft);
 
  if ((mapTimeLeft<=mapTime/2) && StrEqual("timelimit", g_HalfTimeType)) {
    //LogMessage(">>> Halftime, Swap timelimit<<<");
    doSwap = true;
  }
  else if ((g_roundCount>=g_maxrounds/2) && StrEqual("maxrounds", g_HalfTimeType)) {
    //LogMessage(">>> Halftime, Swap maxrounds %d %d<<<", g_roundCount, g_maxrounds);
    doSwap = true;
  }
  else if ((g_roundCount>=g_winlimit/2) && StrEqual("winlimit", g_HalfTimeType)) {
    //LogMessage(">>> Halftime, Swap winlimit %d %d<<<", g_roundCount, g_maxrounds);
    doSwap = true;
  }
  else {
    //LogMessage(">>> Halftime, No swap <<<");
    doSwap = false;
  }
 
  if(doSwap && (halftime == false)) {
    new playerTeam;

    Call_StartForward(g_f_on_ht);
    Call_Finish();

    PrintToChatAll(">>> Halftime, switching players to oposite team <<<");
    PrintToChatAll(">>> Removing weapons and resetting money <<<");

    //LogMessage(">>> Halftime, switching players to oposite team <<<");

    //LogToGame(">>>>>Setting halftime to true<<<<<");
    halftime = true;

    //Loop through all players and see if they are in game and that they are on a team
    //LogMessage("Players to switch: %d", GetMaxClients());
    for (new i=1; i<=GetMaxClients(); i++)
    {
      if (IsClientInGame (i) && IsClientConnected(i)) {
        
        if (IsClientInGame (i) && IsClientConnected(i) && IsFakeClient(i)) {
          ForcePlayerSuicide(i);
        }
        
        g_halftime_do_resetMoney = true;
        
        //LogMessage("Player %d is InGame", i);
        playerTeam = GetClientTeam(i);
        if (playerTeam == CS_TEAM_T) {
          //LogMessage("Before switch of %d to CT", i);
          CS_SwitchTeam(i, CS_TEAM_CT);
          if (g_soundEnabled) {
            EmitSoundToClient(i,g_soundName);
          }
          //LogMessage("After switch of %d to CT", i);
        }
        else if (playerTeam == CS_TEAM_CT) {
          //LogMessage("Before switch of %d to T", i);
          CS_SwitchTeam(i, CS_TEAM_T);
          if (g_soundEnabled) {
            EmitSoundToClient(i,g_soundName);
          }
          //LogMessage("After switch of %d to T", i);
        }
        else {
          //LogMessage("No switch, not CT not T");
        }
      }
      else {
        //LogMessage("Player %d is *NOT* InGame", i);
      }
    }
    //CTScore = GetTeamScore(CS_TEAM_CT);
    //TScore = GetTeamScore(CS_TEAM_T);
    //SetTeamScore(CS_TEAM_CT, TScore);
    //SetTeamScore(CS_TEAM_T, CTScore);
    new tmp;
    tmp = g_CtScore;
    g_CtScore = g_TScore;
    g_TScore = tmp;

    //LogMessage(">>>>>halftime switch completed<<<<<");
  }
  // Else just advertise that teamswitch will occur at half time
  else if ((mapTimeLeft>mapTime/2) && (halftime == false)) {
    PrintToChatAll(">>> Players will switch teams at halftime <<<");
  }
  SetTeamScore(CS_TEAM_CT, g_CtScore);
  SetTeamScore(CS_TEAM_T, g_TScore);
}

вот исходник losing team slayer
PHP:
/**     Description::
* This plugin slay the surviving players of the losing team at roundend.
* CTґs killed by the bomb will not loose hlstatsx points since they atleast tried,
*  everyone else slayed will do so at all other times.
**/
/*      Credits::
    Thanks to FlyingMongoose,  pimpinjuice & Bailopan for answering my questions ;)
        Also thanks to all people that posted plugins in the forum (too many to mention),
                they are great examples to learn from.
*/
/*      Console Variables::
        lts_enabled (Default 1)                 Turn on/off plugin.
        lts_minplayer (Default 3)       Minimum amount of players connected for the plugin to start slaying.
        lts_slaymsg (Default 1)         Tell the slayed people why they got slayed?
        lts_slay (Default 1)            Turn on/off slay (Warning only and no slay if lts_slaymsg = 1).
        lts_target_bombed               (Default "[LTS] Defuse the bomb or die trying!")
        lts_target_saved                        (Default "[LTS] Plant the bomb or die trying!")
        lts_bomb_defused                (Default "[LTS] Protect the bomb at all times!")
        lts_all_hostages_rescued        (Default "[LTS] Keep CTґs away from the hostages!")
        lts_hostages_not_rescued        (Default "[LTS] Rescue the hostages or die trying!")
*/
/*      Todo::
        Nothing planned.
*/
#include <sourcemod>
#define PLUGIN_VERSION "1.3.0.1"

new Handle:minplayer;
new Handle:slaymsg;
new Handle:enabled;
new Handle:slay;
new Handle:target_bombed;
new Handle:target_saved;
new Handle:bomb_defused;
new Handle:all_hostages_rescued;
new Handle:hostages_not_rescued;

public Plugin:myinfo =
{
        name = "Losing Team Slayer",
        author = "Lindgren, Bacardi",
        description = "Losing team get slayed at the end of the round :: Aka. Autoslay",
        version = PLUGIN_VERSION,
        url = "http://forums.alliedmods.net/showpost.php?p=1221481&postcount=22"
}

public OnPluginStart()
{
        // For tracking purpose
        CreateConVar("losingteamslay_version", PLUGIN_VERSION, "Current Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

        enabled = CreateConVar("lts_enabled", "1", "Enable/Disable plugin");
        minplayer = CreateConVar("lts_minplayer", "3", "Sets the minimum number of players needed to start plugin");
        slaymsg = CreateConVar("lts_slaymsg", "1", "If slayed player get chat msg telling him why he got slayed");
        slay = CreateConVar("lts_slay", "1", "Slay On/Off, Ie. warning only and no slay if lts_slaymsg = 1");

        HookEvent("round_end", Event_RoundEnd);
}

public OnMapStart()
{
        /* Reads and replaces the standard chat messages with custom text */
        target_bombed = CreateConVar("lts_target_bombed", "[LTS] Defuse the bomb or die trying!", "When the bomb detonate.");
        target_saved = CreateConVar("lts_target_saved", "[LTS] Plant the bomb or die trying!", "When the bomb dont get planted");
        bomb_defused = CreateConVar("lts_bomb_defused", "[LTS] Protect the bomb at all times!", "When the bomb is defused");
        all_hostages_rescued = CreateConVar("lts_all_hostages_rescued", "[LTS] Keep CTґs away from the hostages!", "When all hostages are rescued");
        hostages_not_rescued = CreateConVar("lts_hostages_not_rescued", "[LTS] Rescue the hostages or die trying!", "When hostages are NOT rescued");
}

public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    new param = GetEventInt(event, "reason");
    new y = 0;
    for(new x = 1; x <= GetMaxClients(); ++x)
    {
            if(IsClientInGame(x))
                    y++;
    }
    if((y >= GetConVarInt(minplayer)) && (GetConVarInt(enabled) != 0))
    {
        new winner;
        new String:message[100];

        // Teamwinner:: 2 = T, 3 = CT
        if (param == 0)
        {
                winner = 2;     // #Target_Bombed
                GetConVarString(target_bombed, message, sizeof(message));
        }
        if (param == 11)
        {
                winner = 3;     // #Target_Saved
                GetConVarString(target_saved, message, sizeof(message));
        }
        if (param == 6)
        {
                winner = 3;     // #Bomb_Defused
                GetConVarString(bomb_defused, message, sizeof(message));
        }
        if (param == 10)
        {
                winner = 3;     // #All_Hostages_Rescued
                GetConVarString(all_hostages_rescued, message, sizeof(message));
        }
        if (param == 12)
        {
                winner = 2;     // #Hostages_Not_Rescued
                GetConVarString(hostages_not_rescued, message, sizeof(message));
        }
        if (param == 7)
                winner =0;      // #CT_Win (All Terrorists killed)
        if (param == 8)
                winner = 0;     // #Terrorist_win (All Counter-Terrorists killed)
        if (param == 9)
                winner = 0;     // #Round_Draw
        if (param == 15)
                winner = 0;     // #Game_Commensing

        for(new i = 1; i <= GetMaxClients(); ++i)
        {
            if(IsClientInGame(i))
            {
                new team = GetClientTeam(i);
                new hp = GetEntData(i, FindSendPropOffs("CCSPlayer", "m_iHealth"));
                if ((team != winner) && (team != 1) && (hp >= 1) && (winner != 0))
                {
                    if (GetConVarInt(slaymsg) != 0)
                        PrintToChat(i, "%s", message);
                    if (GetConVarInt(slay) != 0)
                        FakeClientCommand(i,"kill");
                }
            }
        }
    }
}
 

d4Ck

Урегулированный
Сообщения
730
Реакции
562
можно сделать что бы от команды kill не появлялась смерть в табе
Вроде должно работать
--- Добавлено позже ---
Нет, не работает
--- Добавлено позже ---
можно сделать что бы от команды kill не появлялась смерть в табе
Сейчас точно работает.
 
Последнее редактирование:

d4Ck

Урегулированный
Сообщения
730
Реакции
562

Вложения

  • suicidefix.smx
    3.7 КБ · Просмотры: 8
  • suicidefix.sp
    483 байт · Просмотры: 23
Последнее редактирование:

Someone

Участник
Сообщения
1,933
Реакции
1,653
Работало)
--- Добавлено позже ---

Вот так должно работать.
При использовании команды kill, смерть не прибавляется, фраг не отнимается.
По идее, после начала следующего раунда счет становится "правильным".
 

d4Ck

Урегулированный
Сообщения
730
Реакции
562
Последнее редактирование:

smxnet

Участник
Сообщения
80
Реакции
4
в общем если кто может помогите сделать так что бы при суициде не было чтобы не фраг не убавлялся не прибавлялась смерть
 
Последнее редактирование:

d4Ck

Урегулированный
Сообщения
730
Реакции
562
ты себя оскорбляй лучше тебе же написал что он не работает я уже проверял
Ты не писал, что он не работает, раз уж на то пошло, то хотя бы сообщай игру, на которую тебе нужен плагин.
 

smxnet

Участник
Сообщения
80
Реакции
4
Сверху Снизу