Молба за поправка на плъгин

Въпроси и проблеми свързани с AMXModX.
Аватар
cgozzie
Извън линия
Потребител
Потребител
Мнения: 1319
Регистриран на: 13 Окт 2016, 22:10
Местоположение: Варна
Се отблагодари: 245 пъти
Получена благодарност: 43 пъти

Re: Молба за поправка на плъгин

Мнение от cgozzie » 04 Мар 2023, 14:51

Radeon написа: 04 Мар 2023, 13:12 Мисля че работи както искаш ти, но трябва да тестваш.

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <tsstats>

#if AMXX_VERSION_NUM < 183

#endif
 
#define PLUGIN      "Score HUD"
#define VERSION      "1.0"
#define AUTHOR       "AndrewZ"
    
enum _:SCORE_DATA
{
   DISABLE,
   KILLS,
   HEADSHOTS,
   KNIFEKILLS,
   GRENADEKILLS,
   DEATHS
}
 
new g_user_score[ 33 ][ SCORE_DATA + 1 ]
new g_iLeader = -1
new g_maxplayers
    
new bool:g_reset_data
 
public plugin_init()
{
   register_plugin( PLUGIN, VERSION, AUTHOR )
    
   g_maxplayers = get_maxplayers()
    
   register_clcmd( "say /scoreoff", "cmd_scoreoff" )
    
   register_event( "DeathMsg", "event_death", "a" )
   register_event( "TextMsg", "event_textmsg_restart", "a", "2=#Game_will_restart_in" )
    
   register_logevent( "logevent_game_commencing", 2, "1=Game_Commencing" )
   register_logevent( "logevent_round_start", 2, "1=Round_Start" )
    
   set_task( 1.0, "rtask_show_hud", _, _, _, "b" )
}
 
public cmd_scoreoff( id )
{
   if( g_user_score[ id ][ DISABLE ] )
   {
      g_user_score[ id ][ DISABLE ] = 0
      client_print( id, print_chat, "HUD Informer statistics included." )
   }
   else
   {
      g_user_score[ id ][ DISABLE ] = 1
      client_print( id, print_chat, "HUD Informer statistics switched off." )
   }
    
   return PLUGIN_HANDLED
}   
 
public clear_data( id )
{
   if( !id )
   {
      for( new i = 1; i <= g_maxplayers; i ++ )
      {
         for( new data; data <= SCORE_DATA; data ++ )
            g_user_score[ i ][ data ] = 0
      }
      g_iLeader = -1
   }
   else
   {
      for( new data; data <= SCORE_DATA; data ++ )
         g_user_score[ id ][ data ] = 0
   }
}
 
 
public client_connect( id )       clear_data( id )
public client_disconnected( id )       clear_data( id )
public logevent_game_commencing()   clear_data( 0 )
public event_textmsg_restart()       g_reset_data = true
public logevent_round_start()
{
   if( g_reset_data )
   {
      clear_data( 0 )
      g_reset_data = false
   }
}
 
public event_death()
{
   new killer = read_data( 1 )
   new victim = read_data( 2 )
   new headshot = read_data( 3 )
   new weapon[ 12 ]; read_data( 4, weapon, 11 )
    
   if( !is_user_connected( killer ) && !is_user_connected( victim ) )
      return
       
   if( killer == victim )
   {
      g_user_score[ victim ][ DEATHS ] ++
      return
   }
       
   g_user_score[ killer ][ KILLS ] ++
    
   if( headshot )
      g_user_score[ killer ][ HEADSHOTS ] ++
       
   if( equal( weapon, "knife" ) )
      g_user_score[ killer ][ KNIFEKILLS ] ++
   else if( equal( weapon, "grenade" ) )
      g_user_score[ killer ][ GRENADEKILLS ] ++
    
   g_user_score[ victim ][ DEATHS ] ++
   new bNewLeader = true
   
    
   for ( new id = 1 ; id <= g_maxplayers ; id++ )
   {
    	 
       if ( g_user_score[ killer ][ KILLS ] < g_user_score[ id ][ KILLS ]) bNewLeader = false
       
   }
   if(bNewLeader) g_iLeader = killer
    
   
}
    
 
public rtask_show_hud()
{
   for( new id = 1; id <= g_maxplayers; id ++ )
   {
      if( !is_user_alive( id ) || g_user_score[ id ][ DISABLE ] )
         continue
	 
      new szLeaderName[ 33 ] 
      if( g_iLeader < 0 ) szLeaderName = "No Leader"
      else get_user_name( g_iLeader, szLeaderName, 32 )
      new iStats[ 8 ], iBody[ 8 ]
      new iRank = get_user_stats(id,iStats, iBody);
      new Float:kd, 
      Float:k = float( g_user_score[ id ][ KILLS ] ), 
      Float:d = float( g_user_score[ id ][ DEATHS ] )
       
      if( k && d )
         kd = k / d
          
      else kd = 0.0
       
       
      set_hudmessage( 255, 255, 255, -1.0, 0.01, 0, 0.0, 1.0, 0.1, 0.1 )
      show_hudmessage
      ( 
         id, "Kills: %d | Head: %d | Knife: %d | Grenade: %d | Deaths: %d | K/D: %.2f ^nLider: %s | Your rank: %d / %d", 
         g_user_score[ id ][ KILLS ], 
         g_user_score[ id ][ HEADSHOTS ], 
         g_user_score[ id ][ KNIFEKILLS ], 
         g_user_score[ id ][ GRENADEKILLS],
         g_user_score[ id ][ DEATHS ],
         kd,
	szLeaderName,
	iRank,
	get_statsnum()
      )
   }
}

 
Тествах го и работи и отчита всичко на 100% както го исках.Големи благодарности отново,за дъст и за деатмач е ок,за гън гейм не съм го тествал защото нямам такъв сървър,ако някой го тества да пише в темата.. :nicecode: :tnx:
Изображение

Аватар
Siska
Извън линия
Потребител
Потребител
Мнения: 772
Регистриран на: 03 Дек 2019, 22:29
Местоположение: Bedrock
Се отблагодари: 157 пъти
Получена благодарност: 48 пъти
Обратна връзка:

Re: Молба за поправка на плъгин

Мнение от Siska » 04 Мар 2023, 17:29

Аз оправих проблема и най-вероятно беше, заради начина на запазване на данните, защото ме има 5 пъти в класацията и предполагам, че затова се местеше ранкчето произволно, но сега го оправих.
На гънгейм махам лидера, защото там си има лидер и го ползвам така :
Изображение
Работи, благодаря !!!
Търсих врага и го открих : това съм аз , трябва да се победя...
Изображение
WWW.CSMEGAGAMING.COM Изображение Изображение Skype : Sisi-1_1

Аватар
cgozzie
Извън линия
Потребител
Потребител
Мнения: 1319
Регистриран на: 13 Окт 2016, 22:10
Местоположение: Варна
Се отблагодари: 245 пъти
Получена благодарност: 43 пъти

Re: Молба за поправка на плъгин

Мнение от cgozzie » 09 Мар 2023, 00:44

Radeon написа: 04 Мар 2023, 13:12 Мисля че работи както искаш ти, но трябва да тестваш.

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <tsstats>

#if AMXX_VERSION_NUM < 183

#endif
 
#define PLUGIN      "Score HUD"
#define VERSION      "1.0"
#define AUTHOR       "AndrewZ"
    
enum _:SCORE_DATA
{
   DISABLE,
   KILLS,
   HEADSHOTS,
   KNIFEKILLS,
   GRENADEKILLS,
   DEATHS
}
 
new g_user_score[ 33 ][ SCORE_DATA + 1 ]
new g_iLeader = -1
new g_maxplayers
    
new bool:g_reset_data
 
public plugin_init()
{
   register_plugin( PLUGIN, VERSION, AUTHOR )
    
   g_maxplayers = get_maxplayers()
    
   register_clcmd( "say /scoreoff", "cmd_scoreoff" )
    
   register_event( "DeathMsg", "event_death", "a" )
   register_event( "TextMsg", "event_textmsg_restart", "a", "2=#Game_will_restart_in" )
    
   register_logevent( "logevent_game_commencing", 2, "1=Game_Commencing" )
   register_logevent( "logevent_round_start", 2, "1=Round_Start" )
    
   set_task( 1.0, "rtask_show_hud", _, _, _, "b" )
}
 
public cmd_scoreoff( id )
{
   if( g_user_score[ id ][ DISABLE ] )
   {
      g_user_score[ id ][ DISABLE ] = 0
      client_print( id, print_chat, "HUD Informer statistics included." )
   }
   else
   {
      g_user_score[ id ][ DISABLE ] = 1
      client_print( id, print_chat, "HUD Informer statistics switched off." )
   }
    
   return PLUGIN_HANDLED
}   
 
public clear_data( id )
{
   if( !id )
   {
      for( new i = 1; i <= g_maxplayers; i ++ )
      {
         for( new data; data <= SCORE_DATA; data ++ )
            g_user_score[ i ][ data ] = 0
      }
      g_iLeader = -1
   }
   else
   {
      for( new data; data <= SCORE_DATA; data ++ )
         g_user_score[ id ][ data ] = 0
   }
}
 
 
public client_connect( id )       clear_data( id )
public client_disconnected( id )       clear_data( id )
public logevent_game_commencing()   clear_data( 0 )
public event_textmsg_restart()       g_reset_data = true
public logevent_round_start()
{
   if( g_reset_data )
   {
      clear_data( 0 )
      g_reset_data = false
   }
}
 
public event_death()
{
   new killer = read_data( 1 )
   new victim = read_data( 2 )
   new headshot = read_data( 3 )
   new weapon[ 12 ]; read_data( 4, weapon, 11 )
    
   if( !is_user_connected( killer ) && !is_user_connected( victim ) )
      return
       
   if( killer == victim )
   {
      g_user_score[ victim ][ DEATHS ] ++
      return
   }
       
   g_user_score[ killer ][ KILLS ] ++
    
   if( headshot )
      g_user_score[ killer ][ HEADSHOTS ] ++
       
   if( equal( weapon, "knife" ) )
      g_user_score[ killer ][ KNIFEKILLS ] ++
   else if( equal( weapon, "grenade" ) )
      g_user_score[ killer ][ GRENADEKILLS ] ++
    
   g_user_score[ victim ][ DEATHS ] ++
   new bNewLeader = true
   
    
   for ( new id = 1 ; id <= g_maxplayers ; id++ )
   {
    	 
       if ( g_user_score[ killer ][ KILLS ] < g_user_score[ id ][ KILLS ]) bNewLeader = false
       
   }
   if(bNewLeader) g_iLeader = killer
    
   
}
    
 
public rtask_show_hud()
{
   for( new id = 1; id <= g_maxplayers; id ++ )
   {
      if( !is_user_alive( id ) || g_user_score[ id ][ DISABLE ] )
         continue
	 
      new szLeaderName[ 33 ] 
      if( g_iLeader < 0 ) szLeaderName = "No Leader"
      else get_user_name( g_iLeader, szLeaderName, 32 )
      new iStats[ 8 ], iBody[ 8 ]
      new iRank = get_user_stats(id,iStats, iBody);
      new Float:kd, 
      Float:k = float( g_user_score[ id ][ KILLS ] ), 
      Float:d = float( g_user_score[ id ][ DEATHS ] )
       
      if( k && d )
         kd = k / d
          
      else kd = 0.0
       
       
      set_hudmessage( 255, 255, 255, -1.0, 0.01, 0, 0.0, 1.0, 0.1, 0.1 )
      show_hudmessage
      ( 
         id, "Kills: %d | Head: %d | Knife: %d | Grenade: %d | Deaths: %d | K/D: %.2f ^nLider: %s | Your rank: %d / %d", 
         g_user_score[ id ][ KILLS ], 
         g_user_score[ id ][ HEADSHOTS ], 
         g_user_score[ id ][ KNIFEKILLS ], 
         g_user_score[ id ][ GRENADEKILLS],
         g_user_score[ id ][ DEATHS ],
         kd,
	szLeaderName,
	iRank,
	get_statsnum()
      )
   }
}

 
Здравей плъгина си работи на 100% както споменах вече,но днес реших да си закупя привайт плъгин за топ15,и току що забелязох че само Ранка не го отчита може би защото този топ 15 работи със сял.Иначе като си беше от csstats.dat да взима си отчиташе.Сега незнам дали трябва в плъгина да му се добави от сял заявката за да го отчита поне така мисля че трябва.Ще сложа сяла и вие вече ще кажете и да се добави.

Изображение

sql.

Код за потвърждение: Избери целия код

-- phpMyAdmin SQL Dump
-- version 4.9.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Mar 08, 2023 at 10:40 PM
-- Server version: 10.3.37-MariaDB
-- PHP Version: 7.4.33

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `csoldsch_statsx`
--

-- --------------------------------------------------------

--
-- Table structure for table `csstats_players`
--

CREATE TABLE `csstats_players` (
  `id` int(11) NOT NULL,
  `nick` varchar(32) NOT NULL,
  `authid` varchar(32) NOT NULL,
  `ip` varchar(32) NOT NULL,
  `frags` int(11) NOT NULL DEFAULT 0,
  `deaths` int(11) NOT NULL DEFAULT 0,
  `headshots` int(11) NOT NULL DEFAULT 0,
  `teamkills` int(11) NOT NULL DEFAULT 0,
  `shots` int(11) NOT NULL DEFAULT 0,
  `hits` int(11) NOT NULL DEFAULT 0,
  `damage` int(11) NOT NULL DEFAULT 0,
  `suicide` int(11) NOT NULL DEFAULT 0,
  `defusing` int(11) NOT NULL DEFAULT 0,
  `defused` int(11) NOT NULL DEFAULT 0,
  `planted` int(11) NOT NULL DEFAULT 0,
  `explode` int(11) NOT NULL DEFAULT 0,
  `place` int(11) NOT NULL DEFAULT 0,
  `lasttime` int(11) NOT NULL DEFAULT 0,
  `gametime` int(11) NOT NULL DEFAULT 0,
  `connects` int(11) NOT NULL DEFAULT 0,
  `rounds` int(11) NOT NULL DEFAULT 0,
  `wint` int(11) NOT NULL DEFAULT 0,
  `winct` int(11) NOT NULL DEFAULT 0,
  `skill` int(11) NOT NULL DEFAULT 0,
  `ar_addxp` int(11) NOT NULL DEFAULT 0,
  `ar_anew` int(11) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `csstats_players`
--

INSERT INTO `csstats_players` (`id`, `nick`, `authid`, `ip`, `frags`, `deaths`, `headshots`, `teamkills`, `shots`, `hits`, `damage`, `suicide`, `defusing`, `defused`, `planted`, `explode`, `place`, `lasttime`, `gametime`, `connects`, `rounds`, `wint`, `winct`, `skill`, `ar_addxp`, `ar_anew`) VALUES
(1, 'cgozzie', 'STEAM_0:1:512845310', '78.83.221.12', 61, 36, 28, 0, 94, 72, 15586, 0, 0, 0, 0, 0, 1, 1678314958, 3919, 16, 9, 6, 0, 113, 0, 0),
(2, 'Lobo', 'STEAM_0:1:30959246', '24.135.217.250', 258, 49, 65, 0, 400, 275, 51467, 0, 0, 0, 0, 0, 1, 1678282247, 1673, 2, 18, 13, 4, 162, 0, 0),
(3, 'LD-hamas', 'STEAM_0:1:181793335', '188.17.49.174', 210, 34, 79, 0, 375, 234, 49476, 0, 0, 0, 0, 0, 3, 1678295629, 14674, 7, 15, 10, 0, 168, 0, 0),
(5, 'ZR-M9SNIK', 'STEAM_0:0:761519239', '62.182.75.192', 170, 44, 27, 0, 345, 194, 29021, 0, 0, 0, 0, 0, 3, 1678310984, 1475, 1, 9, 0, 6, 148, 0, 0);
Изображение

Аватар
bustA
Извън линия
Потребител
Потребител
Мнения: 264
Регистриран на: 20 Юни 2020, 11:47
Се отблагодари: 42 пъти
Получена благодарност: 27 пъти
Обратна връзка:

Re: Молба за поправка на плъгин

Мнение от bustA » 09 Мар 2023, 06:50

Прочети добре описанието на плъгина който си закупил, ако е същия който аз съм гледал няма как да има ракн. Този плъгин е допълнение към statsx
Cs-Plovdiv.com - Aim Attack - 93.123.16.4:27022 :gamer1:

Аватар
Radeon
Извън линия
Потребител
Потребител
Мнения: 143
Регистриран на: 04 Апр 2021, 11:30
Се отблагодари: 2 пъти
Получена благодарност: 34 пъти
Обратна връзка:

Re: Молба за поправка на плъгин

Мнение от Radeon » 09 Мар 2023, 10:18

Здравей плъгина си работи на 100% както споменах вече,но днес реших да си закупя привайт плъгин за топ15,и току що забелязох че само Ранка не го отчита може би защото този топ 15 работи със сял.Иначе като си беше от csstats.dat да взима си отчиташе.Сега незнам дали трябва в плъгина да му се добави от сял заявката за да го отчита поне така мисля че трябва.Ще сложа сяла и вие вече ще кажете и да се добави.

Изображение

sql.

Код за потвърждение: Избери целия код

-- phpMyAdmin SQL Dump
-- version 4.9.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Mar 08, 2023 at 10:40 PM
-- Server version: 10.3.37-MariaDB
-- PHP Version: 7.4.33

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `csoldsch_statsx`
--

-- --------------------------------------------------------

--
-- Table structure for table `csstats_players`
--

CREATE TABLE `csstats_players` (
  `id` int(11) NOT NULL,
  `nick` varchar(32) NOT NULL,
  `authid` varchar(32) NOT NULL,
  `ip` varchar(32) NOT NULL,
  `frags` int(11) NOT NULL DEFAULT 0,
  `deaths` int(11) NOT NULL DEFAULT 0,
  `headshots` int(11) NOT NULL DEFAULT 0,
  `teamkills` int(11) NOT NULL DEFAULT 0,
  `shots` int(11) NOT NULL DEFAULT 0,
  `hits` int(11) NOT NULL DEFAULT 0,
  `damage` int(11) NOT NULL DEFAULT 0,
  `suicide` int(11) NOT NULL DEFAULT 0,
  `defusing` int(11) NOT NULL DEFAULT 0,
  `defused` int(11) NOT NULL DEFAULT 0,
  `planted` int(11) NOT NULL DEFAULT 0,
  `explode` int(11) NOT NULL DEFAULT 0,
  `place` int(11) NOT NULL DEFAULT 0,
  `lasttime` int(11) NOT NULL DEFAULT 0,
  `gametime` int(11) NOT NULL DEFAULT 0,
  `connects` int(11) NOT NULL DEFAULT 0,
  `rounds` int(11) NOT NULL DEFAULT 0,
  `wint` int(11) NOT NULL DEFAULT 0,
  `winct` int(11) NOT NULL DEFAULT 0,
  `skill` int(11) NOT NULL DEFAULT 0,
  `ar_addxp` int(11) NOT NULL DEFAULT 0,
  `ar_anew` int(11) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `csstats_players`
--

INSERT INTO `csstats_players` (`id`, `nick`, `authid`, `ip`, `frags`, `deaths`, `headshots`, `teamkills`, `shots`, `hits`, `damage`, `suicide`, `defusing`, `defused`, `planted`, `explode`, `place`, `lasttime`, `gametime`, `connects`, `rounds`, `wint`, `winct`, `skill`, `ar_addxp`, `ar_anew`) VALUES
(1, 'cgozzie', 'STEAM_0:1:512845310', '78.83.221.12', 61, 36, 28, 0, 94, 72, 15586, 0, 0, 0, 0, 0, 1, 1678314958, 3919, 16, 9, 6, 0, 113, 0, 0),
(2, 'Lobo', 'STEAM_0:1:30959246', '24.135.217.250', 258, 49, 65, 0, 400, 275, 51467, 0, 0, 0, 0, 0, 1, 1678282247, 1673, 2, 18, 13, 4, 162, 0, 0),
(3, 'LD-hamas', 'STEAM_0:1:181793335', '188.17.49.174', 210, 34, 79, 0, 375, 234, 49476, 0, 0, 0, 0, 0, 3, 1678295629, 14674, 7, 15, 10, 0, 168, 0, 0),
(5, 'ZR-M9SNIK', 'STEAM_0:0:761519239', '62.182.75.192', 170, 44, 27, 0, 345, 194, 29021, 0, 0, 0, 0, 0, 3, 1678310984, 1475, 1, 9, 0, 6, 148, 0, 0);
[/quote]

Да , поради тази причина не ти отчита ранг. Ако искаш аз да се опитам да го направя , ще ми трябва кода от плъгина който си купил, за да видя как взима данните от sql . Ако искаш може да чакаш някой който разбира повече да го направи без да му даваш кода.

Аватар
cgozzie
Извън линия
Потребител
Потребител
Мнения: 1319
Регистриран на: 13 Окт 2016, 22:10
Местоположение: Варна
Се отблагодари: 245 пъти
Получена благодарност: 43 пъти

Re: Молба за поправка на плъгин

Мнение от cgozzie » 09 Мар 2023, 10:29

Плъгина е закупен от FUNGUN.NET Автор: SKAJIbnEJIb явно няма да може защото те си имат и собствена ранк система,свързана с този топ15.
Тогава нека да се премахне ранка само другото си работи няма проблеми..

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <tsstats>

#if AMXX_VERSION_NUM < 183

#endif
 
#define PLUGIN      "Score HUD"
#define VERSION      "1.0"
#define AUTHOR       "AndrewZ"
    
enum _:SCORE_DATA
{
   DISABLE,
   KILLS,
   HEADSHOTS,
   KNIFEKILLS,
   GRENADEKILLS,
   DEATHS
}
 
new g_user_score[ 33 ][ SCORE_DATA + 1 ]
new g_iLeader = -1
new g_maxplayers
    
new bool:g_reset_data
 
public plugin_init()
{
   register_plugin( PLUGIN, VERSION, AUTHOR )
    
   g_maxplayers = get_maxplayers()
    
   register_clcmd( "say /scoreoff", "cmd_scoreoff" )
    
   register_event( "DeathMsg", "event_death", "a" )
   register_event( "TextMsg", "event_textmsg_restart", "a", "2=#Game_will_restart_in" )
    
   register_logevent( "logevent_game_commencing", 2, "1=Game_Commencing" )
   register_logevent( "logevent_round_start", 2, "1=Round_Start" )
    
   set_task( 1.0, "rtask_show_hud", _, _, _, "b" )
}
 
public cmd_scoreoff( id )
{
   if( g_user_score[ id ][ DISABLE ] )
   {
      g_user_score[ id ][ DISABLE ] = 0
      client_print( id, print_chat, "HUD Informer statistics included." )
   }
   else
   {
      g_user_score[ id ][ DISABLE ] = 1
      client_print( id, print_chat, "HUD Informer statistics switched off." )
   }
    
   return PLUGIN_HANDLED
}   
 
public clear_data( id )
{
   if( !id )
   {
      for( new i = 1; i <= g_maxplayers; i ++ )
      {
         for( new data; data <= SCORE_DATA; data ++ )
            g_user_score[ i ][ data ] = 0
      }
      g_iLeader = -1
   }
   else
   {
      for( new data; data <= SCORE_DATA; data ++ )
         g_user_score[ id ][ data ] = 0
   }
}
 
 
public client_connect( id )       clear_data( id )
public client_disconnected( id )       clear_data( id )
public logevent_game_commencing()   clear_data( 0 )
public event_textmsg_restart()       g_reset_data = true
public logevent_round_start()
{
   if( g_reset_data )
   {
      clear_data( 0 )
      g_reset_data = false
   }
}
 
public event_death()
{
   new killer = read_data( 1 )
   new victim = read_data( 2 )
   new headshot = read_data( 3 )
   new weapon[ 12 ]; read_data( 4, weapon, 11 )
    
   if( !is_user_connected( killer ) && !is_user_connected( victim ) )
      return
       
   if( killer == victim )
   {
      g_user_score[ victim ][ DEATHS ] ++
      return
   }
       
   g_user_score[ killer ][ KILLS ] ++
    
   if( headshot )
      g_user_score[ killer ][ HEADSHOTS ] ++
       
   if( equal( weapon, "knife" ) )
      g_user_score[ killer ][ KNIFEKILLS ] ++
   else if( equal( weapon, "grenade" ) )
      g_user_score[ killer ][ GRENADEKILLS ] ++
    
   g_user_score[ victim ][ DEATHS ] ++
   new bNewLeader = true
   
    
   for ( new id = 1 ; id <= g_maxplayers ; id++ )
   {
    	 
       if ( g_user_score[ killer ][ KILLS ] < g_user_score[ id ][ KILLS ]) bNewLeader = false
       
   }
   if(bNewLeader) g_iLeader = killer
    
   
}
    
 
public rtask_show_hud()
{
   for( new id = 1; id <= g_maxplayers; id ++ )
   {
      if( !is_user_alive( id ) || g_user_score[ id ][ DISABLE ] )
         continue
	 
      new szLeaderName[ 33 ] 
      if( g_iLeader < 0 ) szLeaderName = "No Leader"
      else get_user_name( g_iLeader, szLeaderName, 32 )
      new iStats[ 8 ], iBody[ 8 ]
      new iRank = get_user_stats(id,iStats, iBody);
      new Float:kd, 
      Float:k = float( g_user_score[ id ][ KILLS ] ), 
      Float:d = float( g_user_score[ id ][ DEATHS ] )
       
      if( k && d )
         kd = k / d
          
      else kd = 0.0
       
       
      set_hudmessage( 255, 255, 255, -1.0, 0.01, 0, 0.0, 1.0, 0.1, 0.1 )
      show_hudmessage
      ( 
         id, "Kills: %d | Head: %d | Knife: %d | Grenade: %d | Deaths: %d | K/D: %.2f ^nLider: %s | Your rank: %d / %d", 
         g_user_score[ id ][ KILLS ], 
         g_user_score[ id ][ HEADSHOTS ], 
         g_user_score[ id ][ KNIFEKILLS ], 
         g_user_score[ id ][ GRENADEKILLS],
         g_user_score[ id ][ DEATHS ],
         kd,
	szLeaderName,
	iRank,
	get_statsnum()
      )
   }
}
Изображение

Аватар
Radeon
Извън линия
Потребител
Потребител
Мнения: 143
Регистриран на: 04 Апр 2021, 11:30
Се отблагодари: 2 пъти
Получена благодарност: 34 пъти
Обратна връзка:

Re: Молба за поправка на плъгин

Мнение от Radeon » 09 Мар 2023, 11:15

cgozzie написа: 09 Мар 2023, 10:29 Плъгина е закупен от FUNGUN.NET Автор: SKAJIbnEJIb явно няма да може защото те си имат и собствена ранк система,свързана с този топ15.
Тогава нека да се премахне ранка само другото си работи няма проблеми..

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <tsstats>

#if AMXX_VERSION_NUM < 183

#endif
 
#define PLUGIN      "Score HUD"
#define VERSION      "1.0"
#define AUTHOR       "AndrewZ"
    
enum _:SCORE_DATA
{
   DISABLE,
   KILLS,
   HEADSHOTS,
   KNIFEKILLS,
   GRENADEKILLS,
   DEATHS
}
 
new g_user_score[ 33 ][ SCORE_DATA + 1 ]
new g_iLeader = -1
new g_maxplayers
    
new bool:g_reset_data
 
public plugin_init()
{
   register_plugin( PLUGIN, VERSION, AUTHOR )
    
   g_maxplayers = get_maxplayers()
    
   register_clcmd( "say /scoreoff", "cmd_scoreoff" )
    
   register_event( "DeathMsg", "event_death", "a" )
   register_event( "TextMsg", "event_textmsg_restart", "a", "2=#Game_will_restart_in" )
    
   register_logevent( "logevent_game_commencing", 2, "1=Game_Commencing" )
   register_logevent( "logevent_round_start", 2, "1=Round_Start" )
    
   set_task( 1.0, "rtask_show_hud", _, _, _, "b" )
}
 
public cmd_scoreoff( id )
{
   if( g_user_score[ id ][ DISABLE ] )
   {
      g_user_score[ id ][ DISABLE ] = 0
      client_print( id, print_chat, "HUD Informer statistics included." )
   }
   else
   {
      g_user_score[ id ][ DISABLE ] = 1
      client_print( id, print_chat, "HUD Informer statistics switched off." )
   }
    
   return PLUGIN_HANDLED
}   
 
public clear_data( id )
{
   if( !id )
   {
      for( new i = 1; i <= g_maxplayers; i ++ )
      {
         for( new data; data <= SCORE_DATA; data ++ )
            g_user_score[ i ][ data ] = 0
      }
      g_iLeader = -1
   }
   else
   {
      for( new data; data <= SCORE_DATA; data ++ )
         g_user_score[ id ][ data ] = 0
   }
}
 
 
public client_connect( id )       clear_data( id )
public client_disconnected( id )       clear_data( id )
public logevent_game_commencing()   clear_data( 0 )
public event_textmsg_restart()       g_reset_data = true
public logevent_round_start()
{
   if( g_reset_data )
   {
      clear_data( 0 )
      g_reset_data = false
   }
}
 
public event_death()
{
   new killer = read_data( 1 )
   new victim = read_data( 2 )
   new headshot = read_data( 3 )
   new weapon[ 12 ]; read_data( 4, weapon, 11 )
    
   if( !is_user_connected( killer ) && !is_user_connected( victim ) )
      return
       
   if( killer == victim )
   {
      g_user_score[ victim ][ DEATHS ] ++
      return
   }
       
   g_user_score[ killer ][ KILLS ] ++
    
   if( headshot )
      g_user_score[ killer ][ HEADSHOTS ] ++
       
   if( equal( weapon, "knife" ) )
      g_user_score[ killer ][ KNIFEKILLS ] ++
   else if( equal( weapon, "grenade" ) )
      g_user_score[ killer ][ GRENADEKILLS ] ++
    
   g_user_score[ victim ][ DEATHS ] ++
   new bNewLeader = true
   
    
   for ( new id = 1 ; id <= g_maxplayers ; id++ )
   {
    	 
       if ( g_user_score[ killer ][ KILLS ] < g_user_score[ id ][ KILLS ]) bNewLeader = false
       
   }
   if(bNewLeader) g_iLeader = killer
    
   
}
    
 
public rtask_show_hud()
{
   for( new id = 1; id <= g_maxplayers; id ++ )
   {
      if( !is_user_alive( id ) || g_user_score[ id ][ DISABLE ] )
         continue
	 
      new szLeaderName[ 33 ] 
      if( g_iLeader < 0 ) szLeaderName = "No Leader"
      else get_user_name( g_iLeader, szLeaderName, 32 )
      new iStats[ 8 ], iBody[ 8 ]
      new iRank = get_user_stats(id,iStats, iBody);
      new Float:kd, 
      Float:k = float( g_user_score[ id ][ KILLS ] ), 
      Float:d = float( g_user_score[ id ][ DEATHS ] )
       
      if( k && d )
         kd = k / d
          
      else kd = 0.0
       
       
      set_hudmessage( 255, 255, 255, -1.0, 0.01, 0, 0.0, 1.0, 0.1, 0.1 )
      show_hudmessage
      ( 
         id, "Kills: %d | Head: %d | Knife: %d | Grenade: %d | Deaths: %d | K/D: %.2f ^nLider: %s | Your rank: %d / %d", 
         g_user_score[ id ][ KILLS ], 
         g_user_score[ id ][ HEADSHOTS ], 
         g_user_score[ id ][ KNIFEKILLS ], 
         g_user_score[ id ][ GRENADEKILLS],
         g_user_score[ id ][ DEATHS ],
         kd,
	szLeaderName,
	iRank,
	get_statsnum()
      )
   }
}

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <tsstats>

#if AMXX_VERSION_NUM < 183

#endif
 
#define PLUGIN      "Score HUD"
#define VERSION      "1.0"
#define AUTHOR       "AndrewZ"
    
enum _:SCORE_DATA
{
   DISABLE,
   KILLS,
   HEADSHOTS,
   KNIFEKILLS,
   GRENADEKILLS,
   DEATHS
}
 
new g_user_score[ 33 ][ SCORE_DATA + 1 ]
new g_iLeader = -1
new g_maxplayers
    
new bool:g_reset_data
 
public plugin_init()
{
   register_plugin( PLUGIN, VERSION, AUTHOR )
    
   g_maxplayers = get_maxplayers()
    
   register_clcmd( "say /scoreoff", "cmd_scoreoff" )
    
   register_event( "DeathMsg", "event_death", "a" )
   register_event( "TextMsg", "event_textmsg_restart", "a", "2=#Game_will_restart_in" )
    
   register_logevent( "logevent_game_commencing", 2, "1=Game_Commencing" )
   register_logevent( "logevent_round_start", 2, "1=Round_Start" )
    
   set_task( 1.0, "rtask_show_hud", _, _, _, "b" )
}
 
public cmd_scoreoff( id )
{
   if( g_user_score[ id ][ DISABLE ] )
   {
      g_user_score[ id ][ DISABLE ] = 0
      client_print( id, print_chat, "HUD Informer statistics included." )
   }
   else
   {
      g_user_score[ id ][ DISABLE ] = 1
      client_print( id, print_chat, "HUD Informer statistics switched off." )
   }
    
   return PLUGIN_HANDLED
}   
 
public clear_data( id )
{
   if( !id )
   {
      for( new i = 1; i <= g_maxplayers; i ++ )
      {
         for( new data; data <= SCORE_DATA; data ++ )
            g_user_score[ i ][ data ] = 0
      }
      g_iLeader = -1
   }
   else
   {
      for( new data; data <= SCORE_DATA; data ++ )
         g_user_score[ id ][ data ] = 0
   }
}
 
 
public client_connect( id )       clear_data( id )
public client_disconnected( id )       clear_data( id )
public logevent_game_commencing()   clear_data( 0 )
public event_textmsg_restart()       g_reset_data = true
public logevent_round_start()
{
   if( g_reset_data )
   {
      clear_data( 0 )
      g_reset_data = false
   }
}
 
public event_death()
{
   new killer = read_data( 1 )
   new victim = read_data( 2 )
   new headshot = read_data( 3 )
   new weapon[ 12 ]; read_data( 4, weapon, 11 )
    
   if( !is_user_connected( killer ) && !is_user_connected( victim ) )
      return
       
   if( killer == victim )
   {
      g_user_score[ victim ][ DEATHS ] ++
      return
   }
       
   g_user_score[ killer ][ KILLS ] ++
    
   if( headshot )
      g_user_score[ killer ][ HEADSHOTS ] ++
       
   if( equal( weapon, "knife" ) )
      g_user_score[ killer ][ KNIFEKILLS ] ++
   else if( equal( weapon, "grenade" ) )
      g_user_score[ killer ][ GRENADEKILLS ] ++
    
   g_user_score[ victim ][ DEATHS ] ++
   new bNewLeader = true
   
    
   for ( new id = 1 ; id <= g_maxplayers ; id++ )
   {
    	 
       if ( g_user_score[ killer ][ KILLS ] < g_user_score[ id ][ KILLS ]) bNewLeader = false
       
   }
   if(bNewLeader) g_iLeader = killer
    
   
}
    
 
public rtask_show_hud()
{
   for( new id = 1; id <= g_maxplayers; id ++ )
   {
      if( !is_user_alive( id ) || g_user_score[ id ][ DISABLE ] )
         continue
	 
      new szLeaderName[ 33 ] 
      if( g_iLeader < 0 ) szLeaderName = "No Leader"
      else get_user_name( g_iLeader, szLeaderName, 32 )
      new Float:kd, 
      Float:k = float( g_user_score[ id ][ KILLS ] ), 
      Float:d = float( g_user_score[ id ][ DEATHS ] )
       
      if( k && d )
         kd = k / d
          
      else kd = 0.0
       
       
      set_hudmessage( 255, 255, 255, -1.0, 0.01, 0, 0.0, 1.0, 0.1, 0.1 )
      show_hudmessage
      ( 
         id, "Kills: %d | Head: %d | Knife: %d | Grenade: %d | Deaths: %d | K/D: %.2f ^nLider: %s ", 
         g_user_score[ id ][ KILLS ], 
         g_user_score[ id ][ HEADSHOTS ], 
         g_user_score[ id ][ KNIFEKILLS ], 
         g_user_score[ id ][ GRENADEKILLS],
         g_user_score[ id ][ DEATHS ],
         kd,
	szLeaderName
	
      )
   }
}

Аватар
cgozzie
Извън линия
Потребител
Потребител
Мнения: 1319
Регистриран на: 13 Окт 2016, 22:10
Местоположение: Варна
Се отблагодари: 245 пъти
Получена благодарност: 43 пъти

Re: Молба за поправка на плъгин

Мнение от cgozzie » 01 Авг 2023, 20:02

Здравейте ще може ли в плъгина да остане само nLider: и Your rank:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <tsstats>

#if AMXX_VERSION_NUM < 183

#endif
 
#define PLUGIN      "Score HUD"
#define VERSION      "1.0"
#define AUTHOR       "AndrewZ"
    
enum _:SCORE_DATA
{
   DISABLE,
   KILLS,
   HEADSHOTS,
   KNIFEKILLS,
   GRENADEKILLS,
   DEATHS
}
 
new g_user_score[ 33 ][ SCORE_DATA + 1 ]
new g_iLeader = -1
new g_maxplayers
    
new bool:g_reset_data
 
public plugin_init()
{
   register_plugin( PLUGIN, VERSION, AUTHOR )
    
   g_maxplayers = get_maxplayers()
    
   register_clcmd( "say /scoreoff", "cmd_scoreoff" )
    
   register_event( "DeathMsg", "event_death", "a" )
   register_event( "TextMsg", "event_textmsg_restart", "a", "2=#Game_will_restart_in" )
    
   register_logevent( "logevent_game_commencing", 2, "1=Game_Commencing" )
   register_logevent( "logevent_round_start", 2, "1=Round_Start" )
    
   set_task( 1.0, "rtask_show_hud", _, _, _, "b" )
}
 
public cmd_scoreoff( id )
{
   if( g_user_score[ id ][ DISABLE ] )
   {
      g_user_score[ id ][ DISABLE ] = 0
      client_print( id, print_chat, "HUD Informer statistics included." )
   }
   else
   {
      g_user_score[ id ][ DISABLE ] = 1
      client_print( id, print_chat, "HUD Informer statistics switched off." )
   }
    
   return PLUGIN_HANDLED
}   
 
public clear_data( id )
{
   if( !id )
   {
      for( new i = 1; i <= g_maxplayers; i ++ )
      {
         for( new data; data <= SCORE_DATA; data ++ )
            g_user_score[ i ][ data ] = 0
      }
      g_iLeader = -1
   }
   else
   {
      for( new data; data <= SCORE_DATA; data ++ )
         g_user_score[ id ][ data ] = 0
   }
}
 
 
public client_connect( id )       clear_data( id )
public client_disconnected( id )       clear_data( id )
public logevent_game_commencing()   clear_data( 0 )
public event_textmsg_restart()       g_reset_data = true
public logevent_round_start()
{
   if( g_reset_data )
   {
      clear_data( 0 )
      g_reset_data = false
   }
}
 
public event_death()
{
   new killer = read_data( 1 )
   new victim = read_data( 2 )
   new headshot = read_data( 3 )
   new weapon[ 12 ]; read_data( 4, weapon, 11 )
    
   if( !is_user_connected( killer ) && !is_user_connected( victim ) )
      return
       
   if( killer == victim )
   {
      g_user_score[ victim ][ DEATHS ] ++
      return
   }
       
   g_user_score[ killer ][ KILLS ] ++
    
   if( headshot )
      g_user_score[ killer ][ HEADSHOTS ] ++
       
   if( equal( weapon, "knife" ) )
      g_user_score[ killer ][ KNIFEKILLS ] ++
   else if( equal( weapon, "grenade" ) )
      g_user_score[ killer ][ GRENADEKILLS ] ++
    
   g_user_score[ victim ][ DEATHS ] ++
   new bNewLeader = true
   
    
   for ( new id = 1 ; id <= g_maxplayers ; id++ )
   {
    	 
       if ( g_user_score[ killer ][ KILLS ] < g_user_score[ id ][ KILLS ]) bNewLeader = false
       
   }
   if(bNewLeader) g_iLeader = killer
    
   
}
    
 
public rtask_show_hud()
{
   for( new id = 1; id <= g_maxplayers; id ++ )
   {
      if( !is_user_alive( id ) || g_user_score[ id ][ DISABLE ] )
         continue
	 
      new szLeaderName[ 33 ] 
      if( g_iLeader < 0 ) szLeaderName = "No Leader"
      else get_user_name( g_iLeader, szLeaderName, 32 )
      new iStats[ 8 ], iBody[ 8 ]
      new iRank = get_user_stats(id,iStats, iBody);
      new Float:kd, 
      Float:k = float( g_user_score[ id ][ KILLS ] ), 
      Float:d = float( g_user_score[ id ][ DEATHS ] )
       
      if( k && d )
         kd = k / d
          
      else kd = 0.0
       
       
      set_hudmessage( 255, 255, 255, -1.0, 0.01, 0, 0.0, 1.0, 0.1, 0.1 )
      show_hudmessage
      ( 
         id, "Kills: %d | Head: %d | Knife: %d | Grenade: %d | Deaths: %d | K/D: %.2f ^nLider: %s | Your rank: %d / %d", 
         g_user_score[ id ][ KILLS ], 
         g_user_score[ id ][ HEADSHOTS ], 
         g_user_score[ id ][ KNIFEKILLS ], 
         g_user_score[ id ][ GRENADEKILLS],
         g_user_score[ id ][ DEATHS ],
         kd,
	szLeaderName,
	iRank,
	get_statsnum()
      )
   }
}
Изображение

Аватар
Radeon
Извън линия
Потребител
Потребител
Мнения: 143
Регистриран на: 04 Апр 2021, 11:30
Се отблагодари: 2 пъти
Получена благодарност: 34 пъти
Обратна връзка:

Re: Молба за поправка на плъгин

Мнение от Radeon » 02 Авг 2023, 10:13

cgozzie написа: 01 Авг 2023, 20:02 Здравейте ще може ли в плъгина да остане само nLider: и Your rank:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <tsstats>

#if AMXX_VERSION_NUM < 183

#endif
 
#define PLUGIN      "Score HUD"
#define VERSION      "1.0"
#define AUTHOR       "AndrewZ"
    
enum _:SCORE_DATA
{
   DISABLE,
   KILLS,
   HEADSHOTS,
   KNIFEKILLS,
   GRENADEKILLS,
   DEATHS
}
 
new g_user_score[ 33 ][ SCORE_DATA + 1 ]
new g_iLeader = -1
new g_maxplayers
    
new bool:g_reset_data
 
public plugin_init()
{
   register_plugin( PLUGIN, VERSION, AUTHOR )
    
   g_maxplayers = get_maxplayers()
    
   register_clcmd( "say /scoreoff", "cmd_scoreoff" )
    
   register_event( "DeathMsg", "event_death", "a" )
   register_event( "TextMsg", "event_textmsg_restart", "a", "2=#Game_will_restart_in" )
    
   register_logevent( "logevent_game_commencing", 2, "1=Game_Commencing" )
   register_logevent( "logevent_round_start", 2, "1=Round_Start" )
    
   set_task( 1.0, "rtask_show_hud", _, _, _, "b" )
}
 
public cmd_scoreoff( id )
{
   if( g_user_score[ id ][ DISABLE ] )
   {
      g_user_score[ id ][ DISABLE ] = 0
      client_print( id, print_chat, "HUD Informer statistics included." )
   }
   else
   {
      g_user_score[ id ][ DISABLE ] = 1
      client_print( id, print_chat, "HUD Informer statistics switched off." )
   }
    
   return PLUGIN_HANDLED
}   
 
public clear_data( id )
{
   if( !id )
   {
      for( new i = 1; i <= g_maxplayers; i ++ )
      {
         for( new data; data <= SCORE_DATA; data ++ )
            g_user_score[ i ][ data ] = 0
      }
      g_iLeader = -1
   }
   else
   {
      for( new data; data <= SCORE_DATA; data ++ )
         g_user_score[ id ][ data ] = 0
   }
}
 
 
public client_connect( id )       clear_data( id )
public client_disconnected( id )       clear_data( id )
public logevent_game_commencing()   clear_data( 0 )
public event_textmsg_restart()       g_reset_data = true
public logevent_round_start()
{
   if( g_reset_data )
   {
      clear_data( 0 )
      g_reset_data = false
   }
}
 
public event_death()
{
   new killer = read_data( 1 )
   new victim = read_data( 2 )
   new headshot = read_data( 3 )
   new weapon[ 12 ]; read_data( 4, weapon, 11 )
    
   if( !is_user_connected( killer ) && !is_user_connected( victim ) )
      return
       
   if( killer == victim )
   {
      g_user_score[ victim ][ DEATHS ] ++
      return
   }
       
   g_user_score[ killer ][ KILLS ] ++
    
   if( headshot )
      g_user_score[ killer ][ HEADSHOTS ] ++
       
   if( equal( weapon, "knife" ) )
      g_user_score[ killer ][ KNIFEKILLS ] ++
   else if( equal( weapon, "grenade" ) )
      g_user_score[ killer ][ GRENADEKILLS ] ++
    
   g_user_score[ victim ][ DEATHS ] ++
   new bNewLeader = true
   
    
   for ( new id = 1 ; id <= g_maxplayers ; id++ )
   {
    	 
       if ( g_user_score[ killer ][ KILLS ] < g_user_score[ id ][ KILLS ]) bNewLeader = false
       
   }
   if(bNewLeader) g_iLeader = killer
    
   
}
    
 
public rtask_show_hud()
{
   for( new id = 1; id <= g_maxplayers; id ++ )
   {
      if( !is_user_alive( id ) || g_user_score[ id ][ DISABLE ] )
         continue
	 
      new szLeaderName[ 33 ] 
      if( g_iLeader < 0 ) szLeaderName = "No Leader"
      else get_user_name( g_iLeader, szLeaderName, 32 )
      new iStats[ 8 ], iBody[ 8 ]
      new iRank = get_user_stats(id,iStats, iBody);
      new Float:kd, 
      Float:k = float( g_user_score[ id ][ KILLS ] ), 
      Float:d = float( g_user_score[ id ][ DEATHS ] )
       
      if( k && d )
         kd = k / d
          
      else kd = 0.0
       
       
      set_hudmessage( 255, 255, 255, -1.0, 0.01, 0, 0.0, 1.0, 0.1, 0.1 )
      show_hudmessage
      ( 
         id, "Kills: %d | Head: %d | Knife: %d | Grenade: %d | Deaths: %d | K/D: %.2f ^nLider: %s | Your rank: %d / %d", 
         g_user_score[ id ][ KILLS ], 
         g_user_score[ id ][ HEADSHOTS ], 
         g_user_score[ id ][ KNIFEKILLS ], 
         g_user_score[ id ][ GRENADEKILLS],
         g_user_score[ id ][ DEATHS ],
         kd,
	szLeaderName,
	iRank,
	get_statsnum()
      )
   }
}
Само се изтрива това което не ти трябва, кое беше трудното ?

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <tsstats>

#if AMXX_VERSION_NUM < 183

#endif
 
#define PLUGIN      "Score HUD"
#define VERSION      "1.0"
#define AUTHOR       "AndrewZ"
    
enum _:SCORE_DATA
{
   DISABLE,
   KILLS,
   HEADSHOTS,
   KNIFEKILLS,
   GRENADEKILLS,
   DEATHS
}
 
new g_user_score[ 33 ][ SCORE_DATA + 1 ]
new g_iLeader = -1
new g_maxplayers
    
new bool:g_reset_data
 
public plugin_init()
{
   register_plugin( PLUGIN, VERSION, AUTHOR )
    
   g_maxplayers = get_maxplayers()
    
   register_clcmd( "say /scoreoff", "cmd_scoreoff" )
    
   register_event( "DeathMsg", "event_death", "a" )
   register_event( "TextMsg", "event_textmsg_restart", "a", "2=#Game_will_restart_in" )
    
   register_logevent( "logevent_game_commencing", 2, "1=Game_Commencing" )
   register_logevent( "logevent_round_start", 2, "1=Round_Start" )
    
   set_task( 1.0, "rtask_show_hud", _, _, _, "b" )
}
 
public cmd_scoreoff( id )
{
   if( g_user_score[ id ][ DISABLE ] )
   {
      g_user_score[ id ][ DISABLE ] = 0
      client_print( id, print_chat, "HUD Informer statistics included." )
   }
   else
   {
      g_user_score[ id ][ DISABLE ] = 1
      client_print( id, print_chat, "HUD Informer statistics switched off." )
   }
    
   return PLUGIN_HANDLED
}   
 
public clear_data( id )
{
   if( !id )
   {
      for( new i = 1; i <= g_maxplayers; i ++ )
      {
         for( new data; data <= SCORE_DATA; data ++ )
            g_user_score[ i ][ data ] = 0
      }
      g_iLeader = -1
   }
   else
   {
      for( new data; data <= SCORE_DATA; data ++ )
         g_user_score[ id ][ data ] = 0
   }
}
 
 
public client_connect( id )       clear_data( id )
public client_disconnected( id )       clear_data( id )
public logevent_game_commencing()   clear_data( 0 )
public event_textmsg_restart()       g_reset_data = true
public logevent_round_start()
{
   if( g_reset_data )
   {
      clear_data( 0 )
      g_reset_data = false
   }
}
 
public event_death()
{
   new killer = read_data( 1 )
   new victim = read_data( 2 )
   new headshot = read_data( 3 )
   new weapon[ 12 ]; read_data( 4, weapon, 11 )
    
   if( !is_user_connected( killer ) && !is_user_connected( victim ) )
      return
       
   if( killer == victim )
   {
      g_user_score[ victim ][ DEATHS ] ++
      return
   }
       
   g_user_score[ killer ][ KILLS ] ++
    
   if( headshot )
      g_user_score[ killer ][ HEADSHOTS ] ++
       
   if( equal( weapon, "knife" ) )
      g_user_score[ killer ][ KNIFEKILLS ] ++
   else if( equal( weapon, "grenade" ) )
      g_user_score[ killer ][ GRENADEKILLS ] ++
    
   g_user_score[ victim ][ DEATHS ] ++
   new bNewLeader = true
   
    
   for ( new id = 1 ; id <= g_maxplayers ; id++ )
   {
    	 
       if ( g_user_score[ killer ][ KILLS ] < g_user_score[ id ][ KILLS ]) bNewLeader = false
       
   }
   if(bNewLeader) g_iLeader = killer
    
   
}
    
 
public rtask_show_hud()
{
   for( new id = 1; id <= g_maxplayers; id ++ )
   {
      if( !is_user_alive( id ) || g_user_score[ id ][ DISABLE ] )
         continue
	 
      new szLeaderName[ 33 ] 
      if( g_iLeader < 0 ) szLeaderName = "No Leader"
      else get_user_name( g_iLeader, szLeaderName, 32 )
      new iStats[ 8 ], iBody[ 8 ]
      new iRank = get_user_stats(id,iStats, iBody);
      
       
       
      set_hudmessage( 255, 255, 255, -1.0, 0.01, 0, 0.0, 1.0, 0.1, 0.1 )
      show_hudmessage
      ( 
         id, "Lider: %s | Your rank: %d / %d", 
         
	szLeaderName,
	iRank,
	get_statsnum()
      )
   }
}

Аватар
cgozzie
Извън линия
Потребител
Потребител
Мнения: 1319
Регистриран на: 13 Окт 2016, 22:10
Местоположение: Варна
Се отблагодари: 245 пъти
Получена благодарност: 43 пъти

Re: Молба за поправка на плъгин

Мнение от cgozzie » 02 Авг 2023, 12:28

Добре стана и 1 последно да се добави Frags: на лидера след Lider: да стане така "Lider: %s | Frags: | Your rank: %d / %d",
Изображение

Публикувай отговор
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Поддръжка / Помощ”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 12 госта