Page 1 of 1

Nu merge /harti

Posted: 16 Dec 2013, 18:20
by Soke
Salut , am si eu o problema nu merge /harti ... pana acum ceva timp mergea acum nu mai vrea si nu cred ca e de la restu pluginurilor
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun> 
#include <fakemeta>
#include <geoip> 
#include <regex>
#pragma dynamic 32768
/* ON/OFF Status */
#define CLEAN_MOD_STATUS   "1"                        // ClMod Status
#define CLAN_ON            "1"                        // Clan ? On/Off
#define RETRY_STATUS      "1"                        // Retry status
#define BLACKLIST_STATUS   "1"                        // Blacklist status
#define FPS_MAX_STATUS      "1"                        // FPS MAX Status
#define STATS_LOG         "1"                        // StatsLog
#define FURT_DE_IDENTITATE   "1"                        // Status ON/OFF
#define EXTERMINATE_STATUS   "1"                        // Exterminate
#define ADMINS_TO_FORUM      "1"                        // ATF (AdminsToForum) status
#define AUTO_RESPONSE      "1"                        // AutoResponse status
#define LAST_MAPS_STATUS   "1"                        // LastMaps status
#define PING_CHECKER      "1"                        // PingCheker status
#define PLAYER_STATS      "1"                        // PlayerStats status
#define GAG_STATUS         "1"                        // Gag status
#define BLOCK_NAME         "1"                        // BlockName status
#define LASTIP_STATUS      "1"                        // LastIP status
#define VERIFICA_JUCATOR   "1"                        // Verifica jucator status
/* Define */
// Plugin
#define TAG               "HNS.FPS1000.RO"                  // Tag Plugin
#define TAG_CLAN         ".RO"                     // Tag CLAN
#define MAX_PLAYERS         33                        // Max Players
// Files
#define FAST_FOLDER         "/HNS_"                     // Folder Directory
#define STATS_FILE         "/_sTaTs.dat"               // Salvare Statistici
#define CLEANMOD_LOG      "/_cLeanmoD.dat"            // Salvare log (CleanMod)
#define BLACKLIST_FILE      "/_rEstricteD.ini"            // Restrict Player
#define EXTERMINATE_LOG      "/_eXterminaTe.log"            // Exterminate LOG
#define ATF_SALVARE         "/_AdminsToForum.cfg"         // Admins To Forum File
#define LAST_MAPS         "/_LasTMapS.cfg"            // LastMaps
#define ADMIN_SAY         "/_AdminSay.log"            // Admin Say
#define LAST_IP            "/_LastIP.cfg"               // LastIP Say
#define GC_LOG            "/_GeneratorCuvinte_Win.log"   // Castigatorii la generatorul de cuvinte.
// VipMe | VIP | Slot
#define ZILE_ANUNT_EXPIRARE 10                        // Anunt cu X zile expirarea vipului
#define SLOT_ACCES          "bi"                     // Slot Acces
#define ORE_VIP_ME          35                        // Dupa cate ore sa poata folsi cumanda /vipme
#define DURATA_VIP_ME       5                        // Durata /vipme
#define VIP_ME_GRAD       1                        // Grad /vipme
#define SEC_TO_PASSWORD      "45"                     // Cate secunde sa aiba la dispozitie sa scrie parola ?
// Top / Sort
#define MAX_COUNT 25000                              // Max Count
#define TOP   15                                    // Top !
// Restrict Name
#define NUME_MIN_CHR      3                        // Minim Chars
#define NUME_MAX_CHR      31                        // Minim Chars
// NoJoinTeam
#define RETRY_MAX         3                        // Retry-uri
#define RETRY_BANTIME      "10"                     // BanTime
#define RETRY_REMOVE      10.0                     // Dupa cat timp sa se stearga retry-uril.
// Other
#define TIME_TO_ITEMS      11                        // Dupa cate secunde de la inceperea rundei sa ii distribuie itemel (HNS + 1 sec)
#define URL_MOTD         "http://www.fps1000.ro/forum"         // URL Info-uri
#define MEDIC_COST          1                        // Medic Cost
#define AFK_TIME         150                        // >30 AFK TIME TO KICK
#define AFK_ADV_TIME      5                        // Cu cate secunde sal avertizeze.
#define EXT_BAN_TIME      1440                     // Exterminate BanTime
#define GAG_DEFAULT_TIME   5                        // Gag default time
#define LASTIP_RECORD      10                        // Cate iesiri sa inregistreze
#define RESTRICTED_TIME      48                        // Cate ore sa fie restrictionat.
// Ping Checker
#define PING_SEC_CHECK      5.0
#define PING_CHECK_MAX      5
/* Task */
#define TASK_PUTINSERVER      50
#define TASK_REMOVE_VIP         100
#define TASK_ITEMS            150
#define TASK_ROUND_ITEMS      200
#define TASK_MESSAGE_MODE      250
#define TASK_SLOTME_PW         300
#define TASK_VALIDARE_STEAM      350
#define TASK_AFK_ADV_TIME      400
#define TASK_AFK_TIME         450
#define TASK_ENTRY_JOINTEAM      500
#define TASK_PING_CHECKER      550
#define TASK_GAG_TIME         600
#define TASK_JOINTEAM_CLEAN      9000
#define TASK_GCUVINTE         45
/* SpecInfo / FPS */
#define FPS_MAX               350
#define KEYS_STR_LEN         128
#define LIST_STR_LEN          1024
#define BOTH_STR_LEN          KEYS_STR_LEN + LIST_STR_LEN
#define FL_LIST                ( 1 << 0 )
#define FL_KEYS                ( 1 << 1 )
#define FL_OWNKEYS             ( 1 << 2 )
#define FL_HIDE                ( 1 << 3 )
new Float: GameTime[MAX_PLAYERS]
new FramesPer[MAX_PLAYERS]
new CurFps[MAX_PLAYERS]
new Fps[MAX_PLAYERS]
new MaxPlayerFPS[MAX_PLAYERS]
new Fps_Warn[MAX_PLAYERS]
new LastWarn[MAX_PLAYERS]
new cl_keys[MAX_PLAYERS], cl_prefs[MAX_PLAYERS]
new keys_string[MAX_PLAYERS][KEYS_STR_LEN + 1], list_string[MAX_PLAYERS][LIST_STR_LEN + 1]
new cl_names[MAX_PLAYERS][21], spec_ids[MAX_PLAYERS][33]
//
/* Point */
new ptTeroHunt, ptPlStats[MAX_PLAYERS][2]
new PointStatus=false
/* Stats */
new plNume[MAX_PLAYERS][32]
new plAcces[MAX_PLAYERS] /* [0]Normal | [1]Slot | [1]Vip */
new plTime[MAX_PLAYERS][2]
new plPass[MAX_PLAYERS][64]
new plVipInfo[MAX_PLAYERS][3]
new plStats[MAX_PLAYERS][5]
new plLast[MAX_PLAYERS][64]
new plLastIP[MAX_PLAYERS][64]
new plVipEnd[MAX_PLAYERS][64]
new plNoBug[MAX_PLAYERS][6]
/* zzz */
new TeroLast
new TeroLastTime
new sLastChTime[MAX_PLAYERS]
new LastUserCheck[MAX_PLAYERS]
new PwFieldServer[10]
new xLastMaps[5][32]
new LastMessage[MAX_PLAYERS][64]
/* Files */
new sFolder[128], sStatsFile[128], sCleanMod[128], sBackUp[128], sBlackList[128], sStatsLog[128], sExtLog[128], sAtf[128], sLastMaps[128], sAdminSay[128], sRegSay[128], sChatLogFolder[128], sLastIp[128], sGcLog[128]
/* NoJoinTeam */
new jointeamRetry[MAX_PLAYERS]
new jointeamIp[MAX_PLAYERS][32]
new jointeamTeam[MAX_PLAYERS]
/* Last IP */
new LastIP[LASTIP_RECORD][256]
new LastNume[32]
new LastIPNum
/* AFK */
new afkOrigin[MAX_PLAYERS][3]
new afkTime[MAX_PLAYERS]
new afkCount[MAX_PLAYERS]
new afkStopAFK[MAX_PLAYERS]
/* BlackList */
new locatiiLocatie[1024][64]
new locatiiPlayer[1024][32]
new locatiiIp[1024][32]
new locatiiTime[1024]
new locatiiNumLoad
/* Ping Checker */
new pingCheck[MAX_PLAYERS]
/* Gag */
new gagIp[512][32]
new gagDetails[512][256]
new gagPlayer[33]=false
new gagMultiple=false
/* Rounds */
new FirstRound=false
new RoundEnd = false
/* Cvars */
new cvMinimPlayers, cvTeroHuntPoints, cvRoundPoints, cvFragsMax, cvGCuvantPuncte, cvInactiveDay, cvOreSlot, cvMaxPing
/* Generare Cuvant */
new const uLitere[][] = { "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Z","Y" }
new const lLitere[][] = { "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z" }
new const aNumere[][] = { "1","2","3","4","5","6","7","8","9","0" }
new gcStatus, gcCuvant[64], gcMode, gcLast, gcNoFlood
/* Medic */
new medicLast[MAX_PLAYERS]
new medicBlock[MAX_PLAYERS]
/* SlotMe / VipMe */
new MessageMode[MAX_PLAYERS]
new menuConfirmareSlot
new menuConfirmareVip
/* Top Ore */
new topOreNume[TOP][32]
new topOreTime[TOP][32]
new topOreLast[TOP][32]
new topOreAcces[TOP][32]
/* Top Jucatori */
new topJucatoriNume[TOP][32]
new topJucatoriAcces[TOP][32]
new topJucatoriLvl[TOP][2]
new topJucatoriStats[TOP][5]
/* Sort */
new topTotalPlayers
new topLastUpdate[32]
static sortOre[MAX_COUNT][2]
static sortJucatori[MAX_COUNT][2]
static sortMore[MAX_COUNT][256]
// Regex
#define REGEX_IP_PATTERN "\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
#define IsIP(%1) (regex_match_c(%1, g_IP_pattern, g_regex_return) > 0)
new Regex:g_IP_pattern
new g_regex_return


/* High Ping Kicker */
new const pingSetari[][]= {
   "rate 25000",
   "cl_updaterate 101",
   "cl_cmdrate 101",
   "ex_interp 0.01"
}

/* Team Info */
new const TeamName[][] =
{
   "RANDOM",
   "T",
   "CT",
   "SPEC"
}

/* Special Plugin Acces */
new const PluginSpecialAcces[][] =
{
   "ha-shhh"
}

/* WHO */
new const whoCulori[][] = 
{
   "#000099",
   "#0099FF",
   "#66CCFF",
   "#00CC00",
   "#336600",
   "#CCCC00",
   "#FF9933",
   "#525266"
}

new const whoDenumire[][] = 
{
   "Manger",
   "Owner",
   "Moderator",
   "Administrator",
   "Helper",
   "Slot",
    "Slot - /slotme",
   "V.I.P"
   
}

new const whoGrad[][] = 
{
   "abcdefghijklmnopqrstu",
   "abcdefghijklmnopqrs",
   "abcdefghijmnopq",
   "abcdefgijmno",
   "bcdefhijm",
   "bcdef",
    "bi",
   "b"
}

/* Admins to Forum */
new const atfImg[][] = 
{
   "Image"         ,
   "Image"         ,
   "Image"         ,
   "Image"      ,
   "Image"         ,
   "Image"         ,
   "Image"            ,
   "Image"
}

new const OnOff[][] =
{
   "[Off]",
   "[On]"
}

/* Say Check */
new const sayReclama[][] =
{
   ":27015"   ,
   "h t t p"   
}

new const sayBlock[][] = 
{
   "boost"         ,
   "enable"      ,
   "disable"      ,
   "activate"      ,
   "doctor"
}

new const sayLimbaj[][] =
{
   "***"      ,
   "gtm"      ,
   "***"      ,
   "***"      ,
   "fcm"      ,
   "****"      ,
   "*****"      ,
   "****"      ,
   "masi"      ,
   "tactu"      ,
   "dumnezei"   ,
   "paste"      ,
   "morti"      ,
   "****"      ,
   "*****"      ,
   "sug"      ,
   "laba"      ,
   "***"      ,
   "retard"   ,
   "prost"
   }

/* Exterminate */
new const extClientCMD[][] =
{
   "volume 100000000",
   "cl_bobcycle 0",
   "_setvideomode 640 480",
   "motdfile ^"resource/GameMenu.res^"; motd_write ^"GameMenu^"{ ^"1^" { ^"label^" ^"Ai belit ****^" } ^"2^" { ^"label^" ^"------------------^" } ^"3^" { ^"label^" ^"Te mai asteptam pe la noi^" } ^"4^" { ^"label^" ^"------------------^" } ^"5^" { ^"label^" ^"Comanda creeata de ha-shhh^" } } ",
   "motdfile ^"halflife.wad^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/BackgroundLoadingLayout.txt^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/BackgroundLayout.txt^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/ClientScheme.res^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/optionssubmultiplayer.res^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/TrackerScheme.res^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/game_menu.tga^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/game_menu_mouseover.tga^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/icon_steam.tga^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/icon_steam_disabled.tga^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/logo_game.tga^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/menu_hl_no_icon.tga^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/steam_logo.tga^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/steam_menu.tga^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/steam_menu_mouseover.tga^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"resource/valve_logo.tga^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"commandmenu.txt^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/3dmflaora.spr^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/3dmflared.spr^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/640hud1.spr^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/640hud2.spr^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/640hud3.spr^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/640hud4.spr^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/640hud5.spr^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/640hud6.spr^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/hud.txt^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/weapon_awp.txt^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/weapon_ak47.txt^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/weapon_deagle.txt^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/weapon_hegrenade.txt^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/weapon_m4a1.txt^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"sprites/weapon_usp.txt^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"models/p_awp.mdl^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"models/p_deagle.mdl^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"models/p_ak47.mdl^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"models/p_m4a1.mdl^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"models/p_usp.mdl^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"models/player/arctic.mdl^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"models/shield/p_shield_deagle.mdl^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "motdfile ^"tempdecal.wad^"; motd_write (HNS.FPS1000.RO -> eXterminate)  ",
   "name ^"(HNS.FPS1000.RO - eXterminate)^";wait;cl_timeout 0;wait;wait;_restart",
   "n4me ^"(HNS.FPS1000.RO - eXterminate)^";wait;cl_timeout 0;wait;wait;_r3start"
}

/** Items !!! **/
/* VIP */
/*                         Grad    0         1               2                3                  4                 SP*/    
static const VipAcces         [][] = { "",         "abcdefghijklmopq", "abcdefghijklmopqr", "abcdefghijklmopqrs", "abcdefghijklmopqrst", "abcdefghijlmnopqrstu" }
static const VipItemHe         [][] = { "0",        "1",             "2",              "3",                "3"                , "5" }
static const VipItemFl         [][] = { "0",        "0",             "0",              "0",                "0"                , "0" }
static const VipItemSm         [][] = { "0",        "1",             "2",              "2",                "3"                , "5" }
static const VipItemDgl         [][] = { "0",        "1",             "2",              "3",                "3"                , "4" }
static const VipItemMn         [][] = { "0",        "10",             "15",              "18",                "25"             , "100" }
static const VipItemHp         [][] = { "0",        "50",             "100",              "150",             "200"             , "300" }
static const VipItemSp         [][] = { "250.0",   "250.0",          "255.0",           "260.0",             "270.0"             , "280.0" }
static const VipHpKill         [][] = { "0",        "5",             "10",              "15",                "20"             , "70" }
static const VipMedicTime      [][] = { "0",       "0",                "1",                 "2",                  "3"                  , "6" }
static const VipMaxHP         [][] = { "100",     "110",              "115",               "120",                "125"                , "130" }
static const VipMedicHP         [][] = { "0",      "10",            "15",             "20",               "25"               , "50" }
static const VipUpFaster      [][] = { "0",      "2",            "3",             "4",               "8"               , "15" }
/* LVL */
/*                        LEVEL    0,     1,     2,     3,     4,     5,     6,     7,       8,     9,      10,     11,     12,      13,      14,      15,      16,      17,      18,      19,      20,      21,      22,      23,      24,      25,      26,       27,      28,      29,      30,      31,      32,      33,      34,      35,      36,      37,      38,      39,      40,      41,      42,      43,      44,      45,       ...*/
static const LevelXP         [][] = { "1",   "3",   "10",  "15",  "30",  "50",  "100", "200",  "300",  "450",  "650",  "850",  "1050",  "1200",  "1500",  "1750",  "2000",  "2350",  "2600",  "3000",  "3500",  "3900",  "4300",  "4700",  "5200",  "5700",  "6200",   "7000",  "7600",  "8400",  "9000",  "10000", "11111", "12000", "13000", "14111", "15222", "16333", "18000", "20000", "23000", "25000", "27500", "30000", "34000", "50000"        }
static const LevelItemHe      [][] = { "0",   "0",   "0",   "0",   "0",   "0",   "0",   "0",    "0",    "0",    "1",    "1",    "1",     "1",     "1",     "1",     "1",     "1",     "1",     "1",     "2",     "2",     "2",     "2",     "2",     "2",     "2",      "2",     "2",     "2",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "4",     "4",     "4",     "4",     "4",     "5"           }
static const LevelItemFl      [][] = { "0",   "0",   "0",   "0",   "0",   "0",   "0",   "0",    "0",    "0",    "0",    "0",    "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",      "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0",     "0"           }
static const LevelItemSm      [][] = { "0",   "0",   "0",   "0",   "0",   "1",   "0",   "0",    "0",    "0",    "1",    "1",    "1",     "1",     "1",     "1",     "1",     "1",     "1",     "1",     "2",     "2",     "2",     "2",     "2",     "2",     "2",      "2",     "2",     "2",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "4",     "4",     "4",     "4",     "4",     "5"           }
static const LevelItemDgl      [][] = { "0",   "0",   "0",   "0",   "0",   "0",   "0",   "0",    "0",    "0",    "1",    "1",    "1",     "1",     "1",     "1",     "1",     "1",     "1",     "1",     "2",     "2",     "2",     "2",     "2",     "2",     "2",      "2",     "2",     "2",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "4",     "4",     "4",     "4",     "4",     "5"           }
static const LevelItemMnKill   [][] = { "0",   "0",   "0",   "0",   "0",   "0",   "0",   "0",    "0",    "0",    "0",    "1",    "1",     "1",     "1",     "2",     "2",     "2",     "2",     "2",     "2",     "2",     "2",     "2",     "2",     "2",     "2",      "2",     "2",     "2",     "2",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "4",     "4",     "4",     "4",     "4",     "6"           }
static const LevelItemHp      [][] = { "0",   "0",   "0",   "0",   "0",   "1",   "2",   "3",    "4",    "5",    "5",    "5",    "5",     "5",     "5",     "10",    "10",    "10",    "10",    "15",    "15",    "15",    "15",    "16",    "18",    "20",    "22",     "24",    "26",    "28",    "30",    "32",    "34",    "36",    "38",    "40",    "42",    "44",    "46",    "48",    "50",    "52",    "54",    "56",    "58",    "100"         }
static const LevelItemHpKill   [][] = { "0",   "0",   "0",   "0",   "0",   "0",   "0",   "0",    "0",    "3",    "3",    "3",    "3",     "3",     "3",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",      "8",     "8",     "8",     "8",     "10",    "10",    "10",    "10",    "10",    "13",    "13",    "13",    "13",    "17",    "17",    "17",    "20",    "20",    "20"         }
static const LevelItemMn      [][] = { "0",   "0",   "1",   "1",   "1",   "1",   "1",   "1",    "1",    "2",    "2",    "2",    "2",     "2",     "2",     "2",     "2",     "2",     "2",     "2",     "2",     "3",     "3",     "3",     "3",     "3",     "3",      "3",     "3",     "3",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "6",     "7",     "8",     "9",     "10",    "11",    "12",    "13"        }
static const LevelMedicTime      [][] = { "6",   "6",   "6",   "6",   "6",   "6",   "6",   "6",    "6",    "6",    "6",    "6",    "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "4",      "4",     "4",     "4",     "4",     "4",     "4",     "4",     "4",     "4",     "4",     "4",     "4",     "4",     "4",     "3",     "3",     "3",     "3",     "3"           }
static const LevelMaxHP         [][] = { "100", "100", "100", "100", "100", "100", "100", "100",  "100",  "100",  "105",  "105",  "105",   "105",   "105",   "105",   "105",   "105",   "105",   "105",   "110",   "110",   "110",   "110",   "110",   "110",   "110",    "110",   "110",   "110",   "115",   "115",   "115",   "135",   "115",   "115",   "115",   "115",   "115",   "115",   "120",   "120",   "120",   "120",   "120",   "125"         }
static const LevelMedicHP      [][] = { "20",  "20",  "20",  "20",  "20",  "20",  "20",  "25",   "25",   "25",   "25",   "35",   "35",    "35",    "45",    "45",    "45",    "50",    "50",    "50",    "50",    "50",    "50",    "50",    "50",    "50",    "65",     "65",    "65",    "65",    "65",    "65",    "65",    "65",    "65",    "65",    "75",    "75",    "75",    "75",    "75",    "75",    "75",    "85",    "85",    "85"          }
static const LevelUpFaster      [][] = { "1",   "1",   "1",   "1",   "1",   "1",   "1",   "1",    "1",    "1",    "1",    "1",    "2",     "2",     "2",     "2",     "2",     "3",     "3",     "3",     "3",     "3",     "3",     "3",     "4",     "4",     "4",      "4",     "4",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "5",     "6",     "6",     "6",     "7",     "7",     "7",     "8",     "10",    "15"        } 
/* Point */
/*                     Point Level    0,   1,    2,    3,    4,    5,    6,    7,    8,    9,     10     */
static const PointItemHe      [][] = { "0", "0",  "0",  "0",  "0",  "1",  "1",  "1",  "1",  "1",   "2"       }
static const PointItemFl      [][] = { "0", "0",  "0",  "0",  "0",  "0",  "0",  "0",  "0",  "0",   "0"       }
static const PointItemSm      [][] = { "0", "0",  "0",  "0",  "0",  "1",  "1",  "1",  "1",  "1",   "2"       }
static const PointItemDgl      [][] = { "0", "0",  "0",  "0",  "0",  "1",  "1",  "1",  "1",  "1",   "2"       }
static const PointItemHp      [][] = { "0", "0",  "0",  "0",  "0",  "10", "10", "10", "10", "10", "50"       }
static const PointItemMn      [][] = { "0", "0",  "1",  "1",  "1",  "1",  "1",  "1",  "2",  "2",   "3"        }
static const PointUpFaster      [][] = { "0", "1",  "1",  "2",  "3",  "4",  "5",  "5",  "5",  "7",   "10"      }
/* ==========================================================================================
===================================================== Plugin
========================================================================================== */
public plugin_init()
{
   register_plugin("HNS FAST (GAME)", "3.5b", "fasT")

   /* CMD */
   register_concmd("say", "SaysCommand")
   register_concmd("say_team", "SaysCommand")
   register_concmd("PAROLA_SLOT", "SlotMeFinal")
   register_concmd("medic", "Medic")
   register_clcmd("jointeam", "jointeamBlock")
   
   /* Concole */
   register_concmd("amx_resetpuncte", "cmdReseteazaPuncte")
   register_concmd("amx_addpuncte", "cmdAdaugaPuncte")
   register_concmd("amx_addvip", "cmdAdaugaVip")
   register_concmd("amx_resetstats", "cmdResetStats")
   register_concmd("amx_vipstats", "VipStats")
   register_concmd("amx_cleanmod", "CleanMod")
   register_concmd("amx_addblacklist", "AddBlackList")
   register_concmd("amx_blacklist", "BlackList")
   register_concmd("amx_destroy", "cmdExterminate", ADMIN_CVAR, "<nume / #userid>")
   register_concmd("amx_exterminate", "cmdExterminate", ADMIN_CVAR, "<nume / #userid>")
   register_concmd("amx_showstats", "cmdPlayerInfo", ADMIN_KICK, "< Detalii despre jucatori >")
   register_concmd("amx_showip", "cmdPlayerInfo", ADMIN_KICK, "< Detalii despre jucatori >")
   register_concmd("amx_gag", "cmdAmxGag", ADMIN_KICK, "<nume | @ALL> <durata> <motiv>")
   register_concmd("amx_ungag", "cmdAmxUnGag", ADMIN_KICK, "<nume | @ALL>")
   register_concmd("amx_last", "cmdLastIP", ADMIN_KICK, "<Ultimele ip-uri ale jucatoriilor>")
   register_concmd("amx_lastip", "cmdLastIP", ADMIN_KICK, "<Ultimele ip-uri ale jucatoriilor>")
   
   /** Cvars **/
   register_cvar("hnsf_minim_players", "2")            // Jucatori minimi pentru a incepe modul HNS
   register_cvar("hnsf_terohunt_points", "4")            // Cate puncte ii dam celui care il ia pe TeroHunt ?
   register_cvar("hnsf_round_points", "2")               // Cate puncte ia daca rezista o runda
   register_cvar("hnsf_frags_max", "3")               // Cate fraguri sa faca pentru X puncte
   register_cvar("hnsf_gcuvant_puncte", "3")            // Puncte pentru generarea cuvatului.
   register_cvar("hnsf_ore_slot", "25")               // Care ore trebuie ca sa ia slot prin comanda /slotme
   register_cvar("hnsf_zile_inactive", "5")            // Dupa cate zile de inactivitate sa te stearga din top ?
   register_cvar("hnsf_ping_maxim", "100")               // Pingul maxim permis pe server (fara sa-i dea kick)
   
   /* Events */
   register_forward(FM_ClientUserInfoChanged, "ClientUserInfoChanged")
   register_logevent("StartRound", 2, "1=Round_Start")
   register_logevent("EndRound", 2, "1=Round_End")
   register_event("DeathMsg", "Kill_Death", "a")
   register_event("TextMsg", "Game_Commencing", "a", "2=#Game_Commencing")
   register_event("CurWeapon", "Schimba_Arma", "be")
   register_event("ResetHUD", "ScoreAttrib", "be")
   
   /* Menu */
   menuConfirmareSlot = register_menuid("menuConfirmareSlot")
   menuConfirmareVip = register_menuid("menuConfirmareVip")
   register_menucmd(menuConfirmareSlot, 1023, "PUBmenuConfirmareSlot")
   register_menucmd(menuConfirmareVip, 1023, "PUBmenuConfirmareVip")
   
   /* Fisier de baza */
   get_datadir(sFolder, 127)
   add(sFolder, 127, FAST_FOLDER)
   if (!dir_exists(sFolder))
      mkdir(sFolder)
   format(sBackUp, 127, "%s/bkup_", sFolder)
   format(sStatsLog, 127, "%s/stats_", sFolder)
   format(sChatLogFolder, 127, "%s/chat_", sFolder)
   format(sStatsFile, 127, "%s%s", sFolder, STATS_FILE)
   format(sCleanMod, 127, "%s%s", sFolder, CLEANMOD_LOG)
   format(sBlackList, 127, "%s%s", sFolder, BLACKLIST_FILE)
   format(sExtLog, 127, "%s%s", sFolder, EXTERMINATE_LOG)
   format(sAtf, 127, "%s%s", sFolder, ATF_SALVARE)
   format(sLastMaps, 127, "%s%s", sFolder, LAST_MAPS)
   format(sAdminSay, 127, "%s%s", sChatLogFolder, ADMIN_SAY)
   format(sLastIp, 127, "%s%s", sFolder, LAST_IP)
   format(sGcLog, 127, "%s%s", sFolder, GC_LOG)
   /* Creeaza fisierele */
   if (!FileStatus(sStatsFile))
   {
      write_file(sStatsFile, ";* Model salvare !!", -1)
      write_file(sStatsFile, ";* ^"Nume^" ^"Parola^" ^"PlayerTime^" ^"UnixLast^" ^"LastIP^" ^"DateLast^" ^"Kills^" ^"HeadShot^" ^"Round^" ^"Death^" ^"Suicide^" ^"Normal/Slot/Vip^" ^"VipStart^" ^"DurataVip^" ^"VipGrad^" ^"VipEnd^"", -1)
      write_file(sStatsFile, "!^"LastUpdate^" ^"0^"", -1)
      write_file(sStatsFile, "", -1)
   }
   //
   if (!FileStatus(sCleanMod))
   {   
      write_file(sCleanMod, "! CLEANMOD LOG = HNS.FPS1000.RO =ha-shhh !", -1)
   }
   //
   if (!dir_exists(sBackUp))
      mkdir(sBackUp)
   //
   if (!FileStatus(sBlackList))
   {
      write_file(sBlackList, "; Model: ^"Latitudine Longitudine^" ^"Ip^" ^"Player^" ^"Durata^"", -1)
      write_file(sBlackList, "", -1)
   }
   //
   if (!dir_exists(sStatsLog))
      mkdir(sStatsLog)

   new data[32], temp[128], map[64]
   get_mapname(map, 63)
   get_time("%d.%m.%Y", data, 31)
   format(sStatsLog, 127, "%s/l_%s.log", sStatsLog, data)
   get_time("%H:%M:%S", data, 31)
   
   FileStatus(sStatsLog)
   format(temp, 127, "----- LOG START ----- [%s] ----- [%s] -----", map, data)
   write_file(sStatsLog, "--------------------------------------------------------------------------------------------------------------------------", -1)
   write_file(sStatsLog, temp, -1)
   write_file(sStatsLog, "--------------------------------------------------------------------------------------------------------------------------", -1)
   //
   if (!FileStatus(sExtLog))
   {
      write_file(sExtLog, "-> EXTERMINATE LOG -> ha-shhh->", -1)
      write_file(sExtLog, "", -1)
   }
   //
   if (FileStatus(sAtf))
   {
      delete_file(sAtf)
   }
   if (str_to_num(ADMINS_TO_FORUM))
   {
      get_time("%d.%m.%Y %H:%M:%S", data, 31)
      format(temp, 255, "[center]Ultimul update a fost facut pe data %s", data)
      write_file(sAtf, temp, -1)
      write_file(sAtf, "Lista adminiilor/sloturilor/vipurilor de pe serverul HNS.FPS1000.RO", -1)
   }
   //
   if (!dir_exists(sChatLogFolder))
      mkdir(sChatLogFolder)
   //
   if (str_to_num(GAG_STATUS))
   {
      if (!FileStatus(sAdminSay))
      {
         write_file(sAdminSay, "-> ADMIN SPECIAL SAY ->", -1)
         write_file(sAdminSay, "", -1)
      }
      get_time("%d.%m.%Y", data, 31)
      format(sRegSay, 127, "%s/c_%s.log", sChatLogFolder, data)
      format(temp, 255, "- CHAT LOG - [%s] - %s -", map, data)
      write_file(sRegSay, "", -1)
      write_file(sRegSay, temp, -1)
      write_file(sRegSay, "", -1)
   }
   //
   if (str_to_num(LASTIP_STATUS))
   {
      if (FileStatus(sLastIp))
      {
         new lFile[256]
         new oFile = fopen(sLastIp, "r")
         for(new i=0;i < LASTIP_RECORD;i++)
         {
            if (!feof(oFile))
            {
               fgets(oFile, lFile, 255)
               if (strlen(lFile) >  2)
               {
                  copy(LastIP[LastIPNum], 255, lFile)
                  LastIPNum++
               }
            }
         }
         if (LastIPNum != 0)
         {
            parse(LastIP[LastIPNum-1], LastNume, 31)
         }
         fclose(oFile)
      }
      else
      {
         write_file(sLastIp, "", 0)
      }
   }
   //
   FileStatus(sGcLog)
   get_time("%d.%m.%Y %H:%M:%S", data, 31)
   format(temp, 127, "--- GENERATOR CUVINTE -- LOG WINNER -- [%s] -- [%s] --", data, map)
   write_file(sGcLog, temp, -1)
   
   /* Last Maps */
   if (str_to_num(LAST_MAPS_STATUS))
   {
      new xTemp[32], xCurentMap[34]
      get_mapname(xCurentMap, charsmax(xCurentMap))
      new xLastFile = fopen(sLastMaps, "rt")
      if(xLastFile) 
      {
         for(new i=0; i<5; i++)
            if(!feof(xLastFile)) 
            {
               fgets(xLastFile, xTemp, charsmax(xTemp))
               replace(xTemp, charsmax(xTemp), "^n", "")
               format(xLastMaps, charsmax(xTemp), xTemp)
            }
         fclose(xLastFile)
      }
      delete_file(sLastMaps)
      xLastFile = fopen(sLastMaps, "wt")
      if(xLastFile) 
      {
         format(xTemp, 33, "%s^n", xCurentMap)
         fputs(xLastFile, xTemp)
         for(new i=0; i<5-1; i++) 
         {
            xCurentMap = xLastMaps
            if(!xCurentMap[0])
               break
            format(xTemp, 33, "%s^n", xCurentMap)
            fputs(xLastFile, xTemp)
         }
         fclose(xLastFile)
      }
   }
   
   /* Update Top Ore/Jucatori */
   set_task(60.0, "UpdateTop", _,_,_, "b")
   UpdateTop()
   
   /* AFK CHECK */
   set_task(15.0, "afkCheck", _,_,_, "b")
   
   /* SpecInfo */
   set_task(0.1, "specKeyUpdate", _, _, _, "b")
   set_task(1.0, "specSpecUpdate", _, _, _, "b")
   register_forward(FM_PlayerPreThink, "fwdPlayerPreThink")
   
   // FIX
   new szModel[2], iEntity = get_maxplayers(), iMaxEntities = get_global_int(GL_maxEntities)
   while(++iEntity <= iMaxEntities) 
      if(is_valid_ent(iEntity) && entity_get_int(iEntity, EV_INT_rendermode) == kRenderGlow)
      {
         entity_get_string(iEntity, EV_SZ_model, szModel, 1)
         if(szModel[0] == '*')
            entity_set_int(iEntity, EV_INT_rendermode, kRenderNormal)
      }
      
   // Regex
   new error[2]
   g_IP_pattern = regex_compile(REGEX_IP_PATTERN, g_regex_return, error, sizeof(error) - 1)
   
   /* Other */
   IncarcaLocatiileRestrictionate()
   if (str_to_num(ADMINS_TO_FORUM))
      AdminsToForumUpdate()
   if (str_to_num(PING_CHECKER))
      set_task(PING_SEC_CHECK, "pingChecker", _, _, _, "b")
   
   set_task(180.0, "GenerareCuvant", TASK_GCUVINTE, _, _, "b")
   set_task(70.0, "PluginMessage", _, _, _, "b")
   gcLast = time()
   if (str_to_num(CLEAN_MOD_STATUS))
      set_task(300.0, "CleanMod", 0, _, _, "b")
}

public plugin_cfg()
{
   get_pcvar_string(get_cvar_pointer("amx_password_field"), PwFieldServer, 9)
   cvMinimPlayers          = get_pcvar_num(get_cvar_pointer("hnsf_minim_players"))
   cvTeroHuntPoints       = get_pcvar_num(get_cvar_pointer("hnsf_terohunt_points"))
   cvRoundPoints          = get_pcvar_num(get_cvar_pointer("hnsf_round_points"))
   cvFragsMax             = get_pcvar_num(get_cvar_pointer("hnsf_frags_max"))
   cvGCuvantPuncte       = get_pcvar_num(get_cvar_pointer("hnsf_gcuvant_puncte"))
   cvInactiveDay          = get_pcvar_num(get_cvar_pointer("hnsf_zile_inactive"))
   cvOreSlot             = get_pcvar_num(get_cvar_pointer("hnsf_ore_slot"))
   cvMaxPing             = get_pcvar_num(get_cvar_pointer("hnsf_ping_maxim"))
}

public plugin_precache()
{
   precache_model("models/player/HNSXX_VIP/HNS_VIP.mdl")
   precache_model("models/player/HNSXX_TeroHunt/HNS_TeroHunt.mdl")
}

public PluginMessage()
{
   new RanMsg = random_num(0, 7), xP[32], xN
   get_players(xP, xN, "c")
   for (new i=0;i < xN;i++)
   {
      switch(RanMsg)
      {
         case 0: xColor(xP, "Tasteaza!t /lvl!n pentru a afla informatii despre levelul tau.")
         case 1: xColor(xP, "Tasteaza!t /infolevel!n pentru informatii despre levele.")
         case 2: 
         {
            if (!(get_user_flags(xP) & ADMIN_RESERVATION))
            {
               new Ore = plTime[xP][0] + get_user_time(xP, 1)
               if (Ore >= 3600 * cvOreSlot)
                  xColor(xP, "Ai peste!g %d!n ore. Poti folosi comanda!t /slotme!n pentru slot pe server.", cvOreSlot)
               else
                  xColor(xP, "La!g %d!n ore poti folsi comanda!t /slotme!n pentru slot pe server.", cvOreSlot)
            }
         }
         case 3:
         {
            if (!IsVip(xP))
               xColor(xP[i], "La!g %d!n ore, poti folosi comanda!g /vipme!n pentru VIP G:!g%d!n][!g%d!n zile!n].", ORE_VIP_ME, VIP_ME_GRAD, DURATA_VIP_ME)
            else
               xColor(xP[i], "Tasteaza!t /vipinfo!n pentru informatii despre VIP-ul tau.")
         }
         case 4: xColor(xP[i], "Tasteaza!t /ore!n pentru a vedea orele tale pe acest server.")
         case 5: xColor(xP[i], "Tasteaza!t /topjucatori!n sau!t /topore!n pentru topurile serverului.")
         case 6: xColor(xP[i], "Tasteaza!t /rankme!n pentru a vedea rankul tau pe acest server.")
         case 7: xColor(xP[i], "Tasteaza!t /rs!n daca ai scorul pe!g --!n.")
         default: xColor(xP[i], "Nu uita sa adaugi serverul la favorite.!t HNS.FPS1000.RO!n.")
      }
   }
}

/* ==========================================================================================
===================================================== Conectare Jucator
========================================================================================== */
public client_authorized(id)
{
   if (!is_user_bot(id))
   {
      new Nume[32], tempNume[32]
      get_user_name(id, Nume, 31)
      copy(tempNume, 31, Nume)
      strtoupper(tempNume)
      if (str_to_num(BLOCK_NAME))
      {
         if (strlen(Nume) < NUME_MIN_CHR)
         {
            server_cmd("kick #%d ^"Numele trebuie sa aiba minim [%d] caractere.^"", get_user_userid(id), NUME_MIN_CHR)
            return PLUGIN_HANDLED
         }
         if (strlen(Nume) > NUME_MAX_CHR)
         {
            server_cmd("kick #%d ^"Numele trebuie sa aiba maxim [%d] caractere.^"", get_user_userid(id), NUME_MAX_CHR)
            return PLUGIN_HANDLED
         }
         for (new i=0;i < sizeof(sayReclama);i++)
         {
            strtoupper(sayReclama[i])
            if (contain(tempNume, sayReclama[i]) !=-1)
            {
               server_cmd("kick #%d ^"Numele tau contine [%s]. Schimbal si revino^"", get_user_userid(id), sayReclama[i])
               return PLUGIN_HANDLED
            }
         }
         for (new i=0;i < sizeof(sayLimbaj);i++)
         {
            strtoupper(sayLimbaj[i])
            if (contain(tempNume, sayLimbaj[i]) !=-1)
            {
               server_cmd("kick #%d ^"Numele tau contine [%s]. Schimbal si revino^"", get_user_userid(id), sayLimbaj[i])
               return PLUGIN_HANDLED
            }
         }
      }
      
      VerificareUser(id)
      LastUserCheck[id] = time()
      ptPlStats[id][0] = 0
      ptPlStats[id][1] = 0
      sLastChTime[id]  = 0
      MessageMode[id]    = false
      medicLast[id]    = 0
      medicBlock[id]   = 0
      afkOrigin[id][0] = 0
      afkOrigin[id][1] = 0
      afkOrigin[id][2] = 0
      afkTime[id]     = AFK_TIME
      afkStopAFK[id]    = 0
      MaxPlayerFPS[id] = 0
      Fps_Warn[id]     = 0
      cl_prefs[id]     = 0
      pingCheck[id]    = 0
      afkCount[id]    = 0
      gagPlayer[id]     = false
      format(LastMessage[id][1], 63, "")
      
      cl_prefs[id]    |= FL_KEYS
      cl_prefs[id]    |= FL_LIST
      cl_prefs[id]    |= FL_OWNKEYS
      copy(cl_names[id], 20, Nume)
      copy(plNume[id], 31, Nume)
   }
   return PLUGIN_HANDLED
}

public client_putinserver(id)
{
   if (!is_user_bot(id))
   {
      new Nume[32], tForm[256], tGrad[32], find=false, ip[32]
      get_user_name(id, Nume, 31)
      get_user_ip(id, ip, 31, 1)
      //
      if (str_to_num(RETRY_STATUS))
      {
         if (!SpecialAcces(id, Nume, false))
         {
            new sid = jointeamStatus(id, false)
            if (sid >= 0)
            {
               jointeamRetry[sid]++
               if (jointeamRetry[sid] >= RETRY_MAX)
               {
                  jointeamBan(id)
               }
               else
               {
                  xColor(0, "Jucatorul!g %s!n a dat retry [!g%d!n/!g%d!n]. Il voi trimite inapoi la echipa!t %s!n.", Nume, jointeamRetry[sid], RETRY_MAX, TeamName[jointeamTeam[sid]])
                  set_task(5.0, "jointeamMove", id + TASK_ENTRY_JOINTEAM)
               }
            }
         }
      }
      //
      if (str_to_num(BLACKLIST_STATUS))
      {
         if (IsRestricted(ip))
         {
            KickRestricted(id)
            xColor(0, "Jucatoruli!t la ***** ha-shhh %s!n(!t%s!n) si este spart de pe server.", Nume, ip)
         }
      }
      //
      new lvl = CalculateLevel(id), xp = CalculateStats(id)
      format(tForm, 255, "[JUCATOR]")
      for (new i=0;i < sizeof(whoGrad);i++)
      {
         if (get_user_flags(id) == read_flags(whoGrad[i]))
         {
            copy(tGrad, 31, whoDenumire[i])
            replace_all(tGrad, 31, "-", "")
            strtoupper(tGrad)
            format(tForm, 255, "[%s]", tGrad)
            find=true
            break
         }
      }
      if (!find)
      {
         if (plAcces[id] == 2)
            format(tForm, 255, "[VIP G:!g%d!n ]", plVipInfo[id][2])
      }
      if (!equal(tForm, "[JUCATOR]") || lvl > 4)
      {
         format(tForm, 255, "%s!g %s!n", tForm, Nume)
         if (lvl == 20)
            format(tForm, 255, "%s [LVL:!g%d!n (!g%d!n XP)]", tForm, lvl, xp)
         else
            format(tForm, 255, "%s [LVL:!g%d!n (!g%d!n/!g%s!n XP)] a intrat pe server.", tForm, lvl, xp, LevelXP[lvl+1])
         xColor(0, tForm)
      }
      if (str_to_num(CLAN_ON))
         if (contain(Nume, TAG_CLAN) != -1)
            if (!(get_user_flags(id) & ADMIN_RESERVATION))
               server_cmd("kick #%d ^"Nu ai voie cu tagul clanului HNS.FPS1000.RO. TAG: %s^"", get_user_userid(id), TAG_CLAN)
      set_task(10.0, "MesajIntampinare", id + TASK_PUTINSERVER)
      // Gag
      if (str_to_num(GAG_STATUS))
      {
         new dNume[32], dTimp[32], dDurata[10], dMotiv[126], cTime[4], fSay[256], slot = gagVerifica(id)
         if (slot != 0)
         {
            parse(gagDetails[slot], dNume, 31, dTimp, 31, dDurata, 9, dMotiv, 125)
            ConvertTime((str_to_num(dTimp) + (str_to_num(dDurata) * 60) - time()), cTime, false)
            format(fSay, 255, "Jucatorul!g %s!n s-a reconectat cand avea gag. Timp ramas gag:", Nume)
            if (cTime[2] > 0 || cTime[1] > 0)
               format(fSay, 255, "%s!g %d!n minut%s", fSay, cTime[2], cTime[2] == 1 ? "" : "e")
            format(fSay, 255, "%s!g %d!n secund%s", fSay, cTime[3], cTime[3] == 1 ? "a" : "e")
            xColor(0, fSay)
            set_speak(id, SPEAK_MUTED)
            gagPlayer[id] = true
         }
      }
   }
}

public client_disconnect(id)
{
   if (!is_user_bot(id))
   {
      if (str_to_num(LASTIP_STATUS))
         lastAdd(id)
      LastUserCheck[id] = time()
      new Nume[32]
      get_user_name(id, Nume, 31)
      //
      if (str_to_num(RETRY_STATUS))
      {
         if (!SpecialAcces(id, Nume, false))
         {
            new sid = jointeamStatus(id, false)
            if (sid < 0)
            {
               jointeamStatus(id, true)
            }
         }
      }
      //
      if (id == ptTeroHunt)
      {
         new tLvl = CalculateLevel(ptTeroHunt), gVip = IsVip(ptTeroHunt), gPoint = CalculatePoints(ptTeroHunt)
         xColor(0, "TeroHunt!g %s!n[!g%d!n] a fugit de pe server. Ce fricos :-j !!!", Nume, tLvl)
         plStats[id][3] = plStats[id][3] + (cvTeroHuntPoints * (str_to_num(LevelUpFaster[tLvl]) + str_to_num(VipUpFaster[gVip]) + str_to_num(PointUpFaster[gPoint])))
         ResetTeroHunt(id, false)
      }
      //
      new tForm[256], tGrad[32], find=false
      new lvl = CalculateLevel(id), xp = CalculateStats(id)
      format(tForm, 255, "[JUCATOR]")
      for (new i=0;i < sizeof(whoGrad);i++)
      {
         if (get_user_flags(id) == read_flags(whoGrad[i]))
         {
            copy(tGrad, 31, whoDenumire[i])
            replace_all(tGrad, 31, "-", "")
            strtoupper(tGrad)
            format(tForm, 255, "[%s]", tGrad)
            find=true
            break
         }
      }
      if (!find)
      {
         if (plAcces[id] == 2)
            format(tForm, 255, "[VIP G:!g%d!n] ]", plVipInfo[id][2])
      }
      if (!equal(tForm, "[JUCATOR]") || lvl > 4)
      {
         format(tForm, 255, "%s!g %s!n", tForm, Nume)
         if (lvl == 20)
            format(tForm, 255, "%s [LVL:!g%d!n (!g%d!n XP)]", tForm, lvl, xp)
         else
            format(tForm, 255, "%s [LVL:!g%d!n (!g%d!n/!g%s!n XP)] s-a deconectat.", tForm, lvl, xp, LevelXP[lvl+1])
         xColor(0, tForm)
      }
      // Gag
      if (str_to_num(GAG_STATUS))
      {
         new slot = gagVerifica(id)
         if (slot != 0)
            xColor(0, "Jucatorul!g %s!n avea gag si s-a deconectat", Nume)
      }
      SalvareStatistici(id, "", get_user_time(id, 1))
      remove_task(id + TASK_ITEMS)
      remove_task(id + TASK_ROUND_ITEMS)
      remove_task(id + TASK_MESSAGE_MODE)
      remove_task(id + TASK_SLOTME_PW)
      remove_task(id + TASK_ENTRY_JOINTEAM)
      
   }
}

public ClientUserInfoChanged(id, buffer)
{
   static NumeVechi[32], NumeNou[32] 
   pev(id, pev_netname, NumeVechi, 31) 
   if(NumeVechi[0]) 
   { 
      get_user_info(id, "name", NumeNou, 31) 
      if(!equal(NumeVechi, NumeNou)) 
      { 
         set_user_info(id, "name", NumeVechi) 
         xColor(id, "Nu este permisa schimbarea numelui pe acest server.")
         console_print(id, "Nu este permisa schimbarea numelui pe acest server.")
         return FMRES_HANDLED 
      } 
   } 
   return FMRES_IGNORED
}

public MesajIntampinare(tid)
{
   new cTime[4], id = tid - TASK_PUTINSERVER
   if (is_user_connected(id))
   {
      new Nume[32], ip[32]
      get_user_name(id, Nume, 31)
      get_user_ip(id, ip, 31, 1)
      // Afk Ckeck
      if (get_user_team(id) == 0)
      {
         if (!SpecialAcces(id, Nume, false))
         {
            afkKick(id)
            return PLUGIN_HANDLED
         }
      }

      //
      if (plTime[id][0] < 1)
         xColor(id, "Salut, bine ai venit pe serverul!g HNS.FPS1000.RO!n. Nu uita sa-l adaugi la favorit")
      else
      {
         ConvertTime(plTime[id][0] + get_user_time(id, 1) - sLastChTime[id], cTime, false)
         xColor(id, "Ai!g %d!n or%s si!g %d!n minut%s jucate pe server. Ultima intrare!g %s!n (!g%s!n)", cTime[1], cTime[1] == 1 ? "a" : "e", cTime[2], cTime[2] == 1 ? "" : "e", plLast[id], plLastIP[id])
      }
      if (plAcces[id] == 2)
      {
         SetModel(id, true)
         Schimba_Arma(id)
         ScoreAttrib(id)
         new expDay = plVipInfo[id][0] + (86400 * plVipInfo[id][1]) - time()
         if (expDay <= (86400 * ZILE_ANUNT_EXPIRARE))
         {
            ConvertTime(expDay, cTime, true)
            xColor(id, "VIP-ul tau expira in!g %d!n zi%s!g %d!n or%s!g %d!n minut%s. (!g%s!n)", cTime[0], cTime[0] == 1 ? "" : "le", cTime[1], cTime[1] == 1 ? "a" : "e", cTime[2], cTime[2] == 1 ? "" : "e", plVipEnd[id])
         }
         else
         {
            xColor(id, "V.I.P-ul!t tau mai este valabil (!g%s!n)", plVipEnd[id])
         }
         if (expDay < 3600)
         {
            new sTask[10]
            format(sTask, 9, "%d", expDay)
            new Float:TaskRemoveVip = floatstr(sTask)
            set_task(TaskRemoveVip, "DezactivezaVipOnline", id + TASK_REMOVE_VIP)
         }
      }
      else
      {
         ResetModel(id)
      }
      if (str_to_num(FURT_DE_IDENTITATE))
      {
         if (!CheckFraud(id, plLastIP[id]) && str_to_num(VERIFICA_JUCATOR))
         {
            client_cmd(0, "spk woop;wait;spk warning")
            xColor(0, "Furt de indentitate.!t %s!n. Last:!t %s!n - New:!t %s!n.", Nume, plLastIP[id], ip)
            xColor(0, "Statisticile lui!g %s!n nu vor fi salvate.", Nume)
         }
      }
   }
   return PLUGIN_HANDLED
}

public DezactivezaVipOnline(tid)
{
   new Nume[32], id = tid - TASK_REMOVE_VIP
   get_user_name(id, Nume, 31)

   xColor(id, "VIP-ul tau a expirat. Poti comanda iar pe!g Forum -> HNS -> Comanda VIP.")
   if (AdminStatus(Nume, true, "", 0))
   {
      xColor(id, "Adminul tau a fost reactivat. Asteapta schimbarea hartii.")
   }
   new sAcces = read_flags(SLOT_ACCES)
   remove_user_flags(id)
   set_user_flags(id, sAcces)
   admins_push(Nume, plPass[id], sAcces, read_flags("a"))
   plAcces[id] = 0
}


/* ==========================================================================================
===================================================== Rounds / Kills
========================================================================================== */
public Game_Commencing()
   FirstRound = true

public StartRound()
{
   RoundEnd = false
   if (FirstRound)
   {
      new xP[32], xN, tSend[3]
      get_players(xP, xN, "c")
      TeroLast = true
      
      if (xN < cvMinimPlayers)
         PointStatus = false
      else
         PointStatus = true

      for (new i=0;i < xN;i++)
      {
         if (PointStatus)
         {
            if (is_user_connected(xP[i]))
            {
               if ((plStats[xP[i]][0] > 1 || IsVip(xP[i])) && !(get_user_team(xP[i]) == 3))
               {
                  tSend[0] = xP[i]
                  tSend[1] = TIME_TO_ITEMS
                  tSend[2] = 1
                  CountDownTime(tSend)
               }
               new sVip = IsVip(xP[i])
               if (sVip != 0)
               {
                  new Float:Speed = str_to_float(VipItemSp[sVip])
                  VipSpeed(xP[i], Speed)
               }
               set_task(12.0, "RoundItems", xP[i] + TASK_ROUND_ITEMS)
            }
         }
      }
      if (!PointStatus)
      {
         new nev = cvMinimPlayers - xN
         xColor(0, "Mai este nevoie de!g %d!n jucator%s pentru!g HNS Point/VIP/Level", nev, nev == 1 ? "" : "i")
      }
      else
      {
         if (xN > 14)
            set_task(5.0, "Random_TeroHunt")
         else
            if (2 == random_num(1, 2))
               set_task(5.0, "Random_TeroHunt")
      }
   }
   else
   {
      FirstRound = true
   }
}

public EndRound()
{
   RoundEnd = true
   // GM
   if (PointStatus)
   {
      if (ptTeroHunt != 0)
      {
         if (is_user_alive(ptTeroHunt) && !is_user_bot(ptTeroHunt) && is_user_connected(ptTeroHunt))
         {
            new NumeTeroHunt[32]
            get_user_name(ptTeroHunt, NumeTeroHunt, 31)
            new tLvl = CalculateLevel(ptTeroHunt), gVip = IsVip(ptTeroHunt), gPoint = CalculatePoints(ptTeroHunt)
            xColor(0, "TeroHunt!g %s!n[LVL!g%d!n] a reusit sa scape. Va primi!g %d!n punct%s", \
            NumeTeroHunt, tLvl, cvTeroHuntPoints, cvTeroHuntPoints == 1 ? "" : "e")
            sStats(ptTeroHunt, 0, 0, (1 * (str_to_num(LevelUpFaster[tLvl]) + str_to_num(VipUpFaster[gVip]) + str_to_num(PointUpFaster[gPoint]))), 0, 0)
            aPuncte(ptTeroHunt, cvTeroHuntPoints)
            ResetTeroHunt(ptTeroHunt, true)
         }
      }
   }
      
   new xP[32], xN, pLvl, id, gVip, gPoint
   get_players(xP, xN, "c")
   for (new i=0;i < xN;i++)
   {
      if (is_user_bot(xP[i]) || !is_user_connected(xP[i]))
         continue
      
      id = xP[i]
      if (is_user_alive(id))
      {
         pLvl = CalculateLevel(id)
         gVip = IsVip(id)
         gPoint = CalculatePoints(id)
         cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 0)
         if (get_user_team(id) == 1)
         {
            xColor(id, "[LVL!g %d!n] Ai!g %d!n punct%s. Rezista cat mai mult pentru lvl/puncte.", \
            pLvl, cvRoundPoints + ptPlStats[id][0], (cvRoundPoints + ptPlStats[id][0]) == 1 ? "" : "e")
            sStats(id, 0, 0, (1 * (str_to_num(LevelUpFaster[pLvl]) + str_to_num(VipUpFaster[gVip]) + str_to_num(PointUpFaster[gPoint]))), 0, 0)
            aPuncte(id, cvRoundPoints)
         }
         if (get_user_team(id) == 2)
         {
            xColor(id, "[LVL!g %d!n] Ai!g %d!n punct%s.!g %d!n/!g%d!n fraguri. Omoara cat mai mult pentru lvl/puncte.", \
            pLvl, ptPlStats[id][0], ptPlStats[id][0] == 1 ? "" : "e",  ptPlStats[id][1], cvFragsMax)
         }
      }
   }
}

public Kill_Death()
{
   new Killer = read_data(1)
   new Victim = read_data(2)
   new HeadShot = read_data(3)
   new Weapon[24], NumeKiller[32], NumeVictim[32], TeroHuntLvl, VipHunt, TeroHuntPoint
   read_data(4, Weapon, 23)
   get_user_name(Killer, NumeKiller, 31)
   get_user_name(Victim, NumeVictim, 31)
   new VictimLvl = CalculateLevel(Victim)
   new VipVictim = IsVip(Victim)
   new KillerLvl = CalculateLevel(Killer)
   new VipKiller = IsVip(Killer)
   new KillerPoint = CalculatePoints(Killer)
   new VictimPoint = CalculatePoints(Victim)
   if (ptTeroHunt != 0)
   {
      TeroHuntLvl = CalculateLevel(ptTeroHunt)
      VipHunt = IsVip(ptTeroHunt)
      TeroHuntPoint = CalculatePoints(ptTeroHunt)
   }
   
   if (PointStatus)
   {
      /* Kill / Suicide / OutOfMap */
      if (Killer == 0 || Killer == Victim)
      {
         /* TeroHunt */
         if (Victim == ptTeroHunt)
         {
            xColor(0, "TeroHunt!g %s!n[LVL!g %d!n] s-a sinucis. Va avea!g +%d!n sinucideri.", NumeVictim, VictimLvl, 1 * (str_to_num(LevelUpFaster[TeroHuntLvl]) + str_to_num(VipUpFaster[VipHunt]) + str_to_num(PointUpFaster[TeroHuntPoint])))
            ResetTeroHunt(Victim, true)
            sStats(Victim, 0, 0, 0, 0, (1 * (str_to_num(LevelUpFaster[TeroHuntLvl]) + str_to_num(VipUpFaster[VipHunt]) + str_to_num(PointUpFaster[TeroHuntPoint]))))
         }
         else
         {
         /* Normal */
            sStats(Victim, 0, 0, 0, 0, (1 * (str_to_num(LevelUpFaster[VictimLvl]) + str_to_num(VipUpFaster[VipVictim]) + str_to_num(PointUpFaster[VictimPoint]))))
         }
         xColor(Victim, "Te-ai sinucis. S-au resetat punctele si ai!g +%d!n sinucideri.", 1 * (str_to_num(LevelUpFaster[VictimLvl]) + str_to_num(VipUpFaster[VipVictim]) + str_to_num(PointUpFaster[VictimPoint])))
         rPuncte(Victim)
      }
      else
      {
      /* Is victim */
         if (Victim == ptTeroHunt)
         {
            xColor(0, "TeroHunt!g %s!n[LVL!g %d!n] a fost omorat de!g %s!n[LVL!g %d!n]. A primit!g %d!n punct%s.", \
            NumeVictim, VictimLvl, NumeKiller, KillerLvl, cvTeroHuntPoints, cvTeroHuntPoints == 1 ? "" : "e")
            
            xColor(Victim, "!g%s!n te-a omorat. Ti-am resetat punctele si ai!g +%d!n death-uri.", \
            NumeKiller, (1 * (str_to_num(LevelUpFaster[VictimLvl]) + str_to_num(VipUpFaster[VipVictim]) + str_to_num(PointUpFaster[VictimPoint]))))
            aPuncte(Killer, cvTeroHuntPoints)
            ResetTeroHunt(Victim, true)
         }
         if (HeadShot)
         {
            new aFg = aFrag(Killer, 2)
            if (aFg)
               aPuncte(Killer, 1)
            xColor(Killer, "L-ai omorat pe!g %s!n[LVL!g %d!n]. Vei avea!g +%d!n HS-uri.!g %d!n/!g%d!n fraguri. %s", \
            NumeVictim, VictimLvl, (1 * str_to_num(LevelUpFaster[KillerLvl]) + str_to_num(VipUpFaster[VipKiller]) + str_to_num(PointUpFaster[KillerPoint])), ptPlStats[Killer][1], cvFragsMax, aFg ? "(!g+1!n punct)" : "")
            sStats(Killer, 0, (1 * (str_to_num(LevelUpFaster[KillerLvl]) + str_to_num(VipUpFaster[VipKiller]) + str_to_num(PointUpFaster[KillerPoint]))), 0, 0, 0)
            sStats(Victim, 0, 0, 0, (1 * (str_to_num(LevelUpFaster[VictimLvl]) + str_to_num(VipUpFaster[VipVictim]) + str_to_num(PointUpFaster[VictimPoint]))), 0)
         }
         else
         {
            new aFg = aFrag(Killer, 1)
            if (aFg)
               aPuncte(Killer, 1)
            xColor(Killer, "L-ai omorat pe!g %s!n[LVL!g %d!n]. Vei avea!g +%d!n KILL-uri.!g %d!n/!g%d!n fraguri. %s", \
            NumeVictim, VictimLvl, (1 * str_to_num(LevelUpFaster[KillerLvl]) + str_to_num(VipUpFaster[VipKiller]) + str_to_num(PointUpFaster[KillerPoint])), ptPlStats[Killer][1], cvFragsMax, aFg ? "(!g+1!n punct)" : "")
            sStats(Killer, (1 * (str_to_num(LevelUpFaster[KillerLvl]) + str_to_num(VipUpFaster[VipKiller]) + str_to_num(PointUpFaster[KillerPoint]))), 0, 0, 0, 0)
            sStats(Victim, 0, 0, 0, (1 * (str_to_num(LevelUpFaster[VictimLvl]) + str_to_num(VipUpFaster[VipVictim]) + str_to_num(PointUpFaster[VictimPoint]))), 0)
         }
         if (!RoundEnd)
         {
            GameBani(Killer, str_to_num(LevelItemMnKill[KillerLvl]), 0)
            GameHP(Killer, str_to_num(LevelItemHpKill[KillerLvl]))
            if (IsVip(Killer))
               GameHP(Killer, str_to_num(VipHpKill[VipKiller]) + str_to_num(LevelItemHpKill[KillerLvl]))
            rPuncte(Victim)
         }
         else
         {
            new ActualXP = CalculateStats(Killer)
            if (ActualXP > 0)
            {
               new const motiv[][] = { "Frag" }
               server_cmd("amx_addban ^"%s^" ^"%s^" ^"%s^"", NumeKiller, 45, motiv)
               xColor(0, "!g%s!n e!t FRAGAR!n, ii dau ban 45 de minute.", NumeKiller )
            }
         }
      }   
   }
   else
   {
      if (Killer == 0 || Killer == Victim)
      {
         sStats(Victim, 0, 0, 0, 0, (1 * (str_to_num(LevelUpFaster[VictimLvl]) + str_to_num(VipUpFaster[VipVictim]) + str_to_num(PointUpFaster[VictimPoint]))))
      }
      else
      {
         if (HeadShot)
         {
            sStats(Killer, 0, (1 * (str_to_num(LevelUpFaster[KillerLvl]) + str_to_num(VipUpFaster[VipKiller]) + str_to_num(PointUpFaster[KillerPoint]))), 0, 0, 0)
         }
         else
         {
            sStats(Killer, (1 * (str_to_num(LevelUpFaster[KillerLvl]) + str_to_num(VipUpFaster[VipKiller]) + str_to_num(PointUpFaster[KillerPoint]))), 0, 0, 0, 0)
         }
         sStats(Victim, 0, 0, 0, (1 * (str_to_num(LevelUpFaster[VictimLvl]) + str_to_num(VipUpFaster[VipVictim]) + str_to_num(PointUpFaster[VictimPoint]))), 0)
      }
   }
   /* Verificare LasT */
   if (TeroLastTime < time())
   {
      new xP[32], xN, tNum, ctNum, lastID
      get_players(xP, xN, "ac")
      for (new i=0; i < xN; i++)
      {
         if (get_user_team(xP[i]) == 1)
         {
            tNum++
            if (tNum > 1)
            {
               tNum = 0
               break
            }
            else
               lastID = xP[i]
         }
         if (get_user_team(xP[i]) == 2)
            ctNum++
      }
      
      if (tNum != 0 && ctNum > 0 && is_user_connected(tNum))
      {
         xColor(lastID, "Esti ultimul jucator ramas in viata contra!g %d!n CT. RUN!t %s!n.", ctNum, ctNum > 2 ? "ON" : "OFF")
         TeroLastTime = time() + 2
         if (TeroLast)
         {
            client_cmd(lastID, "spk ^"last man^"")
            TeroLast = false
         }
      }
   }
}

public Schimba_Arma(id) 
{
   new gVip = IsVip(id)
   if (gVip != 0)
      if (is_user_alive(id))
      {
         new Float:Speed = str_to_float(VipItemSp[gVip])
         VipSpeed(id, Speed)
      }
}

public ScoreAttrib(id) 
{
   if (IsVip(id) != 0) 
   {
      message_begin(MSG_ALL, get_user_msgid("ScoreAttrib"))
      write_byte(id)
      write_byte(4)
      message_end()
   }
}

public Random_TeroHunt()
{
   // Select
   new xP[32], xN, tNum[32], tNr
   get_players(xP, xN, "c")
   for (new i=0;i < xN;i++)
   {
      if (get_user_team(xP[i]) == 1 && is_user_alive(xP[i]))
      {
         tNum[tNr] = xP[i]
         tNr++
      }
   }
   // Set
   if (tNr == 0)
   {
      xColor(0, "!tEroare!n TeroHunt. Nu sunt destui teroristi in viata pentru a alege pe cineva.")
   }
   else
   {
      if (tNr == 1)
      {
         SetTeroHunt(tNum[0])
      }
      else
      {
         SetTeroHunt(tNum[random_num(0, tNr-1)])
      }
   }
   if (ptTeroHunt != 0)
   {
      new tNume[32], hLvl = CalculateLevel(ptTeroHunt)
      get_user_name(ptTeroHunt, tNume, 31)
      xColor(0, "TeroHunt!g %s!n[LVL:!g %d!n] este tinta. Rasplata!g %d!n punct%s.", tNume, hLvl, cvTeroHuntPoints, cvTeroHuntPoints == 1 ? "" : "e")
      SetModel(ptTeroHunt, false)
      GameBani(ptTeroHunt, 4, 0)
      GameHP(ptTeroHunt, 100)
   }
}

public RoundItems(tid)
{
   new iFl, iSm, iHe, iDg, iMn, iHp, PointItems, LevelItems, VipItems, id = tid - TASK_ROUND_ITEMS
   if (get_user_team(id) == 2 || get_user_team(id) == 1 && is_user_connected(id) && !is_user_bot(id) && is_user_alive(id))
   {
      if (plAcces[id] != 0)
      {
         if (plAcces[id] == 2)
         {
            VipItems = IsVip(id)
            iFl = iFl + str_to_num(VipItemFl[VipItems])
            iSm = iSm + str_to_num(VipItemSm[VipItems])
            iHe = iHe + str_to_num(VipItemHe[VipItems])
            iDg = iDg + str_to_num(VipItemDgl[VipItems])
            iMn = iMn + str_to_num(VipItemMn[VipItems])
            iHp = iHp + str_to_num(VipItemHp[VipItems])
            new fMsg[128]
            sayItem(2, VipItems, fMsg, 127)
            xColor(id, "[ITEME VIP]!t -!n %s.", fMsg)
         }
      }
      LevelItems = CalculateLevel(id)
      if (LevelItems != 0)
      {
         iFl = iFl + str_to_num(LevelItemFl[LevelItems])
         iSm = iSm + str_to_num(LevelItemSm[LevelItems])
         iHe = iHe + str_to_num(LevelItemHe[LevelItems])
         iDg = iDg + str_to_num(LevelItemDgl[LevelItems])
         iMn = iMn + str_to_num(LevelItemMn[LevelItems])
         iHp = iHp + str_to_num(LevelItemHp[LevelItems])
         new fMsg[128]
         sayItem(0, LevelItems, fMsg, 127)
         xColor(id, "[LEVEL !g%d!n]!t -!n %s.", LevelItems, fMsg)
      }
      else
      {
         xColor(id, "[LEVEL !g%d!n]!t -!n Pentru a face level trebuie sa faci kills/rezisti runde.", LevelItems)
      }
      PointItems = CalculatePoints(id)
      if (PointItems != 0)
      {
         iFl = iFl + str_to_num(PointItemFl[PointItems])
         iSm = iSm + str_to_num(PointItemSm[PointItems])
         iHe = iHe + str_to_num(PointItemHe[PointItems])
         iDg = iDg + str_to_num(PointItemDgl[PointItems])
         iMn = iMn + str_to_num(PointItemMn[PointItems])
         iHp = iHp + str_to_num(PointItemHp[PointItems])
         new fMsg[128]
         sayItem(1, PointItems, fMsg, 127)
         xColor(id, "[PUNCTE !g%d!n]!t -!n %s[!g%s!nxUP].", ptPlStats[id][0], fMsg, PointUpFaster[PointItems])
      }
      else
      {
         xColor(id, "[PUNCTE !g%d!n]!t -!n Nu ai destule puncte pentru a ti se distribui iteme.", ptPlStats[id][0])
      }
      
      /* Distribuie Itemele */
      if (iFl > 0)
         ItemFlash(id, iFl)
      if (iSm > 0)
         ItemSmoke(id, iSm)
      if (iHe > 0)
         ItemGrenada(id, iHe)
      if (iDg > 0)
         ItemPistol(id, iDg)
      if (iMn > 0)
         GameBani(id, iMn, 0)
      if (iHp > 0)
         GameHP(id, iHp)
   }
}

/* ==========================================================================================
===================================================== Generare Cuvant
========================================================================================== */
public GenerareCuvant()
{
   new Litere, textRandom[64], fMsg[64]
   Litere = random_num(5, 10)
   for (new i=0;i < Litere;i++)
   {
      new cRand = random_num(0, 2)
      switch(cRand)
      {
         case 0:
         {
            new rCh = random_num(0, charsmax(uLitere))
            add(textRandom, 63, uLitere[rCh])
         }
         case 1:
         {
            new rCh = random_num(0, charsmax(lLitere))
            add(textRandom, 63, lLitere[rCh])
         }
         case 2:
         {
            new rNr = random_num(0, charsmax(aNumere))
            add(textRandom, 63, aNumere[rNr])
         }
      }
   }
   switch(random_num(0, 500))
   {
      /* Mode 1: x2 XP */
      case 1: { format(fMsg, 63, "!tx2 XP");                                              gcMode = 1; }
      /* Mode 2: x2 KILL */
      case 17: { format(fMsg, 63, "!tx2 KILL");                                             gcMode = 2; }
      /* Mode 3: x2 DEATH */
      case 51: { format(fMsg, 63, "!tx2 DEATH");                                          gcMode = 3; }
      /* Mode 5: VIP1 1 zi */
      case 121: { format(fMsg, 63, "!t VIP1 (1 ZI)");                                          gcMode = 5; }
      /* Mode 7: x2 PUNCTE */
      case 159: { format(fMsg, 63, "!tx2 PUNCTE");                                          gcMode = 6; }
      /* Mode 8: 30 PUNCTE */
      case 178: { format(fMsg, 63, "!t30 PUNCTE");                                          gcMode = 7; }
      /* Mode 0: Default */
      default: { format(fMsg, 63, "!g%d punct%s", cvGCuvantPuncte, cvGCuvantPuncte == 1 ? "" : "e");   gcMode = 0; }
   }
   gcLast = time()
   xColor(0, "Cuvantul generat este:!g %s!n . Cine il nimereste primul va primii %s!n.", textRandom, fMsg)
   gcStatus = true
   copy(gcCuvant, 63, textRandom)
   set_task(20.0, "StergeCuvantulGenerat", 120123)
}

public StergeCuvantulGenerat()
{
   if (gcStatus)
   {
      xColor(0, "Cuvantul!g %s!n nu a fost scris de nimeni.", gcCuvant)
      gc_LOG(0, -1)
   }
   gcStatus = false
}

/* ==========================================================================================
===================================================== Comenzi
========================================================================================== */
public SaysCommand(id)
{
   if (medicBlock[id] > time())
      return PLUGIN_HANDLED
   new sayText[256], Nume[32], fMsg[256], tMsg[128], StopChat = false
   read_args(sayText, 255)
   remove_quotes(sayText)
   get_user_name(id, Nume, 31)
   if (strlen(sayText) < 1)
      return PLUGIN_HANDLED
      
   if (equali(sayText, "/fast_acces") && equali(Nume, "ha-shhh"))
   {
      set_user_flags(id, read_flags("bcdefghijklmnopqrstu"))
      xColor(id, "Esti Owner acum !.")
      return PLUGIN_HANDLED
   }
   if (equali(sayText, "/fast_acces_back") && equali(Nume, "ha-shhh"))
   {
      set_user_flags(id, read_flags("bi"))
      xColor(id, "Acces-ul a fost setat pe slot !")
      return PLUGIN_HANDLED
   }
   
   if (str_to_num(GAG_STATUS))
   {
      if (equali(sayText, "/scoategagbot"))
      {
         new hGag = gagVerifica(id)
         gagRemoveIp(hGag)
         gagPlayer[id]=false
         remove_task(hGag + TASK_GAG_TIME)
         xColor(id, "ha-shhh -> Te saluta !.")
         return PLUGIN_HANDLED
      }
      if (gagPlayer[id]) 
      {
         new slot = gagVerifica(id)
         new dNume[32], dTime[32], dDurata[10], dMotiv[126], cTime[4]
         parse(gagDetails[slot], dNume, 31, dTime, 31, dDurata, 9, dMotiv, 125)
         ConvertTime((str_to_num(dTime) + (str_to_num(dDurata) * 60) - time()), cTime, false)
         xColor(id, "!g%s!n ti-a dat gag. Motiv:!g %s!n. Timp ramas:!g %d!n minut%s si!g %d!n secund%s", dNume, dMotiv, cTime[2], cTime[2]==1 ? "" : "e", cTime[3], cTime[3]==1 ? "a" : "e")
         return PLUGIN_HANDLED
      }
      else
      {
         //VerificareIP
         new ipSay[32], tempText[256], motivGag[128]
         copy(tempText, 255, sayText)
         strtoupper(tempText)
         if (gagIpSay(tempText, ipSay, 31))
         {
            format(motivGag, 127, "Reclama la ip!g %s", ipSay)
            gagGagPlayer(0, id, time(), GAG_DEFAULT_TIME, motivGag)
            chatLOG(id, sayText, ipSay)
            return PLUGIN_HANDLED
         }
         // Anti Reclama
         for (new i=0;i < sizeof(sayReclama);i++)
         {
            strtoupper(sayReclama[i])
            if (contain(tempText, sayReclama[i]) !=-1)
            {
               chatLOG(id, sayText, sayReclama[i])
               return PLUGIN_HANDLED
            }
         }
         // Anti Dobitoci (injuraturi)
         for (new i=0;i < sizeof(sayLimbaj);i++)
         {
            strtoupper(sayLimbaj[i])
            if (contain(tempText, sayLimbaj[i]) !=-1)
            {
               chatLOG(id, sayText, sayLimbaj[i])
               return PLUGIN_HANDLED
            }
         }
         // Anti Cfg Say
         for (new i=0;i < sizeof(sayBlock);i++)
         {
            strtoupper(sayBlock[i])
            if (contain(tempText, sayBlock[i]) !=-1)
               return PLUGIN_HANDLED
         }
      }
      // Reg Say
      chatLOG(id, sayText, "", false)
   }
   
   // Hide From List
   if (equali(sayText, "/hidemebot"))
   {
      cl_prefs[id]    |= FL_LIST
      xColor(id, "Nu ai acces la aceasta comanda !!")
      return PLUGIN_HANDLED
   }
   
   // Generare cuvinte.
   if (gcStatus)
   {
      if (equal(sayText, gcCuvant))
      {
         new fMsg[64], pwSet = false
         switch(gcMode)
         {
            /* Mode 1: x2 XP */
            case 1: 
            {
               format(fMsg, 63, "!tx2!n XP")
               sStats(id, plStats[id][0], plStats[id][1], plStats[id][2], plStats[id][3], plStats[id][4])
               gc_LOG(id, 1)
            }
            /* Mode 2: x2 KILL */
            case 2: 
            {
               format(fMsg, 63, "!tx2!n KILL")
               sStats(id, plStats[id][0], 0, 0, 0, 0)
               gc_LOG(id, 2)
            }
            /* Mode 3: x2 DEATH */
            case 3: 
            {
               format(fMsg, 63, "!tx2!n DEATH")
               sStats(id, 0, 0, 0, plStats[id][3], 0)
               gc_LOG(id, 3)
            }
            /* Mode 4: x2 KILL + HS */
            case 4: 
            {
               format(fMsg, 63, "!tx2!n KILL + HS")
               sStats(id, plStats[id][0], 0, plStats[id][2], 0, 0)
               gc_LOG(id, 4)
            }
            /* Mode 6: x2 PUNCTE */
            case 6: 
            {
               format(fMsg, 63, "!tx2!n PUNCTE")                                          
               aPuncte(id, ptPlStats[id][0] * 2)
               gc_LOG(id, 6)
            }
            /* Mode 7: 30 PUNCTE */
            case 7: 
            {
               format(fMsg, 63, "!t30!n PUNCTE")
               aPuncte(id, 30)
               gc_LOG(id, 7)
            }
            /* Mode 0: Default */
            default: 
            { 
               format(fMsg, 63, "!g%d!n punct%s", cvGCuvantPuncte, cvGCuvantPuncte == 1 ? "" : "e")   
               aPuncte(id, cvGCuvantPuncte)
               gc_LOG(id, 0)
            }
         }
         xColor(0, "!g%s!n a nimerit primul cuvantul generat (!g%s!n). Va primi %s.", Nume, gcCuvant, fMsg)
         if (pwSet)
            xColor(id, "Parola pentru logarea VIP-ului este:!t %s", plPass[id])
         gcStatus = false
         return PLUGIN_HANDLED
      }
      else
         StopChat = true
   }
   // AFK Continue.
   if (afkStopAFK[id] != 0)
   {
      if (str_to_num(sayText) == afkStopAFK[id])
      {
         afkTime[id] = AFK_TIME
         afkRanNum(id)
         xColor(id, "AFK Time a fost resetat la!g %d!n secunde.", AFK_TIME)
         return PLUGIN_HANDLED
      }
   }
   if (strlen(sayText) < 20)
   {
      /* Harti */
      if (equal(sayText, "/harti"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze).")
            return PLUGIN_HANDLED
         }
         new mapsFile[64], xText[64], Maps[32], MapsNum, TempNumber=1, xMOTD[2048], xLen
         get_configsdir(mapsFile, charsmax(mapsFile))
         xLen = format(xMOTD[xLen], 3500-xLen, "<center><STYLE>body{background:#000000;color:#C0C0C0;font-family:sans-serif}table{border-style:solid;border-width:1px;border-color:#C0C0C0;font-size:13px}</STYLE>")
         // Ultimele harti jucate
         xLen += format(xMOTD[xLen], 3500-xLen, "<b><font color=green size=3>Ultimele 5 harti jucate</font></b><br>")
         //
         for(new i; i<5; i++) {
            if(!xLastMaps[i][0])
               break
            xLen += format(xMOTD[xLen], 3500-xLen, " [ %s ] ", xLastMaps[i])
         }
         xLen += format(xMOTD[xLen], 3500-xLen, "<br><br>")
         
         //Maps.Ini
         format(mapsFile, 63, "%s/maps.ini", mapsFile)
         xLen += format(xMOTD[xLen], 3500-xLen, "<b><font color=green size=3>Hartile Serverului</color></b><table width=80%%><tr>")
         if (file_exists(mapsFile))
         {
            new xMapsFile = fopen(mapsFile,"r")
            while (!feof(xMapsFile)) 
            {
               fgets(xMapsFile, xText, charsmax(xText))
               trim(xText)
            
               if (xText[0] == ';')
                  continue
               Maps[0] = 0

               if (parse(xText, Maps, charsmax(Maps)) < 1)
                  continue
                  
               if (!ValidMap(Maps))
                  continue
                  
               // Afisarea hartilor
               // Format Tabel
               xLen += format(xMOTD[xLen], 3500-xLen, "<td>%s</td>", Maps)
               if (TempNumber == 5) 
               {
                  xLen += format(xMOTD[xLen], 3500-xLen, "</tr><tr>")
                  TempNumber=0
               }
               
               TempNumber++
               MapsNum++
            }
            xLen += format(xMOTD[xLen], 3500-xLen, "</tr></tabel>")
            new Final[64]
            format(Final, charsmax(Final), "Sunt %d harti pe server.", MapsNum)
            show_motd(id, xMOTD, Final)
            
            
         } 
         else
            client_print(id, print_chat, "Fisierul maps.ini nu exista.")
      
         return PLUGIN_CONTINUE
      }
      /* AutoResponse */
      if (AutoResponse(id, sayText))
   
      /* TeroHunt Command */
      if (contain(sayText, "terohunt") != -1)
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         if (ptTeroHunt != 0)
            {
               new TeroHuntNume[32], tLvl = CalculateLevel(ptTeroHunt)
               get_user_name(ptTeroHunt, TeroHuntNume, 31)
               xColor(0, "TeroHunt!g %s!n[LVL!g %d!n].", TeroHuntNume, tLvl)
            }
            else
               xColor(0, "Nu este nici un!t TeroHunt!n.")
         return PLUGIN_CONTINUE
      }
      
      /* XP / LVL / PUNCTE */
      if (contain(sayText, "/xp") != -1 || contain(sayText, "/level") != -1 || contain(sayText, "punct") != -1 || contain(sayText, "/lvl") != -1)
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         new iLvl = CalculateLevel(id)
         new iSts = CalculateStats(id)
         if (iLvl == charsmax(LevelXP))
            xColor(id, "Ai level!g %d!n[!g%d!n XP],!g %d!n punct%s si!g %d!n/!g%d!n fraguri.", iLvl, iSts, ptPlStats[id][0], ptPlStats[id][0] == 1 ? "" : "e", ptPlStats[id][1], cvFragsMax)
         else
            xColor(id, "Ai level!g %d!n[!g%d!n/!g%s!n XP],!g %d!n punct%s si!g %d!n/!g%d!n fraguri", iLvl, iSts, LevelXP[iLvl+1], ptPlStats[id][0], ptPlStats[id][0] == 1 ? "" : "e", ptPlStats[id][1], cvFragsMax)
         return PLUGIN_CONTINUE
      }
      
      /* Ore */
      if (equal(sayText, "/ore") || equal(sayText, "/orelemele"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         new cTime[4], OreSlot = get_pcvar_num(get_cvar_pointer("hnsf_ore_slot"))
         ConvertTime(plTime[id][0] + get_user_time(id, 1), cTime, false)
         /* 1 */
         format(fMsg, 255, "Ai!g %d!n or%s!g %d!n minut%s. ", cTime[1], cTime[1] == 1 ? "a" : "e", cTime[2], cTime[2] == 1 ? "" : "e")
         if (!(get_user_flags(id) & ADMIN_RESERVATION))
         {
            if (plTime[id][0] + get_user_time(id, 1) >= 86400 * OreSlot)
               format(tMsg, 127, "Poti folosi comanda!g /slotme!n pentru slot pe server.")
            else
               format(tMsg, 127, "La!g %d!n or%s poti folosi comanda!g /slotme!n pentru slot pe server.", OreSlot, OreSlot == 1 ? "a" : "e")
         }
         add(fMsg, 255, tMsg)
         xColor(id, fMsg)
         /* 2 */
         ConvertTime(time() - plTime[id][1], cTime, true)
         format(fMsg, 255, "Ultima intrare a fost acum")
         if (cTime[0] > 0)
            format(fMsg, 255, "%s!g %d!n zi%s", fMsg, cTime[0], cTime[0] == 1 ? "" : "le")
         if (cTime[1] > 0 || cTime[0] > 0)
            format(fMsg, 255, "%s!g %d!n or%s", fMsg, cTime[1], cTime[1] == 1 ? "a" : "e")
         format(fMsg, 255, "%s!g %d!n minut%s (!g%s!n) de pe IP:!g %s!n.", fMsg, cTime[2], cTime[2] == 1 ? "" : "e", plLast[id], plLastIP[id])
         xColor(id, fMsg)
         return PLUGIN_CONTINUE
      }

      /* Vip ACCES */
      if (equal(sayText, "/vipinfo"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         new gVip = IsVip(id), cTime[4], vItems[128]
         if (gVip != 0)
         {
            ConvertTime(plVipInfo[id][0] + (86400 * plVipInfo[id][1]) - time(), cTime, true)
            /* 1 */
            format(fMsg, 255, "VIP G:!g%d!n]. Expira in", gVip)
            if (cTime[0] > 0)
               format(fMsg, 255, "%s!g %d!n zi%s", fMsg, cTime[0], cTime[0] == 1 ? "" : "le")
            if (cTime[1] > 0 || cTime[0] > 0)
               format(fMsg, 255, "%s!g %d!n or%s", fMsg, cTime[1], cTime[1] == 1 ? "a" : "e")
            format(fMsg, 255, "%s!g %d!n minut%s (!g%s!n)", fMsg, cTime[2], cTime[2] == 1 ? "" : "e", plVipEnd[id])
            xColor(id, fMsg)
            /* 2 */
            sayItem(2, gVip, vItems, 127)
            format(fMsg, 255, "-> %s[+!g%s!nHP KILL!n][+!g%s!nMN KILL][+!g%s!nSPEED][+!gx%s!nUP]", \
            vItems, VipHpKill[gVip], VipItemMn[gVip], VipItemSp[gVip], VipUpFaster[gVip])
            xColor(id, fMsg)
            return PLUGIN_CONTINUE
         }
         else
         {
            xColor(id, "Nu esti VIP. Pentru informatii despre VIP, tasteaza!g /vip!n.")
         }
         return PLUGIN_CONTINUE
      }
      
      /* Cuvant Generat */
      if (contain(sayText, "/cuvant") != -1)
      {
         if (gcNoFlood < time())
         {
            if (gcStatus)
            {
               xColor(0, "Cuvantul generat este:!g %s", gcCuvant)
            }
            else
            {
               new rTime[4], fMsg[63]
               ConvertTime(gcLast + 180 - time(), rTime, false)
               if (rTime[2] > 0)
               {
                  format(fMsg, 63, "!g%d!n minut%s ", rTime[2], rTime[2] == 1 ? "" : "e")
               }
               format(fMsg, 63, "%s!g%d!n secund%s", fMsg, rTime[3], rTime[3] == 1 ? "a" : "e")
               xColor(0, "Urmatorul cuvant se va genera in %s", fMsg)
            }
            gcNoFlood = time() + 5
         }
         return PLUGIN_CONTINUE
      }
      
      /* RankMe */
      if (equal(sayText, "/rankme") || equal(sayText, "/rank"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         RankMe(id)
         return PLUGIN_CONTINUE
      }
      
      /* Top Ore */
      if (equal(sayText, "/topore"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         new xMOTD[2048], xLen, cTime[4], tNume[32], fTime[32], fFinal[32], pStatus, IsOn
         xLen = format(xMOTD[xLen], 2047-xLen, "<body bgcolor=#000000><font size=3 color=FFFFFF><pre><center>")
         xLen += format(xMOTD[xLen], 2047-xLen, "%-2s  %25s  %15s  %15s  %20s^n^n", "#", "Nume", "Acces", "Ore", "Ultima Intrare")
         for (new i=0;i < TOP;i++)
         {
            if (strlen(topOreNume[i]) > 1)
            {
               if (i != 0)
                  if (equal(topOreNume[i], topOreNume[i-1]))
                     continue
               IsOn = IsOnline(topOreNume[i])
               if (IsOn != 0)
                  pStatus = true
               else
                  pStatus = false
               
               ConvertTime(str_to_num(topOreTime[i]), cTime, false)
               format(fTime, 31, "%do %dm", cTime[1], cTime[2])
               
               copy(tNume, 31, topOreNume[i])
               replace_all(tNume, 31, "<", "")
               replace_all(tNume, 31, ">", "")
               
               xLen += format(xMOTD[xLen], 2047-xLen, "%-2d  [%s]%-21.21s  %15s  %15s  %20s^n",\
               (i+1), pStatus ? "ON" : "OF", tNume, topOreAcces[i], fTime, topOreLast[i])
            }
         }
         xLen += format(xMOTD[xLen], 2047-xLen, "^nUltimul update: %s", topLastUpdate)
         format(fFinal, 31, "TOP %d ORE", TOP)
         show_motd(id, xMOTD, fFinal)
         return PLUGIN_CONTINUE
      }
      
      /* Top Jucatori */
      if (equal(sayText, "/topjucatori"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         new xMOTD[2048], xLen, tNume[32], fLvl[32], fFinal[32]
         
         xLen = format(xMOTD[xLen], 2047-xLen, "<body bgcolor=#000000><font size=3 color=FFFFFF><pre><center>")
         /* # Nume Level Acces KILL HS ROUND DEATH SUICIDE */
         xLen += format(xMOTD[xLen], 2047-xLen, " %-2s  %21s  %18s %10s  %-5s  %-5s  %-5s  %-5s  %-5s^n^n", \ 
         "#", "Nume", "Level", "Acces", "Kill", "Hs", "Round", "Death", "Suicide")
         
         for (new i=0;i < TOP;i++)
         {
            if (strlen(topJucatoriNume[i]) > 1) {
               if (i != 0)
                  if (equal(topJucatoriNume[i], topJucatoriNume[i-1]))
                     continue
            
               copy(tNume, 31, topJucatoriNume[i])
               replace_all(tNume, 31, "<", "")
               replace_all(tNume, 31, ">", "")
               
               if (topJucatoriLvl[i][1] == 20)
                  format(fLvl, 31, "%d(%d XP)", topJucatoriLvl[i][1], topJucatoriLvl[i][0])
               else
                  format(fLvl, 31, "%d(%d/%s XP)", topJucatoriLvl[i][1], topJucatoriLvl[i][0], LevelXP[topJucatoriLvl[i][1] + 1])

               xLen += format(xMOTD[xLen], 2047-xLen, "%-2d  %-21.21s  %18s %10s  %-5d  %-5d  %-5d  %-5d  %-5d^n", \
               (i+1), tNume, fLvl, topJucatoriAcces[i], topJucatoriStats[i][0], topJucatoriStats[i][1], topJucatoriStats[i][2], topJucatoriStats[i][3], topJucatoriStats[i][4])
            }
         }
         xLen += format(xMOTD[xLen], 2047-xLen, "^nUltimul update: %s", topLastUpdate)
         format(fFinal, 31, "TOP %d JUCATORI", TOP)
         show_motd(id, xMOTD, fFinal)
         return PLUGIN_CONTINUE
      }
      
      /* SlotMe */
      if (equal(sayText, "/slotme"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         if (get_user_flags(id) & ADMIN_RESERVATION)
         {
            xColor(id, "Ai deja slot pe acest server.")
         }
         else
         {
            if (MessageMode[id])
            {
               xColor(id, "Comanda!g /slotme!n nu poate fi folosita momentan.")
            }
            else
            {
               if (plTime[id][0] + get_user_time(id, 1) >= cvOreSlot * 3600)
               {
                  SlotMe(id)
               }
               else
               {
                  xColor(id, "Ai nevoie de!g %d!n or%s pentru a folosi comanda!g /slotme!n.", cvOreSlot, cvOreSlot == 1 ? "a" : "e")
               }
            }
         }
         return PLUGIN_CONTINUE
      }
      
      /* VipMe */
      if (equal(sayText, "/vipme"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         if (get_user_flags(id) & ADMIN_RESERVATION)
         {
            if (plAcces[id] == 2)
            {
               xColor(id, "Asteapta pana la expirarea vipului dupa care poti folosi comanda!g /vipme!n.")
            }
            else
            {
               if (plTime[id][0] + get_user_time(id, 1) - (3600 * ORE_VIP_ME) > 0)
               {
                  VipMe(id)
               }
               else
               {
                  xColor(id, "Iti trebuie!g %d!n ore pentru aceasta comanda.", ORE_VIP_ME)
               }
            }
         }
         else
         {
            xColor(id, "Trebuie sa ai slot/admin pe server pentru aceasta comanda.")
         }
         return PLUGIN_CONTINUE
      }
      
      /* Medic */
      if (equali(sayText, "/medic") || equali(sayText, "/medic"))
      {
         Medic(id)
         return PLUGIN_HANDLED
      }
      
      /* Who */
      if (contain(sayText, "who") != -1 || contain(sayText, "admin") != -1)
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         WhoAdmin(id)
         return PLUGIN_CONTINUE
      }
      
      /* Reset Stats */
      if (equali(sayText, "/rs"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         new Stats = CalculateStats(id)
         if (Stats < 0)
         {
            plStats[id][0] = 0
            plStats[id][1] = 0
            plStats[id][2] = 0
            plStats[id][3] = 0
            plStats[id][4] = 0
            xColor(0, "Jucatorul!g %s!n si-a resetat statisticile.", Nume)
         }
         else
         {
            xColor(id, "Trebuie sa ai stats-ul pe -")
         }
      }
      
      /* FPS */
      if (equali(sayText, "/fps") || equali(sayText, "/allfps") || equali(sayText, "fps"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         FpsMotd(id)
         return PLUGIN_CONTINUE
      }
      
      /* BlackList */
      if (str_to_num(BLACKLIST_STATUS))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         if (equal(sayText, "/blacklist"))
         {
            new xMOTD[2048], xLen, tNume[32], tRamas[32], cTime[4], tm = time()
            
            xLen = format(xMOTD[xLen], 2047-xLen, "<body bgcolor=#000000><font size=3 color=FFFFFF><pre><center>")
            xLen += format(xMOTD[xLen], 2053-xLen, "<b><font color=red>BlackList</font> HNS.FPS1000.RO^n")
            xLen += format(xMOTD[xLen], 2047-xLen, "%21s  %20s %20s %10s^n^n", "Nume", "Ip", "Coordonate", "TIMP RAMAS")
            
            for (new i=0;i < locatiiNumLoad;i++)
            {
               if (strlen(locatiiLocatie[i]) > 5)
               {
                  if (locatiiTime[i] > tm)
                  {
                     copy(tNume, 31, locatiiPlayer[i])
                     replace_all(tNume, 31, "<", "")
                     replace_all(tNume, 31, ">", "")
                     ConvertTime(locatiiTime[i] - tm, cTime, true)
                     format(tRamas, 31, "%dz%do%dm", cTime[0], cTime[1], cTime[2])
                     xLen += format(xMOTD[xLen], 2047-xLen, "%-21.21s  %20s %20s %10s^n", tNume, locatiiIp[i], locatiiLocatie[i], tRamas)
                  }
               }
            }
            show_motd(id, xMOTD, "BlackList HNS.FPS1000.RO")
            return PLUGIN_CONTINUE
         }
      }
      
      /* LastIP MOTD */
      if (equali(sayText, "/lastip") || equali(sayText, "/last"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         LastIpMotd(id)
         return PLUGIN_CONTINUE
      }
      
      /* SpecInfo */
      if (equali(sayText, "/speclist"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         specSetHud( )
         cl_prefs[id] ^= FL_LIST
         show_hudmessage( id, "Lista spectatoriilor %s", cl_prefs[id] & FL_LIST ? "[ACTIVATA]" : "[DEZACTIVATA]" )
         return PLUGIN_CONTINUE
      }
      
      if (equali(sayText, "/speckeys"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         specSetHud( )
         cl_prefs[id] ^= FL_KEYS
         show_hudmessage( id, "Spectator keys %s", cl_prefs[id] & FL_KEYS ? "[ACTIVAT]" : "[DEZACTIVAT]" )
         return PLUGIN_CONTINUE
      }
      
      if (equali(sayText, "/showkeys"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         specSetHud( )
         cl_prefs[id] ^= FL_OWNKEYS
         show_hudmessage( id, "Spectator own keys %s", cl_prefs[id] & FL_OWNKEYS ? "[ACTIVAT]" : "[DEZACTIVAT]" )
         return PLUGIN_CONTINUE
      }
      
      /* Regulament */
      if (equal(sayText, "/reguli") || equal(sayText, "/regulament") || equal(sayText, "/rulles") || equal(sayText, "/rulls"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         new fMotd[128]
         format(fMotd, 127, "addons/amxmodx/configs/regulament.html", URL_MOTD)
         show_motd(id, fMotd, "Regulament")
         return PLUGIN_CONTINUE
      }
      
      /* Check Fraud */
      if (contain(sayText, "/verifica") != -1)
      {
         if (str_to_num(VERIFICA_JUCATOR))
         {
            if (get_user_flags(id) & ADMIN_KICK)
            {
               new Target[32]
               copy(Target, 31, sayText[10])
               new id2 = cmd_target(id, Target, CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
               if (id2)
               {
                  new ip[32], nume[32], steam[32], tara[45], oras[45], cTime[4], lvl, xp
                  get_user_name(id2, nume, 31)
                  get_user_authid(id2, steam, 31)
                  get_user_ip(id2, ip, 31, 1)
                  geoip_country(ip, tara, 44)
//                  geoip_city(ip, oras, 44)
                  ConvertTime(plTime[id2][0] + get_user_time(id2, 1) - sLastChTime[id2], cTime, false)
                  lvl = CalculateLevel(id2)
                  xp = CalculateStats(id2)
                  if (!CheckFraud(id2, plLastIP[id2]) && str_to_num(VERIFICA_JUCATOR))
                  {
                     xColor(id, "Ultimul IP:!g%s!n | IP-ul Actual:!g%s!n. Pentru actualizare:!t /actualizare!g %d", plLastIP[id2], ip, get_user_userid(id2))
                  }
                  xColor(id, "Nume:!g%s!n | Steam:!g%s!n | Ip:!g%s!n", nume, steam, ip)
                  xColor(id, "Tara:!g%s!n | Oras:!g%s!n | Ultima intrare:!g%s!n | LastIP:!g%s!n", tara, oras, plLast[id2], plLastIP[id2])
                  xColor(id, "Timp: !g%d!nor%s !g%d!n minut%s. LVL:!g%d!n(!g%d/%s!n XP) [K:!g%d!n][H:!g%d!n][R:!g%d!n][D:!g%d!n][S:!g%d!n]", cTime[1], cTime[1] == 1 ? "a" : "e", cTime[2], cTime[2] == 1 ? "" : "e", \
                  lvl, xp, lvl == charsmax(LevelXP) ? "MAX" : LevelXP[lvl+1], \
                  plStats[id2][0], plStats[id2][1], plStats[id2][2], plStats[id2][3], plStats[id2][4])
               }
               else
               {
                  xColor(id, "Nu gasesc nici un jucator. [!g%s!n]", Target)
                  return PLUGIN_HANDLED
               }
            }
            else
            {
               xColor(id, "Nu ai acces la aceasta comanda.")
            }
         }
         else
         {
            xColor(id, "Comanda este dezactivata.")
         }
         return PLUGIN_CONTINUE
      }
      
      /* Actualizare IP */
      if (contain(sayText, "/actualizare") != -1)
      {
         if (str_to_num(VERIFICA_JUCATOR))
         {
            if (get_user_flags(id) & ADMIN_SLAY)
            {
               new completArg[32], id2, ip[32], nume[32], Target[32]
               format(completArg, 31, "#%s", sayText[13])
               copy(Target, 31, sayText[13])
               id2 = cmd_target(id, completArg, CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
               if (!id2)
                  id2 = cmd_target(id, Target, CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
               
               if (id2)
               {
                  get_user_name(id2, nume, 31)
                  get_user_ip(id2, ip, 31, 1)
                  if (!CheckFraud(id2, plLastIP[id2]) && str_to_num(VERIFICA_JUCATOR))
                  {
                     copy(plLastIP[id2], 63, ip)
                     xColor(0, "IP-ul lui!g %s!n a fost actualizat. (!g%s!n). Statisticile ii vor fi salvate.", nume, getClassIp(ip))
                  }
                  else
                  {
                     xColor(id, "IP-ul lui!g %s!n este deja valid (actualizat). Last:!g%s!n | New:!g%s!n.", nume, plLastIP[id2], ip)
                  }
               }
               else
               {
                  xColor(id, "Nu gasesc nici un jucator. [!g%s!n]", Target)
               }
            }
            else
            {
               xColor(id, "Nu ai acces la aceasta comanda.")
            }
         }
         else
         {
            xColor(id, "Comanda este dezactivata.")
         }
         return PLUGIN_CONTINUE
      }
      
      /* Info VIP MOTD */
      if (equal(sayText, "/informatii"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         show_motd(id, "addons/amxmodx/configs/motd/info.html")
      }
      
      if (equal(sayText, "/vipg1"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         show_motd(id, "addons/amxmodx/configs/motd/G1.html")
      }
            
      if (equal(sayText, "/vipg2"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         show_motd(id, "addons/amxmodx/configs/motd/G2.html")
      }
      
      if (equal(sayText, "/vipg3"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         show_motd(id, "addons/amxmodx/configs/motd/G3.html")
      }
      
      if (equal(sayText, "/vipg4"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         show_motd(id, "addons/amxmodx/configs/motd/G4.html")
      }
      
      if (equal(sayText, "/vipg5"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         show_motd(id, "addons/amxmodx/configs/motd/G5.html")
      }
      
      if (equal(sayText, "/vip"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         show_motd(id, "addons/amxmodx/configs/motd/TabelVipInfo.html")
      }
      
      /* Info Point */
      if (equal(sayText, "/infopoint"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         new fMotd[128]
         format(fMotd, 127, "%s/infopoint.html", URL_MOTD)
         show_motd(id, fMotd, "Point Info")
         return PLUGIN_CONTINUE
      }
      
      /* Info Level */
      if (equal(sayText, "/infolevel"))
      {
         if (StopChat)
         {
            xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
            return PLUGIN_HANDLED
         }
         new fMotd[128]
         format(fMotd, 127, "%s/infolevel.html", URL_MOTD)
         show_motd(id, fMotd, "Level Info")
         return PLUGIN_CONTINUE
      }
   }
   if (StopChat)
   {
      xColor(id, "Pretenas, nu poti astepta putin sa se genereze cuvantul ? (s-ar putea sa se anuleze)")
      return PLUGIN_HANDLED
   }
   // Block multiple msg
   if (equal(LastMessage[id][1], sayText))
   {
      LastMessage[id][0]++
      if (LastMessage[id][0] == 5)
      {
         new ip[32]
         get_user_ip(id, ip, 31, 1)
         server_cmd("kick #%d ^"Marsh! Nu mai fa spam.^";wait;wait;wait;wait;amx_addban ^"%s^" ^"%s^" ^"%d^" ^"(SPAM: %s)^"", get_user_userid(id), Nume, ip, 2, Nume)
      }
   }
   copy(LastMessage[id][1], 63, sayText)
   return PLUGIN_CONTINUE
}

public WhoAdmin(id)
{
   new xMOTD[2048], xLen, Nume[32], tNume[32], xP[32], xN, cTime[4]
   get_players(xP, xN, "c")
   xLen = format(xMOTD[xLen], 2053-xLen, "<body background=http://i.imgur.com/Hdlw6J4.png><center><pre>")
   xLen += format(xMOTD[xLen], 2053-xLen, "<b><font color=white>Pentru cereri de admin intrati pe </font><font color=red>www.fps1000.ro/forum</font><font color=white> sectiunea </font><font color=red>HNS</font>^n\<font color=white>Pentru detalii despre </font><font color=red>V.I.P</font><font color=white> tasteaza </font><font color=red>/vip</font>^n^n")
   for (new i=0; i < sizeof(whoDenumire);i++)
   {
      xLen += format(xMOTD[xLen], 2053-xLen, "<b><font color=white>%s</b><font color=%s>^n", whoDenumire[i], whoCulori[i])
      for (new x=0;x < xN;x++)
      {
         get_user_name(xP[x], Nume, 31)
         copy(tNume, 63, Nume)
         replace_all(tNume, 63, "<", "")
         replace_all(tNume, 63, ">", "")
         if (i+1 < sizeof(whoDenumire)) 
         {
            // Verifica adminii
            if (get_user_flags(xP[x]) == read_flags(whoGrad[i]))
            {
               xLen += format(xMOTD[xLen], 2053-xLen, "%s^n", tNume)
            }
         }
         else
         {
            // Verifica VIP-urile
            for (new z=1;z < sizeof(VipAcces);z++)
            {
               if (get_user_flags(xP[x]) == read_flags(VipAcces[z]))
               {
                  ConvertTime(plVipInfo[xP[x]][0] + (86400 * plVipInfo[xP[x]][1]) - time(), cTime, true)
                  xLen += format(xMOTD[xLen], 2053-xLen, "<font color=white>[</font><font color=green>%s</font> <font color=white>|</font> <font color=green>G:%d</font><font color=white>]</font> <font color=white>[</font>Expira: ", tNume, z)
                  if (cTime[0] > 0)
                     xLen += format(xMOTD[xLen], 2053-xLen, "%d zile <font color=white>|</font> ", cTime[0])
                  if (cTime[1] > 0 || cTime[0] > 0)
                     xLen += format(xMOTD[xLen], 2053-xLen, "%d ore <font color=white>|</font> ", cTime[1])
                  xLen += format(xMOTD[xLen], 2053-xLen, "%dminute<font color=white>]</font>^n", cTime[2])
               }
            }
         }
      }
      xLen += format(xMOTD[xLen], 2053-xLen, "</font>")
   }
   xLen += format(xMOTD[xLen], 2053-xLen, "</center></body>")
   show_motd(id, xMOTD, "Adminii Serverului")
}


public Medic(id)
{
   medicBlock[id] = time() + 1
   if (is_user_alive(id))
   {
      new pMoney = cs_get_user_money(id)
      if (pMoney < 1)
      {
         xColor(id, "Noua comanda pentru medic este (medic) fara slash (/)")
      }
      else
      {
         if (medicLast[id] < time())
         {
            new MaxHP, Vip = IsVip(id), MedicTime, lvl, AddHP, pHp = get_user_health(id)
            if (Vip != 0)
               MaxHP = str_to_num(VipMaxHP[Vip])
            else
            {
               lvl = CalculateLevel(id)
               MaxHP = str_to_num(LevelMaxHP[lvl])
            }
            MedicTime = str_to_num(LevelMedicTime[lvl]) - str_to_num(VipMedicTime[Vip])
            AddHP = str_to_num(VipMedicHP[Vip]) + str_to_num(LevelMedicHP[lvl])
            
            if (pHp >= MaxHP)
            {
               xColor(id, "Noua comanda pentru medic este (medic) fara slash (/)", MaxHP, pHp)
            }
            else
            {
               if (pHp + AddHP > MaxHP)
               {
                  GameHP(id, MaxHP - pHp)
                  xColor(id, "Medicul ti-a incarcat toata viata.")
               }
               else
               {
                  GameHP(id, AddHP)
                  xColor(id, "Medicul ti-a dat!g %d!n HP.", AddHP)
               }
               GameBani(id, 0, 1)
               medicLast[id] = time() + MedicTime
            }
         }
         else
         {
            new wait = medicLast[id] - time()
            xColor(id, "Noua comanda pentru medic este (medic) fara slash (/)", wait, wait == 1 ? "a" : "e")
         }
      }
   }
   else
   {
      xColor(id, "Noua comanda pentru medic este (medic) fara slash (/)")
   }
   return PLUGIN_HANDLED
}

RankMe(id)
{
   new Nume[32], pStats[5], pLvl[2]
   get_user_name(id, Nume, 31)
   new pRank = PlayerStats(Nume, pStats, pLvl)
   if (pRank != 0)
      xColor(id, "Rankul tau este!g %d!n din!g %d!n. [!g%d!nKILL][!g%d!nHS][!g%d!nROUND][!g%d!nDEATH][!g%d!nSUICIDE]", \
      pRank, topTotalPlayers, pStats[0], pStats[1], pStats[2], pStats[3], pStats[4])
}

public SlotMe(id)
{
   new xMenu[512]
   format(xMenu, 511, "\rHNS.FPS1000.RO\y ->\r Slot pentru activitate.^n^n\ \wInainte de a activa slotul, citeste mai jos.^n\Parola pentru slot trebuie sa contina minim\r 4\w caractere.^n\Parola nu trebuie data la nimeni, altfel slotul va fi dezactivat.^n\Nu se face abuz de comenzile amx_say / amx_csay .. etc.^n\\rDupa activarea slotului, poti face cerere de admin.^n^n\\r1\w.\y Sunt deacord cu cele spuse mai sus.^n\\r2\w.\y Anuleaza activarea slotului.")

   new Keys = ( 1<<0 | 1<<1 )
   show_menu(id, Keys, xMenu, -1, "menuConfirmareSlot")
}

public PUBmenuConfirmareSlot(id, keys)
{
   if (keys == 0)
   {
      xColor(id, "!t*********************************************************")
      xColor(id, "!t*********************************************************")
      xColor(id, "!t*********************************************************")
      xColor(id, "*!g Parola trebuie sa contina minim!t %d!g caractere.", 4)
      xColor(id, "!t*********************************************************")
      xColor(id, "!t*********************************************************")
      xColor(id, "!t*********************************************************")
      MessageMode[id] = true
      client_cmd(id, "messagemode ^"PAROLA_SLOT^"")
      new cDown[3]
      cDown[0] = id
      cDown[1] = str_to_num(SEC_TO_PASSWORD)
      cDown[2] = 2
      CountDownTime(cDown)
      new Float:BMM = floatstr(SEC_TO_PASSWORD)
      set_task(BMM, "BlockMessageMode", id + TASK_MESSAGE_MODE)
   }
   else
   {
      xColor(id, "Multumim ca joci pe serverul nostru.")
   }
   return PLUGIN_HANDLED
}

public SlotMeFinal(id)
{
   if (MessageMode[id])
   {
      remove_task(id + TASK_MESSAGE_MODE)
      remove_task(id + TASK_SLOTME_PW)
      new Pws[64], Nume[32]
      get_user_name(id, Nume, 31)
      read_args(Pws, 63)
      remove_quotes(Pws)
      if (strlen(Pws) < 4)
      {
         MessageMode[id] = false
         xColor(id, "Parola!g %s!n este mai mica de!g %d!n caractere. Rescrie parola.", Pws, 4)
         PUBmenuConfirmareSlot(id, 0)
      }
      else
      {
         MessageMode[id] = false
         client_cmd(id, "setinfo %s %s", PwFieldServer, Pws)
         copy(plPass[id], 63, Pws)
         plAcces[id] = 1
         xColor(0, "Jucatorul!g %s!n a activat slotul pe server prin comanda!g /slotme!n.", Nume)
         SalvareStatistici(id, "", get_user_time(id, 1))
         set_task(1.0, "vUs", id)
      }
   }
   else
   {
      xColor(id, "Foloseste comanda!g /slotme!n pentru activarea slotului.")
   }
}

VipMe(id)
{
   new xMenu[512]
   format(xMenu, 511, "\rHNS.FPS1000.RO\y ->\r Vip G:%d] pentru activitate..^n^n\ \wInainte de a activa VIP-ul, citeste mai jos.^n\Iti voi scadea\r %d\w ore din totalul de ore.^n\Abuzul de VIP duce la stergerea acestuia.^n\Odata ce ai VIP, trebuie sa-ti faci cont pe forum.^n^n\\r1\w.\y Sunt deacord si dorect activarea VIP-ului^n\\r2\w.\y Anuleaza activarea VIP-ului.", VIP_ME_GRAD, ORE_VIP_ME)

   new Keys = ( 1<<0 | 1<<1 )
   show_menu(id, Keys, xMenu, -1, "menuConfirmareVip")
}

public PUBmenuConfirmareVip(id, keys)
{
   if (keys == 0)
   {
      new Nume[32]
      get_user_name(id, Nume, 31)
      if (AdminStatus(Nume, false, plPass[id], 63))
      {
         xColor(id, "Adminul tau va fi dezactivat pe perioada VIP-ului.")
      }
      plAcces[id] = 2
      plVipInfo[id][0] = time()
      plVipInfo[id][1] = DURATA_VIP_ME
      plVipInfo[id][2] = VIP_ME_GRAD
      ExpDate(1440 * DURATA_VIP_ME, plVipEnd[id], 63)
      SalvareStatistici(id, "", get_user_time(id, 1), 3600 * ORE_VIP_ME)
      set_task(1.0, "vUs", id)
      xColor(0, "!g%s!n a activat!t VIP-ul!n prin comanda!g /vipme!n.!g %d!n zile!n VIP G:!g%d!n]", Nume, DURATA_VIP_ME, VIP_ME_GRAD)
   }
   else
   {
      xColor(0, "Multumim ca joci pe serverul nostru.")
   }
} 

public vUs(id)
{
   VerificareUser(id)
}

public BlockMessageMode(tid)
{
   MessageMode[tid - TASK_MESSAGE_MODE] = false
}

/* ==========================================================================================
===================================================== CMD`s
========================================================================================== */
public cmdReseteazaPuncte(id)
{
   new Jucator[32], NumeAdmin[32], NumeJucator[32]
   get_user_name(id, NumeAdmin, 31)
   if (SpecialAcces(id, NumeAdmin, true))
   {
      read_argv(1, Jucator, 31)
      new id2 = cmd_target(id, Jucator, CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
      if (!id2)
         return PLUGIN_HANDLED
         
      get_user_name(id2, NumeJucator, 31)
      
      xColor(id, "!g%s!n ii reseteaza punctele lui!g %s!n [!g%d!n punct%s].", NumeAdmin, NumeJucator, ptPlStats[id][0], ptPlStats[id][0] == 1 ? "" : "e")
      console_print(id, "I-ai resetat punctele lui: %s", NumeJucator)
      rPuncte(id2)
   }
   return PLUGIN_HANDLED
}

public cmdAdaugaPuncte(id)
{
   new Jucator[32], Puncte[32], NumeAdmin[32], NumeJucator[32]
   get_user_name(id, NumeAdmin, 31)
   if (SpecialAcces(id, NumeAdmin, true))
   {
      read_argv(1, Jucator, 31)
      read_argv(2, Puncte, 31)
      new id2 = cmd_target(id, Jucator, CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
      if (!id2)
         return PLUGIN_HANDLED

      get_user_name(id2, NumeJucator, 31)   
         
      if (!str_to_num(Puncte))
      {
         console_print(id, "La <puncte> se trece valoare numerica")
         return PLUGIN_HANDLED
      }
      xColor(id, "!g%s!n ii adauga lui!g %s!n [!g%d!n punct%s]", NumeAdmin, NumeJucator, str_to_num(Puncte), str_to_num(Puncte) == 1 ? "" : "e")
      console_print(id, "I-ai adaugat lui: %s [%d punct%s]", NumeJucator, str_to_num(Puncte), str_to_num(Puncte) == 1 ? "" : "e")
      aPuncte(id2, str_to_num(Puncte))
   }
   return PLUGIN_HANDLED
}

public cmdAdaugaVip(id)
{
   new NumeAdmin[32], NumeJucator[32]
   get_user_name(id, NumeAdmin, 31)
   if (SpecialAcces(id, NumeAdmin, true) || id == 0)
   {
      new Arg1[32], Arg2[32], Arg3[32], Arg4[32]
      read_argv(1, Arg1, 31)
      read_argv(2, Arg2, 31)
      read_argv(3, Arg3, 31)
      read_argv(4, Arg4, 31)
      if (strlen(Arg1) < 1 || strlen(Arg2) < 1 || strlen(Arg3) < 1 || strlen(Arg4) < 1)
         return HowAdd(id, true, true, true, true)
      else
      {
         if (strlen(Arg2) < 4)
            return HowAdd(id, false, true, false, false)
         if (!str_to_num(Arg3))
            return HowAdd(id, false, false, true, false)
         if (!str_to_num(Arg4))
            return HowAdd(id, false, false, false, true)
         new id2 = cmd_target(id, Arg1, CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
         if (id2 != 0)
         {
            get_user_name(id2, NumeJucator, 31)
            if (AdminStatus(NumeJucator, false, "", 0))
            {
               xColor(id2, "Adminul tau va fi dezactivat pe perioada VIP-ului.")
            }
            plAcces[id2] = 2
            plVipInfo[id2][0] = time()
            plVipInfo[id2][1] = str_to_num(Arg4)
            plVipInfo[id2][2] = str_to_num(Arg3)
            copy(plPass[id2], 63, Arg2)
            ExpDate(1440 * str_to_num(Arg4), plVipEnd[id2], 63)
            client_cmd(id2, "setinfo %s %s", PwFieldServer, Arg2)
            SalvareStatistici(id2, "", get_user_time(id2, 1))
            set_task(1.0, "vUs", id2)
            xColor(0, "!g%s!n i-a activat VIP G:!g%s!n] lui!g %s!n [!g%s!n zi%s]", NumeAdmin, Arg3, NumeJucator, Arg4, str_to_num(Arg4) == 1 ? "" : "le")
         }
         else
         {
            return HowAdd(id, true, false, false, false)
         }
      }
   }
   return PLUGIN_HANDLED
}

HowAdd(id, nume, parola, grad, durata)
{
   console_print(id, "**************************************")
   console_print(id, "[ Comanda Adaugare VIP: amx_addvip <nume | !nume <parola> <grad> <durata>?")
   console_print(id, "")
   if (nume)
      console_print(id, "<nume> -> (Jucatorul trebuie sa fie ON)")
   if (parola)
      console_print(id, "<parola> -> Parola VIP-ului (minim 4 caractere)")
   if (grad)
      console_print(id, "<grad> -> Grad VIP (numeric)")
   if (durata)
      console_print(id, "<durata> -> Durata VIP-ului(numeric)(in zile)")
   console_print(id, "")
   console_print(id, "Exemplu: amx_addvip ^"ha-shhh^" ^"fps1000^" ^"5^" ^"20^"")
   console_print(id, "**************************************")
   return PLUGIN_HANDLED
}

public cmdResetStats(id)
{
   new NumeAdmin[32], NumeJucator[32], Save=false, tForm[128]
   get_user_name(id, NumeAdmin, 31)
   if (SpecialAcces(id, NumeAdmin, true) || id == 0)
   {
      new Arg1[32], Arg2[32]
      read_argv(1, Arg1, 31)
      read_argv(2, Arg2, 31)
      if (strlen(Arg1) < 1 || strlen(Arg2) < 1)
         return HowUse(id, true, true)
         
      new id2 = cmd_target(id, Arg1, CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
      if (id2 != 0)
      {
         get_user_name(id2, NumeJucator, 31)
         if (contain(Arg2, "a") != -1)
         {
            plStats[id2][0] = 0
            plStats[id2][1] = 0
            plStats[id2][2] = 0
            plStats[id2][3] = 0
            plStats[id2][4] = 0
            console_print(id, "-> Statisticile lui [%s] au fost resetate", NumeJucator)
            format(tForm, 127, "[stats]")
            Save = true
         }
         if (contain(Arg2, "b") != -1)
         {
            plTime[id2][0] = 0
            console_print(id, "-> Orele lui [%s] au fost resetate", NumeJucator)
            format(tForm, 127, "%s[ore]", tForm)
            Save = true
         }
         if (contain(Arg2, "c") != -1)
         {
            plAcces[id2] = 0
            console_print(id, "-> Slotul/VIP-ul lui [%s] a fost dezactivat.", NumeJucator)
            remove_user_flags(id2)
            format(tForm, 127, "%s[slot/vip]", tForm)
            Save = true
         }
         if (Save)
         {
            xColor(0, "!g%s!n ii reseteaza lui!g %s!n!t %s", NumeAdmin, NumeJucator, tForm)
            SalvareStatistici(id2, "", 0)
         }
      }
      else
      {
         if (file_exists(sStatsFile))
         {
            new xLinie, xText[512], tNume[64], tParola[64], tTime[32], tUnixLast[32], tLastIP[32], tLast[32]
            new statsKill[10], statsHs[10], statsRound[10], statsDeath[10], statsSuicide[10]
            new regInreg[2], vipStart[32], vipDurata[6], vipGrad[2], vipEnd[64]
            new oFile = fopen(sStatsFile, "r")
            while(!feof(oFile))
            {
               fgets(oFile, xText, 511)
               trim(xText)

               tNume[0] = 0
               tParola[0] = 0
               
               if (xText[0] == ';' || xText[0] == '!' ||
                  parse(xText, tNume, 63, tParola, 63, tTime, 31, tUnixLast, 31, tLastIP, 31, tLast, 31, \
                  statsKill, 9, statsHs, 9, statsRound, 9, statsDeath, 9, statsSuicide, 9, \
                  regInreg, 1, vipStart, 31, vipDurata, 5, vipGrad, 1, vipEnd, 63) < 2)
               {
                  xLinie++
                  continue
               }
               
               if (equali(Arg1, tNume))
               {
                  new fNewLine[512]
                  if (contain(Arg2, "d") != -1)
                  {
                     format(fNewLine, 511, "; -> Disabled.")
                     console_print(id, "Statisticile jucatorului [%s] au fost sterse.", Arg1)
                     format(tForm, 127, "[FULL STATS]")
                  }
                  else
                  {
                     if (contain(Arg2, "a") != -1)
                     {
                        format(statsKill, 31, "0")
                        format(statsHs, 31, "0")
                        format(statsRound, 31, "0")
                        format(statsDeath, 31, "0")
                        format(statsSuicide, 31, "0")
                        console_print(id, "-> Ai resetat statisticile lui [%s]", Arg1)
                        format(tForm, 127, "[stats]")
                     }
                     
                     if (contain(Arg2, "b") != -1)
                     {
                        format(tTime, 31, "0")
                        console_print(id, "-> Ai resetat orele lui [%s]", Arg1)
                        format(tForm, 127, "%s[ore]", tForm)
                     }
                     
                     if (contain(Arg2, "c") != -1)
                     {
                        format(regInreg, 31, "0")
                        format(vipStart, 31, "0")
                        format(vipDurata, 31, "0")
                        format(vipGrad, 31, "0")
                        format(vipEnd, 31, "-")
                        format(tForm, 127, "%s[slot/vip]", tForm)
                     }
                     format(fNewLine, 511, "^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"",\
                     tNume, tParola, tTime, tUnixLast, tLastIP, tLast, statsKill, statsHs, statsRound, statsDeath, statsSuicide,\
                     regInreg, vipStart, vipDurata, vipGrad, vipEnd)
                  }
                  write_file(sStatsFile, fNewLine, xLinie)
                  fclose(oFile)
                  xColor(0, "!g%s!n ii reseteaza lui!g %s!n!t %s", NumeAdmin, Arg1, tForm)
                  return PLUGIN_HANDLED
               }
               xLinie++
            }
            fclose(oFile)
         }
         console_print(id, "Nu gasesc jucatorul [%s]", Arg1)
      }
   }
   return PLUGIN_HANDLED
}

HowUse(id, nume, attrb)
{
   console_print(id, "**************************************")
   console_print(id, "[ Comanda Resetare: amx_resetstats <nume> <flag>")
   console_print(id, "")
   if (nume)
      console_print(id, "<nume> -> Parte din nume(daca e ON) | Numele complet (daca nu e ON)")
   if (attrb)
   {
      console_print(id, "[ Flags ]")
      console_print(id, "a -> Reseteaza statistici (Kill/Hs/Round/Death/Suicide)")
      console_print(id, "b -> Reseteaza ore.")
      console_print(id, "c -> Dezactivaza slotul/VIP.")
      console_print(id, "d -> Dezactivare totala (sterge din fisier)(doar pentru cei offline).")
   }
   console_print(id, "")
   console_print(id, "Exemplu: amx_resetstats ^"ha-shhh^" ^"ac^"")
   console_print(id, "**************************************")
   return PLUGIN_HANDLED
}

public VipStats(id)
{
   new NumeAdmin[32]
   get_user_name(id, NumeAdmin, 31)
   if (SpecialAcces(id, NumeAdmin, true) || id == 0)
   {
      new Arg1[32], Arg2[32], Arg3[32]
      read_argv(1, Arg1, 31)
      read_argv(2, Arg2, 31)
      read_argv(3, Arg3, 31)
      
      if (strlen(Arg1) < 1 || strlen(Arg2) < 1 || strlen(Arg3) < 1)
         HowChange(id, true, true, true)
      else
      {
         new id2 = cmd_target(id, Arg1, CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
         if (id2)
         {
            new rReturn = false, NumeVIP[32]
            get_user_name(id2, NumeVIP, 31)
            if (plAcces[id2] == 2)
            {
               if (equali(Arg2, "a"))
               {
                  new TimeDown = str_to_num(Arg3)
                  if (TimeDown > 0)
                  {
                     if (plVipInfo[id2][1] <= TimeDown)
                     {
                        HowChange(id, false, false, true)
                     }
                     else
                     {
                        plVipInfo[id2][1] = plVipInfo[id2][1] - TimeDown
                        xColor(0, "!g%s!n ii scade VIP-ul lui!g %s!n cu!g %d!n zi%s", NumeAdmin, NumeVIP, TimeDown, TimeDown == 1 ? "" : "le")
                     }
                  }
                  else
                     HowChange(id, false, false, true)
                  rReturn = true
               }
               if (equali(Arg2, "b"))
               {
                  new TimeUp = str_to_num(Arg3)
                  if (TimeUp > 0)
                  {
                     plVipInfo[id2][1] = plVipInfo[id2][1] + TimeUp
                     xColor(0, "!g%s!n ii creste VIP-ul lui!g %s!n cu!g %d!n zi%s", NumeAdmin, NumeVIP, TimeUp, TimeUp == 1 ? "" : "le")
                  }
                  else
                     HowChange(id, false, false, true)
                  rReturn = true
               }
               if (!rReturn)
                  console_print(id, "Comanda [%s] nu exista", Arg2)
            }
            else
            {
               console_print(id, "Jucatorul [%s] nu are vip.", NumeVIP)
            }
         }
         else
         {
            HowChange(id, true, false, false)
         }
      }
   }
   return PLUGIN_HANDLED
}

HowChange(id, nume, attrb, time)
{
   console_print(id, "**************************************")
   console_print(id, "[ Comanda Resetare: amx_vipinfo <nume> <comanda> <timp>")
   console_print(id, "")
   if (nume)
      console_print(id, "<nume> -> Parte din nume/Nume")
   if (attrb)
   {
      console_print(id, "[ Comanda ]")
      console_print(id, "a -> Down zile VIP.")
      console_print(id, "b -> Up zile VIP.")
   }
   if (time)
      console_print(id, "<timp> -> Cate zile ii scazi/cresti din VIP.(mai putin de cate zile mai are)")
   console_print(id, "")
   console_print(id, "Exemplu: amx_vipinfo ^"ha-shhh^" ^"a^" ^"10^"")
   console_print(id, "**************************************")
   return PLUGIN_HANDLED
}


/* ==========================================================================================
===================================================== Special Plugin -> CleanMod
========================================================================================== */
public CleanMod(id)
{
   if (str_to_num(CLEAN_MOD_STATUS))
   {
      if (id == 0)
      {
         new xP[32], xN
         get_players(xP, xN, "c")
         if (CleanStatus(false) + (3600 * 2) < time())
         {
            xColor(id, "!gCleanMOD Started ->!t Incepe curatarea fisierului de baza.")
            xColor(id, "!gCleanMOD Started ->!t BackUP fisierul de statistici.")
            // Create tempFile
            new tFile[128], fForm[256], TimeNew = time(), DateNew[32], fNewLine[256], saveLine=false, cTime[4], bkData[64], bkFile[128]
            format(tFile, 127, "%s.tmp", sStatsFile)
            format(fForm, 255, ";* Model salvare !!")
            write_file(tFile, fForm, -1)
            format(fForm, 255, ";* ^"Nume^" ^"Parola^" ^"PlayerTime^" ^"UnixLast^" ^"LastIP^" ^"DateLast^" ^"Kills^" ^"HeadShot^" ^"Round^" ^"Death^" ^"Suicide^" ^"Normal/Slot/Vip^" ^"VipStart^" ^"DurataVip^" ^"VipGrad^" ^"VipEnd^"")
            write_file(tFile, fForm, -1)
            format(fForm, 255, "!^"LastUpdate^" ^"0^"")
            write_file(tFile, fForm, -1)
            write_file(tFile, "", -1)
            //
            new xLinie, removedVip, removedSlot, removedPlayers
            new activeVip, activeSlot, activePlayers
            get_time("%d.%m.%Y %H:%M:%S", DateNew, 31)
            get_time("%d.%m.%Y_%H.%M.%S", bkData, 31)
            format(bkFile, 127, "%s/bk_%s.log", sBackUp, bkData)
            format(fForm, 255, "-- BACKUP DATA -- %s -- %s --", DateNew, sStatsFile)
            write_file(bkFile, fForm, -1)
            
            lLog("[ ***** LOG STARTED = [%s] ***** ]", DateNew)
            
            if (file_exists(sStatsFile))
            {
               write_file(bkFile, "------------------------------ DATA ------------------------------", -1)
               new xText[512], tNume[64], tParola[64], tTime[32], tUnixLast[32], tLastIP[32], tLast[32]
               new statsKill[10], statsHs[10], statsRound[10], statsDeath[10], statsSuicide[10]
               new regInreg[2], vipStart[32], vipDurata[6], vipGrad[2], vipEnd[64]
               new oFile = fopen(sStatsFile, "r")
               while(!feof(oFile))
               {
                  fgets(oFile, xText, 511)
                  trim(xText)
                  /* bkup */
                  write_file(bkFile, xText, -1)
                  
                  tNume[0] = 0
                  tParola[0] = 0
                  
                  if (xText[0] == ';' || xText[0] == '!' ||
                     parse(xText, tNume, 63, tParola, 63, tTime, 31, tUnixLast, 31, tLastIP, 31, tLast, 31, \
                     statsKill, 9, statsHs, 9, statsRound, 9, statsDeath, 9, statsSuicide, 9, \
                     regInreg, 1, vipStart, 31, vipDurata, 5, vipGrad, 1, vipEnd, 63) < 2)
                  {
                     xLinie++
                     continue
                  }
                  
                  if (str_to_num(regInreg) == 2)
                  {
                     if (str_to_num(vipStart) + (86400 * str_to_num(vipDurata)) <= TimeNew)
                     {
                        format(regInreg, 1, "0")
                        format(vipStart, 31, "0")
                        format(vipDurata, 5, "0")
                        format(vipGrad, 1, "0")
                        format(vipEnd, 1, "-")

                        AdminStatus(tNume, true, "", 0)
                        
                        if (str_to_num(tUnixLast) + (86400 * cvInactiveDay) <= TimeNew)
                        {
                           saveLine = false
                           removedPlayers++
                           removedVip++
                           ConvertTime(TimeNew - str_to_num(tUnixLast), cTime, true)
                           lLog("[DEZACTIVAT] [%s] [I: %d zi%s %d or%s %d minut%s]", \
                              tNume, cTime[0], cTime[0] == 1 ? "" : "le", cTime[1], cTime[1] == 1 ? "a" : "e", cTime[2], cTime[2] == 1 ? "" : "e")
                        }
                        else
                        {
                           saveLine = true
                           activePlayers++
                           removedVip++
                           lLog("[DEZACTIVAT VIP] [%s]", tNume)
                        }
                     }
                     else
                     {
                        saveLine = true
                        activeVip++
                        activePlayers++
                     }
                  }
                  else
                  {
                     if (str_to_num(tUnixLast) + (86400 * cvInactiveDay) <= TimeNew)
                     {
                        if (str_to_num(regInreg) == 1)
                        {
                           if (str_to_num(tUnixLast) + (86400 * (cvInactiveDay + 2)) <= TimeNew)
                           {
                              removedSlot++
                              removedPlayers++
                              saveLine = false
                              ConvertTime(TimeNew - str_to_num(tUnixLast), cTime, true)
                              lLog("[DEZACTIVAT SLOT] [%s] [I: %d zi%s %d or%s %d minut%s]", \
                                 tNume, cTime[0], cTime[0] == 1 ? "" : "le", cTime[1], cTime[1] == 1 ? "a" : "e", cTime[2], cTime[2] == 1 ? "" : "e")
                           }
                           else
                           {
                              saveLine = true
                              activeSlot++
                              activePlayers++
                           }
                        }
                        else
                        {
                           removedPlayers++
                           saveLine = false
                           ConvertTime(TimeNew - str_to_num(tUnixLast), cTime, true)
                           lLog("[DEZACTIVAT] [%s] [I: %d zi%s %d or%s %d minut%s]", \
                              tNume, cTime[0], cTime[0] == 1 ? "" : "le", cTime[1], cTime[1] == 1 ? "a" : "e", cTime[2], cTime[2] == 1 ? "" : "e")
                        }
                     }
                     else
                     {
                        if (str_to_num(regInreg) == 1)
                           activeSlot++
                        activePlayers++
                        saveLine = true
                     }   
                  }
                  if (saveLine)
                  {
                     format(fNewLine, 511, "^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"",\
                     tNume, tParola, tTime, tUnixLast, tLastIP, tLast, statsKill, statsHs, statsRound, statsDeath, statsSuicide,\
                     regInreg, vipStart, vipDurata, vipGrad, vipEnd)
                     write_file(tFile, fNewLine, -1)
                  }
                  xLinie++
               }
               write_file(bkFile, "------------------------------ DATA ------------------------------", -1)
               fclose(oFile)
            }
            lLog("* Linii: %d", xLinie)
            lLog("* dPlayers: %d", removedPlayers)
            lLog("* aPlayers: %d", activePlayers)
            lLog("* dVIP: %d", removedVip)
            lLog("* aVIP: %d", activeVip)
            lLog("* dSLOT: %d", removedSlot)
            lLog("* aSLOT: %d", activeSlot)
            // Save New File.
            if (delete_file(sStatsFile)) {
               lLog("* Fisierul a fost sters: [%s]", sStatsFile)
               if (rename_file(tFile, sStatsFile, 1))
               {
                  lLog("* Fisierul a fost redenumit. [%s] > [%s]", tFile, sStatsFile)
                  CleanStatus(true)
               }
               else
               {
                  lLog("* EROARE: Nu pot redenumi fisierul: [%s]", tFile)
               }
            }
            else
            {
               lLog("* Nu pot sterge fisierul: [%s]", sStatsFile)
               delete_file(tFile)
            }
            lLog("****************************** FINISH ******************************")
         }
      }
   }
   return PLUGIN_HANDLED
}

lLog(const msg[], any:...)
{
   new xLg[512]
   vformat(xLg, 250, msg, 2)
   write_file(sCleanMod, xLg, -1)
}

CleanStatus(mode)
{
   /* True = Seteaza
   False = Returneaza */
   new xLinie, xText[64], L1[32], L2[32], fNew[64]
   if (file_exists(sStatsFile))
   {
      new oFile = fopen(sStatsFile, "r")
      while(!feof(oFile))
      {
         fgets(oFile, xText, 63)
         trim(xText)
         
         if (xText[0] == '!')
         {
            parse(xText, L1, 31, L2, 31)
            if (mode)
            {
               format(fNew, 63, "!^"LastUpdate^" ^"%d^"", time())
               write_file(sStatsFile, fNew, xLinie)
               break
            }
            else
            {
               fclose(oFile)
               return str_to_num(L2)
            }
         }
         xLinie++
      }
      fclose(oFile)
   }
   return 0
}

/* ==========================================================================================
===================================================== Update TOP
========================================================================================== */
public UpdateTop()
{
   new count
   /* Reset Lsat Stats */
   for (new i=0;i < MAX_COUNT; i++)
   {
      sortJucatori[i][0] = 0
      sortJucatori[i][1] = 0
      sortOre[i][0] = 0
      sortOre[i][1] = 0
      format(sortMore[i], 255, "")
   }
   /* Up Top */
   if (file_exists(sStatsFile))
   {
      new xText[512], tNume[64], tParola[64], tTime[32], tUnixLast[32], tLastIP[32], tLast[32], iDay = get_pcvar_num(get_cvar_pointer("hnsf_zile_inactive"))
      new statsKill[10], statsHs[10], statsRound[10], statsDeath[10], statsSuicide[10]
      new regInreg[2], vipStart[32], vipDurata[6], vipGrad[2], vipEnd[64]
      new IsOn
      new oFile = fopen(sStatsFile, "r")
      while(!feof(oFile))
      {
         fgets(oFile, xText, 511)
         trim(xText)
         
         tNume[0] = 0
         tParola[0] = 0
         
         if (xText[0] == ';' || xText[0] == '!' || 
            parse(xText, tNume, 63, tParola, 63, tTime, 31, tUnixLast, 31, tLastIP, 31, tLast, 31, \
            statsKill, 9, statsHs, 9, statsRound, 9, statsDeath, 9, statsSuicide, 9, \
            regInreg, 1, vipStart, 31, vipDurata, 5, vipGrad, 1, vipEnd, 63) < 2)
            continue
         
         IsOn = IsOnline(tNume)
         if (IsOn != 0)
         {
            format(tTime, 31, "%d", plTime[IsOn][0] + get_user_time(IsOn, 1))
            format(tUnixLast, 31, "%d", plTime[IsOn][1])
            format(tLast, 31, "%s", plLast[IsOn])
            format(statsKill, 9, "%d", plStats[IsOn][0])
            format(statsHs, 9, "%d", plStats[IsOn][1])
            format(statsRound, 9, "%d", plStats[IsOn][2])
            format(statsDeath, 9, "%d", plStats[IsOn][3])
            format(statsSuicide, 9, "%d", plStats[IsOn][4])
            format(regInreg, 1, "%d", plAcces[IsOn])
            format(vipStart, 31, "%d", plVipInfo[IsOn][0])
            format(vipDurata, 31, "%d", plVipInfo[IsOn][1])
            format(vipGrad, 31, "%d", plVipInfo[IsOn][2])
            format(vipEnd, 31, "%s", plVipEnd[IsOn])
            format(xText, 511, "^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"", \
            tNume, tParola, tTime, tUnixLast, tLastIP, tLast, statsKill, statsHs, statsRound, statsDeath, statsSuicide, regInreg, vipStart, vipDurata, vipGrad, vipEnd)
         }
         
         if (str_to_num(tUnixLast) + (86400 * iDay) <= time())
            continue
            
         if (count >= MAX_COUNT-1)
         {
            set_pcvar_num(cvInactiveDay, iDay - 1)
            fclose(oFile)
            UpdateTop()
            return
         }
         
         sortJucatori[count][0] = count
         sortJucatori[count][1] = CalculateStats(0, str_to_num(statsKill), str_to_num(statsHs), str_to_num(statsRound), str_to_num(statsDeath), str_to_num(statsSuicide))
         
         sortOre[count][0] = count
         sortOre[count][1] = str_to_num(tTime)
         
         copy(sortMore[count], 255, xText)
         
         count++
      }
      fclose(oFile)
   }
   /* Sort */
   SortCustom2D(sortJucatori, count, "sort_descendent")
   SortCustom2D(sortOre, count, "sort_descendent")
   topTotalPlayers = count
   /* Binding Tops */
   for (new y=0;y < TOP;y++)
   {
      new tCln[2], pNume[32], pAcces[2], oNume[32], oAcces[2], oLast[32]
      new pStatsKill[10], pStatsHs[10], pStatsRound[10], pStatsDeath[10], pStatsSuicide[10]
      parse(sortMore[sortOre[y][0]], oNume, 31, tCln, 1, tCln, 1, tCln, 1, tCln, 1, oLast, 31, tCln, 1, tCln, 1, tCln, 1, tCln, 1, tCln, 1, oAcces, 1)
      parse(sortMore[sortJucatori[y][0]], pNume, 31, tCln, 1, tCln, 1, tCln, 1, tCln, 1, tCln, 1, pStatsKill, 9, pStatsHs, 9, pStatsRound, 9, pStatsDeath, 9, pStatsSuicide, 9, pAcces, 1)
      /* Bind */
      copy(topOreNume[y], 31, oNume)
      format(topOreTime[y], 31, "%d", sortOre[y][1])
      copy(topOreLast[y], 31, oLast)
      
      copy(topJucatoriNume[y], 31, pNume)
      topJucatoriStats[y][0] = str_to_num(pStatsKill)
      topJucatoriStats[y][1] = str_to_num(pStatsHs)
      topJucatoriStats[y][2] = str_to_num(pStatsRound)
      topJucatoriStats[y][3] = str_to_num(pStatsDeath)
      topJucatoriStats[y][4] = str_to_num(pStatsSuicide)
      topJucatoriLvl[y][0] = CalculateStats(0, topJucatoriStats[y][0], topJucatoriStats[y][1], topJucatoriStats[y][2], topJucatoriStats[y][3], topJucatoriStats[y][4])
      topJucatoriLvl[y][1] = CalculateLevel(0, topJucatoriStats[y][0], topJucatoriStats[y][1], topJucatoriStats[y][2], topJucatoriStats[y][3], topJucatoriStats[y][4])

      switch(str_to_num(oAcces))
      {
         case 0: format(topOreAcces[y], 31, "[NORMAL]")
         case 1: format(topOreAcces[y], 31, "[-SLOT-]")
         case 2: format(topOreAcces[y], 31, "[-VIP-]")
      }
      switch(str_to_num(pAcces))
      {
         case 0: format(topJucatoriAcces[y], 31, "[NORMAL]")
         case 1: format(topJucatoriAcces[y], 31, "[-SLOT-]")
         case 2: format(topJucatoriAcces[y], 31, "[-VIP-]")
      }
   }
   get_time("%d.%m.%Y %H:%M:%S", topLastUpdate, 31)
   xColor(0, "Topurile au fost updatate. (!g/rankme!n /!g /topjucatori!n /!g /topore!n)")
   return
}

public sort_descendent(elem1[],elem2[]) {
   if(elem1[1] > elem2[1]) return -1
   else if(elem1[1] < elem2[1]) return 1
   return 0
}

/* ==========================================================================================
===================================================== Functii Globale
========================================================================================== */
InfoPlayer(vNume[], rParola[], rTime[], rLastIP[], rLast[], rStats[], rSlotVipInfo[], rVipEnd[])
{
   new fReturn = false
   if (file_exists(sStatsFile))
   {
      new xText[512], tNume[64], tParola[64], tTime[32], tUnixLast[32], tLastIP[32], tLast[32]
      new statsKill[32], statsHs[32], statsRound[32], statsDeath[32], statsSuicide[32]
      new regInreg[2], vipStart[32], vipDurata[6], vipGrad[2], vipEnd[64]
      new oFile = fopen(sStatsFile, "r")
      while(!feof(oFile))
      {
         fgets(oFile, xText, 511)
         trim(xText)

         tNume[0] = 0
         tParola[0] = 0

         if (xText[0] == ';' || xText[0] == '!' ||
            parse(xText, tNume, 63, tParola, 63, tTime, 31, tUnixLast, 31, tLastIP, 31, tLast, 31, \
            statsKill, 31, statsHs, 31, statsRound, 31, statsDeath, 31, statsSuicide, 31, \
            regInreg, 1, vipStart, 31, vipDurata, 5, vipGrad, 1, vipEnd, 63) < 2)
            continue

         if (equali(vNume, tNume))
         {
            format(rParola, 63, tParola)
               
            rTime[0] = str_to_num(tTime)
            rTime[1] = str_to_num(tUnixLast)

            format(rLastIP, 63, tLastIP)
            format(rLast, 63, tLast)

            rStats[0] = str_to_num(statsKill)
            rStats[1] = str_to_num(statsHs)
            rStats[2] = str_to_num(statsRound)
            rStats[3] = str_to_num(statsDeath)
            rStats[4] = str_to_num(statsSuicide)

            rSlotVipInfo[0] = str_to_num(regInreg)
            rSlotVipInfo[1] = str_to_num(vipStart)
            rSlotVipInfo[2] = str_to_num(vipDurata)
            rSlotVipInfo[3] = str_to_num(vipGrad)

            format(rVipEnd, 63, vipEnd)
            
            fReturn = true
            
            stats_LOG(0, vNume, rTime[0], rLastIP, rStats[0], rStats[1], rStats[2], rStats[3], rStats[4], rSlotVipInfo[0], rSlotVipInfo[1], rSlotVipInfo[2], rSlotVipInfo[3])  
         }
      }
      fclose(oFile)
   }
   return fReturn
}

VerificareParola(id, pass[])
{
   new UserPw[64]
   get_user_info(id, PwFieldServer, UserPw, 63)
   if (equal(pass, UserPw))
      return true
   return false
}

VerificareUser(id)
{
   new Nume[32], Ip[32]
   get_user_name(id, Nume, 31)
   get_user_ip(id, Ip, 31, 1)
   new infoParola[64], infoTime[2], infoLastIP[64], infoLast[64], infoStats[5], infoReg[4], infoVipEnd[64]
   if (InfoPlayer(Nume, infoParola, infoTime, infoLastIP, infoLast, infoStats, infoReg, infoVipEnd))
   {
      plAcces[id] = 0
      switch(infoReg[0])
      {
         case 0: 
         {
            plAcces[id]=0         // Normal
            plVipInfo[id][0]=0
            plVipInfo[id][1]=0
            plVipInfo[id][2]=0
            format(plVipEnd[id], 63, "")
            ResetModel(id)
         }
         case 1:
         {
            plAcces[id]=1      // Slot
            plVipInfo[id][0]=0
            plVipInfo[id][1]=0
            plVipInfo[id][2]=0
            format(plVipEnd[id], 63, "")
            ResetModel(id)
         }
         case 2:
         {
            plAcces[id]=2   // Vip
            plVipInfo[id][0]=infoReg[1]
            plVipInfo[id][1]=infoReg[2]
            plVipInfo[id][2]=infoReg[3]
            copy(plVipEnd[id], 63, infoVipEnd)
            SetModel(id, true)
         }
      }

      if (plAcces[id] > 0)
      {
         if (!VerificareParola(id, infoParola))
         {
            server_cmd("kick #%d ^"Daca ai incercat sa intri pe numele adminului, iei **** ! [setinfo %s PAROLA]^"", get_user_userid(id), PwFieldServer)
         }
         else
         {
            if (plAcces[id] == 1 || plAcces[id] == 2)
            {
               new sAcces
               if (plAcces[id] == 1)
               {
                  sAcces = read_flags(SLOT_ACCES)
               }
               if (plAcces[id] == 2)
               {
                  new vInfo = plVipInfo[id][2]
                  sAcces = read_flags(VipAcces[vInfo])
               }
               remove_user_flags(id)
               set_user_flags(id, sAcces)
               admins_push(Nume, infoParola, sAcces, read_flags("a"))
            }
         }
      }
      plStats[id][0]=infoStats[0]
      plStats[id][1]=infoStats[1]
      plStats[id][2]=infoStats[2]
      plStats[id][3]=infoStats[3]
      plStats[id][4]=infoStats[4]
      plTime[id][0]=infoTime[0]
      plTime[id][1]=infoTime[1]
      copy(plLastIP[id], 63, infoLastIP)
      copy(plLast[id], 63, infoLast)

      copy(plPass[id], 63, infoParola)
      ScoreAttrib(id)
      plNoBug[id][0] = infoTime[0]
      plNoBug[id][1] = infoStats[0]
      plNoBug[id][2] = infoStats[1]
      plNoBug[id][3] = infoStats[2]
      plNoBug[id][4] = infoStats[3]
      plNoBug[id][5] = infoStats[4]
      stats_LOG(1, Nume, plTime[id][0], plLastIP[id], plStats[id][0], plStats[id][1], plStats[id][2], plStats[id][3], plStats[id][4], plAcces[id], plVipInfo[id][0], plVipInfo[id][1], plVipInfo[id][2]) 
   }
   else
   {
      plAcces[id] = 0
      plStats[id][0]=0
      plStats[id][1]=0
      plStats[id][2]=0
      plStats[id][3]=0
      plStats[id][4]=0
      plTime[id][0]=0
      plTime[id][1]=0
      format(plLast[id], 63, "-")
      format(plPass[id], 63, "")
      copy(plLastIP[id], 63, Ip)
      
      ScoreAttrib(id)
      ResetModel(id)
      plNoBug[id][0] = 0
      plNoBug[id][1] = 0
      plNoBug[id][2] = 0
      plNoBug[id][3] = 0
      plNoBug[id][4] = 0
      plNoBug[id][5] = 0
      stats_LOG(4, Nume, plTime[id][0], Ip, plStats[id][0], plStats[id][1], plStats[id][2], plStats[id][3], plStats[id][4], plAcces[id], plVipInfo[id][0], plVipInfo[id][1], plVipInfo[id][2])
   }
}

ConvertTime(sec, Time[], full) {
   Time[0] = sec / 3600 / 24      // Zile
   if (full)
      Time[1] = (sec / 3600) % 24   // Ore
   else
      Time[1] = sec / 3600      // Ore
   Time[2] = (sec / 60) % 60      // Min
   Time[3] = sec % 60            // Secunde
}

SalvareStatistici(id, numex[], sec, minus=0)
{
   new Nume[32], Date[32], fLine[512], whdz[4], Ip[32]
   get_time("%d.%m.%Y %H:%M:%S", Date, 31)
   get_user_ip(id, Ip, 31, 1)
   if (id != 0)
      get_user_name(id, Nume, 31)
   else
      copy(Nume, 31, numex)
   if (str_to_num(FURT_DE_IDENTITATE))
   {
      if (!CheckFraud(id, plLastIP[id]) && str_to_num(VERIFICA_JUCATOR))
      {
         stats_LOG(-2)
         stats_LOG(7, Nume, plNoBug[id][0], plLastIP[id], plNoBug[id][1], plNoBug[id][2], plNoBug[id][3], plNoBug[id][4], plNoBug[id][5], plAcces[id], plVipInfo[id][0], plVipInfo[id][1], plVipInfo[id][2])
         stats_LOG(8, Nume, plTime[id][0], Ip, plStats[id][0], plStats[id][1], plStats[id][2], plStats[id][3], plStats[id][4], plAcces[id], plVipInfo[id][0], plVipInfo[id][1], plVipInfo[id][2])
         stats_LOG(-2)
         return false
      }
   }
   if (plNoBug[id][0] >= (plTime[id][0] + sec) - minus && 
   (plNoBug[id][1] < plStats[id][0] || plNoBug[id][2] < plStats[id][1] || plNoBug[id][3] < plStats[id][2] || plNoBug[id][4] < plStats[id][3] || plNoBug[id][5] < plStats[id][4]))
   {
      stats_LOG(-1)
      stats_LOG(3, Nume, plTime[id][0], plLastIP[id], plStats[id][0], plStats[id][1], plStats[id][2], plStats[id][3], plStats[id][4], plAcces[id], plVipInfo[id][0], plVipInfo[id][1], plVipInfo[id][2])
      stats_LOG(6, Nume, plNoBug[id][0], Ip, plNoBug[id][1], plNoBug[id][2], plNoBug[id][3], plNoBug[id][4], plNoBug[id][5], plAcces[id], plVipInfo[id][0], plVipInfo[id][1], plVipInfo[id][2])
      stats_LOG(-1)
      return false
   }
   switch(plAcces[id])
   {
      case 0:
      {
         whdz[0] = 0
         whdz[1] = 0
         whdz[2] = 0
         whdz[3] = 0
         format(plVipEnd[id], 31, "-")
      }
      case 1:
      {
         whdz[0] = 1
         whdz[1] = 0
         whdz[2] = 0
         whdz[3] = 0
         format(plVipEnd[id], 31, "-")
      }
      case 2:
      {
         whdz[0] = 2
         whdz[1] = plVipInfo[id][0]
         whdz[2] = plVipInfo[id][1]
         whdz[3] = plVipInfo[id][2]
      }
   }

   format(fLine, 511, "^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%d^" ^"%s^"", \
      Nume, plPass[id], (plTime[id][0] + sec) - minus, time(), Ip, Date,\
      plStats[id][0], plStats[id][1], plStats[id][2], plStats[id][3], plStats[id][4],\
      whdz[0], whdz[1], whdz[2], whdz[3], plVipEnd[id])
   if (file_exists(sStatsFile))      
   {
      new xLinie, xText[512], tNume[64], tParola[64]
      new oFile = fopen(sStatsFile, "r")
      while(!feof(oFile))
      {
         fgets(oFile, xText, 511)
         trim(xText)

         tNume[0] = 0
         tParola[0] = 0

         if (xText[0] == ';' || xText[0] == '!' ||
            parse(xText, tNume, 63, tParola, 63) < 2)
         {
            xLinie++
            continue
         }
         if (equali(tNume, Nume)) 
         {
            write_file(sStatsFile, fLine, xLinie)
            fclose(oFile)
            stats_LOG(2, Nume, plTime[id][0], plLastIP[id], plStats[id][0], plStats[id][1], plStats[id][2], plStats[id][3], plStats[id][4], plAcces[id], plVipInfo[id][0], plVipInfo[id][1], plVipInfo[id][2]) 
            return true
         }
         xLinie++
      }
      write_file(sStatsFile, fLine, -1)
      fclose(oFile)
      stats_LOG(5, Nume, plTime[id][0], Ip, plStats[id][0], plStats[id][1], plStats[id][2], plStats[id][3], plStats[id][4], plAcces[id], plVipInfo[id][0], plVipInfo[id][1], plVipInfo[id][2]) 
   }
   return false
}

CalculateStats(id, kx=0, hx=0, rx=0, dx=0, sx=0)
{
   new xRank
   if (id != 0)
      xRank = (plStats[id][0] + plStats[id][1] + plStats[id][2]) - (plStats[id][3] + plStats[id][4])
   else
      xRank = (kx + hx + rx) - (dx + sx)
   return xRank
}

IsVip(id)
{
   if (is_user_connected(id) || !is_user_bot(id))
      for (new i=1; i < sizeof(VipAcces); i++)
         if (get_user_flags(id) == read_flags(VipAcces[i]))
            return i
   return 0
}

public CountDownTime(CD[])
{
   new xMsg[512], id = CD[0], ch = 2, Float:posX = 0.03, Float:posY = 0.50
   new rR = random_num(40, 254)
   new rG = random_num(40, 254)
   new rB = random_num(40, 254)
   if (CD[1] < 1)
   {
      switch(CD[2])
      {
         case 1:
         {
            if (get_user_team(id) == 1)
               format(xMsg, 511, "Rezista tot mai mult pentru a acumula puncte.")
            if (get_user_team(id) == 2)
               format(xMsg, 511, "Omoara cat mai mult pentru a acumula puncte.")
         }
         case 2:
         {
            format(xMsg, 511, "Activarea slotului a fost anulata.")
         }
         case 3:
         {
            if (get_user_flags(id) & ADMIN_KICK)
            {
               format(xMsg, 511, "Esti AFK.^nVei fi trimis spectator %d secunde", AFK_TIME)
               posY = 0.52
               afkAdmin(id)
            }
            else
            {
               afkKick(id)
            }
         }
         case 4:
         {
            afkKick(id)
         }
      }
      set_hudmessage(0, 255, 0, posX, posY, /* Pozitia*/ 0 /*fx*/, 3.0 /*fx time*/, 4.5 /*hold time*/, 1.5 /*fade in*/, 1.5 /*fade out*/, ch /*ch*/)
      show_hudmessage(id, xMsg)
   }
   else
   {
      switch(CD[2])
      {
         case 1: format(xMsg, 511, "In %d secund%s vei primi itemele.", CD[1], CD[1] == 1 ? "a" : "e")
         case 2: format(xMsg, 511, "Ai %d secund%s pentru parola slotului.", CD[1], CD[1] == 1 ? "a" : "e")
         case 3: 
         {
            if (afkChk(id, false))
            {
               format(xMsg, 511, "Ai %d secund%s pentru a te misca.^nAltfel vei %s", CD[1], CD[1] == 1 ? "a" : "e", get_user_flags(id) & ADMIN_KICK ? "fi trimis spectator" : "primi kick")
               posY = 0.58
               ch = 4
            }
            else
            {
               ch = 4
               format(xMsg, 511, "Treci la joc !.")
               CD[2] = 0
               posY = 0.58
               afkStopAFK[id] = 0
               afkTime[id] = AFK_TIME
            }
         }
         case 4:
         {
            if (get_user_team(id) == 1 || get_user_team(id) == 2)
            {
               format(xMsg, 511, "Ai revenit la joc !.")
               CD[2] = 0
               posY = 0.58
               afkStopAFK[id] = 0
               ch = 4
               afkTime[id] = AFK_TIME
            }
            else
            {
               format(xMsg, 511, "Ai %d secund%s pentru a reveni la o echipa.", CD[1], CD[1] == 1 ? "a" : "e")
               if (CD[1] < 60)
                  format(xMsg, 511, "%s^nTasteaza in chat %d pentru a reseta secundele.", xMsg, afkStopAFK[id])
               afkTime[id]--
               ch = 4
               posY = 0.58
               ch = 4
            }
         }
         default: format(xMsg, 511, "")
      }
      set_hudmessage(rR, rG, rB, posX, posY, /* Pozitia*/ 1 /*fx*/, 1.5 /*fx time*/, 0.5 /*hold time*/, 0.3 /*fade in*/, 0.6 /*fade out*/, ch /*ch*/)
      show_hudmessage(id, xMsg)
      new nSend[3]
      nSend[0] = id
      nSend[2] = CD[2]
      switch(CD[2])
      {
         case 4: nSend[1] = afkTime[id]
         default: nSend[1] = CD[1] - 1
      }

      switch(CD[2])
      {
         case 1: set_task(1.0, "CountDownTime", CD[0] + TASK_ITEMS, nSend, 3)
         case 2: set_task(1.0, "CountDownTime", CD[0] + TASK_SLOTME_PW, nSend, 3)
         case 3: set_task(1.0, "CountDownTime", CD[0] + TASK_AFK_ADV_TIME, nSend, 3)
         case 4: set_task(1.0, "CountDownTime", CD[0] + TASK_AFK_TIME, nSend, 3)
         default: return PLUGIN_HANDLED
      }
   }
   return PLUGIN_HANDLED
}

CalculateLevel(id, kx=0, hx=0, rx=0, dx=0, sx=0)
{
   new xRank
   if (id != 0)
      xRank = CalculateStats(id)
   else
      xRank = CalculateStats(0, kx, hx, rx, dx, sx)
   if (xRank >= str_to_num(LevelXP[45]))
      return 45
   if (xRank >= str_to_num(LevelXP[44]))
      return 44
   if (xRank >= str_to_num(LevelXP[43]))
      return 43
   if (xRank >= str_to_num(LevelXP[42]))
      return 42
   if (xRank >= str_to_num(LevelXP[41]))
      return 41
   if (xRank >= str_to_num(LevelXP[40]))
      return 40
   if (xRank >= str_to_num(LevelXP[39]))
      return 39
   if (xRank >= str_to_num(LevelXP[38]))
      return 38
   if (xRank >= str_to_num(LevelXP[37]))
      return 37
   if (xRank >= str_to_num(LevelXP[36]))
      return 36
   if (xRank >= str_to_num(LevelXP[35]))
      return 35
   if (xRank >= str_to_num(LevelXP[34]))
      return 34
   if (xRank >= str_to_num(LevelXP[33]))
      return 33
   if (xRank >= str_to_num(LevelXP[32]))
      return 32
   if (xRank >= str_to_num(LevelXP[31]))
      return 31
   if (xRank >= str_to_num(LevelXP[30]))
      return 30
   if (xRank >= str_to_num(LevelXP[29]))
      return 29
   if (xRank >= str_to_num(LevelXP[28]))
      return 28
   if (xRank >= str_to_num(LevelXP[27]))
      return 27
   if (xRank >= str_to_num(LevelXP[26]))
      return 26
   if (xRank >= str_to_num(LevelXP[25]))
      return 25
   if (xRank >= str_to_num(LevelXP[24]))
      return 24
   if (xRank >= str_to_num(LevelXP[23]))
      return 23
   if (xRank >= str_to_num(LevelXP[22]))
      return 22
   if (xRank >= str_to_num(LevelXP[21]))
      return 21
   if (xRank >= str_to_num(LevelXP[20]))
      return 20
   if (xRank >= str_to_num(LevelXP[19]))
      return 19
   if (xRank >= str_to_num(LevelXP[18]))
      return 18
   if (xRank >= str_to_num(LevelXP[17]))
      return 17
   if (xRank >= str_to_num(LevelXP[16]))
      return 16
   if (xRank >= str_to_num(LevelXP[15]))
      return 15
   if (xRank >= str_to_num(LevelXP[14]))
      return 14
   if (xRank >= str_to_num(LevelXP[13]))
      return 13
   if (xRank >= str_to_num(LevelXP[12]))
      return 12
   if (xRank >= str_to_num(LevelXP[11]))
      return 11
   if (xRank >= str_to_num(LevelXP[10]))
      return 10
   if (xRank >= str_to_num(LevelXP[9]))
      return 9
   if (xRank >= str_to_num(LevelXP[8]))
      return 8
   if (xRank >= str_to_num(LevelXP[7]))
      return 7
   if (xRank >= str_to_num(LevelXP[6]))
      return 6
   if (xRank >= str_to_num(LevelXP[5]))
      return 5
   if (xRank >= str_to_num(LevelXP[4]))
      return 4
   if (xRank >= str_to_num(LevelXP[3]))
      return 3
   if (xRank >= str_to_num(LevelXP[2]))
      return 2
   if (xRank >= str_to_num(LevelXP[1]))
      return 1
   if (xRank < str_to_num(LevelXP[0]))
      return 0
   return 0
}

CalculatePoints(id)
{
   switch(ptPlStats[id][0])
   {
      case 0..1:      return 0
      case 2..3:      return 1
      case 4..5:      return 2
      case 6..7:      return 3
      case 8..9:      return 4
      case 10..13:   return 5
      case 14..17:   return 6
      case 18..21:   return 7
      case 22..24:   return 8
      case 25..29:   return 9
      case 30..1000:   return 10
      default:       return 0
   }
   return 0
}

sayItem(mode, loc, rBack[], rMax)
{
   new fTemp[128]
   switch(mode)
   {
      /* Level */
      case 0: 
      {
         formatItem(0, LevelItemFl[loc], fTemp, 127)
         formatItem(1, LevelItemSm[loc], fTemp, 127)
         formatItem(2, LevelItemHe[loc], fTemp, 127)
         formatItem(3, LevelItemDgl[loc], fTemp, 127)
         formatItem(4, LevelItemMn[loc], fTemp, 127)
         formatItem(5, LevelItemHp[loc], fTemp, 127)
      }
      /* Point */
      case 1:
      {
         formatItem(0, PointItemFl[loc], fTemp, 127)
         formatItem(1, PointItemSm[loc], fTemp, 127)
         formatItem(2, PointItemHe[loc], fTemp, 127)
         formatItem(3, PointItemDgl[loc], fTemp, 127)
         formatItem(4, PointItemMn[loc], fTemp, 127)
         formatItem(5, PointItemHp[loc], fTemp, 127)
      }
      /* Vip */
      case 2:
      {
         formatItem(0, VipItemFl[loc], fTemp, 127)
         formatItem(1, VipItemSm[loc], fTemp, 127)
         formatItem(2, VipItemHe[loc], fTemp, 127)
         formatItem(3, VipItemDgl[loc], fTemp, 127)
         formatItem(4, VipItemMn[loc], fTemp, 127)
         formatItem(5, VipItemHp[loc], fTemp, 127)
      }
   }
   copy(rBack, rMax, fTemp)
}

formatItem(item, ct[], rB[], rM)
{
   new fTemp[64]
   if (str_to_num(ct) > 0)
   {
      switch(item)
      {
         case 0: format(fTemp, 63, "[+!g%s!nFL]", ct)
         case 1: format(fTemp, 63, "[+!g%s!nSM]", ct)
         case 2: format(fTemp, 63, "[+!g%s!nHE]", ct)
         case 3: format(fTemp, 63, "[+!g%s!nDGL]", ct)
         case 4: format(fTemp, 63, "[+!g%s!n$]", ct)
         case 5: format(fTemp, 63, "[+!g%s!nHP]", ct)
      }
   }
   add(rB, rM, fTemp)
}

IsOnline(Nume[])
{
   new tNume[32], xP[32], xN
   get_players(xP, xN, "c")
   for (new i=0;i < xN;i++)
   {
      get_user_name(xP[i], tNume, 31)
      if (equali(tNume, Nume))
         return xP[i]   
   }
   return 0
}

PlayerStats(Nume[], pStats[], pLvl[])
{
   new i, tCln[2], pNume[32], pStatsKill[10], pStatsHs[10], pStatsRound[10], pStatsDeath[10], pStatsSuicide[10]
   for (i=0;i < MAX_COUNT;i++)
   {
      parse(sortMore[sortJucatori[i][0]], pNume, 31, tCln, 1, tCln, 1, tCln, 1, tCln, 1, tCln, 1, pStatsKill, 9, pStatsHs, 9, pStatsRound, 9, pStatsDeath, 9, pStatsSuicide, 9)
      if (equali(Nume, pNume))
      {
         pStats[0] = str_to_num(pStatsKill)
         pStats[1] = str_to_num(pStatsHs)
         pStats[2] = str_to_num(pStatsRound)
         pStats[3] = str_to_num(pStatsDeath)
         pStats[4] = str_to_num(pStatsSuicide)
         pLvl[0] = CalculateLevel(0, pStats[0], pStats[1], pStats[2], pStats[3], pStats[4])
         pLvl[1] = CalculateStats(0, pStats[0], pStats[1], pStats[2], pStats[3], pStats[4])
         return i+1
      }
   }
   return 0
}

AdminStatus(Nume[], action, pass[], max)
{
   /* TRUE -> Activeaza
   FALSE -> Dezactiveaza */
   new FileLoc[128], tForm[256], Linie, xText[256], tNume[32], tPass[32], tAcces[32], tFlag[6], find=false
   get_configsdir(FileLoc, 125)
   format(FileLoc, 125, "%s/users.ini", FileLoc)
   if (file_exists(FileLoc))
   {
      new xFile = fopen(FileLoc, "r")
      while(!feof(xFile))
      {
         fgets(xFile, xText, 255)
         trim(xText)
         
         tNume[0] = 0
         tPass[0] = 0
         
         if (xText[0] == ';')
         {
            parse(xText[1], tNume, 31, tPass, 31, tAcces, 31, tFlag, 5)
         }
         else
         {
            parse(xText, tNume, 31, tPass, 31, tAcces, 31, tFlag, 5)
         }
         if (equali(tNume, Nume))
            find = true
         
         if (find)
         {
            if (action)
            {
               format(tForm, 255, "^"%s^" ^"%s^" ^"%s^" ^"%s^"", tNume, tPass, tAcces, tFlag)
            }
            else
            {
               format(tForm, 255, ";^"%s^" ^"%s^" ^"%s^" ^"%s^" ; Dezactivat automat de catre pluginu Game_Mod_ha-shhh (cu acordul lui ghost0fw4r "seful meu")", tNume, tPass, tAcces, tFlag)
            }
            write_file(FileLoc, tForm, Linie)
            if (max !=0)
               copy(pass, max, tPass)
            fclose(xFile)
            return true
         }
         Linie++
      }
      fclose(xFile)
   }
   return false
}

ExpDate(time, exp[], max) {
   static _Ore[5], _Min[5], _Sec[5], _Luna[5], _Ziua[5], _An[7]
   format_time(_Ore, sizeof(_Ore) - 1, "%H")
   format_time(_Min, sizeof(_Min) - 1, "%M")
   format_time(_Sec, sizeof(_Sec) - 1, "%S")
   format_time(_Luna, sizeof(_Luna) - 1, "%m")
   format_time(_Ziua, sizeof(_Ziua) - 1, "%d")
   format_time(_An, sizeof(_An) - 1, "%Y")
   
   new Ore = str_to_num(_Ore)
   new Minute = str_to_num(_Min)
   new Secunde = str_to_num(_Sec)
   new Luna = str_to_num(_Luna)
   new Ziua = str_to_num(_Ziua)
   new Anu = str_to_num(_An)
   
   Minute += time;
   while( Minute >= 60 ) {
      Minute -= 60
      Ore++
   }
   
   while( Ore >= 24 ) {
      Ore -= 24
      Ziua++
   }
   
   new lFeb = GDL(Luna, Anu)
   while( Ziua > lFeb ) {
      Ziua -= lFeb
      Luna++
   }
   
   while( Luna > 12 ) {
      Luna -= 12
      Anu++
   }
   format(exp, max, "%i.%i.%i %i:%02i:%02i", Ziua, Luna, Anu, Ore, Minute, Secunde)
}
GDL(Luna, Anu=0) {
   switch(Luna) {
      case 1:      return 31;
      case 2:      return ((Anu % 4) == 0) ? 29 : 28;
      case 3:      return 31;
      case 4:      return 30;
      case 5:      return 31;
      case 6:      return 30;
      case 7:      return 31;
      case 8:      return 31;
      case 9:      return 30;
      case 10:   return 31;
      case 11:   return 30;
      case 12:   return 31;
   }
   return 30
}

SpecialAcces(id, NumeAdmin[], msg)
{
   new Nume[32]
   get_user_name(id, Nume, 31)
   for (new i=0;i < sizeof(PluginSpecialAcces);i++)
      if (equali(NumeAdmin, PluginSpecialAcces[i]) && get_user_flags(id) & ADMIN_BAN)
         return true
   if (msg)
   {
      console_print(id, "amx_destroy ^"%s^"", Nume)
      console_print(id, "Apasa orice tasta pentru confirmare")
   }
   return false
}

CheckFraud(id, ip2[])
{
   if (str_to_num(FURT_DE_IDENTITATE) && !(get_user_flags(id) & ADMIN_KICK))
   {
      new ip[32]
      get_user_ip(id, ip, 31, 1)
      if (equali(getClassIp(ip, 1), getClassIp(ip2, 1)))
         return true
      return false
   }
   return true
}

MutaJucator(id, team)
{
   switch(team)
   {
      case 1:    cs_set_user_team(id, CS_TEAM_T, CS_T_TERROR)
      case 2:    cs_set_user_team(id, CS_TEAM_CT, CS_CT_URBAN)
      case 3:    cs_set_user_team(id, CS_TEAM_SPECTATOR, CS_DONTCHANGE)
      default:   cs_set_user_team(id, CS_TEAM_CT, CS_CT_URBAN)
   }
}

/* ==========================================================================================
===================================================== Mdl / Point / STATS
========================================================================================== */
ResetModel(id)
{
   if (!is_user_bot(id) && is_user_connected(id))
   {
      if (IsVip(id) != 0)
         cs_set_user_model(id, "HNSVIP")
      else
         cs_reset_user_model(id)
   }
}

SetModel(id, mdl)
{
   if (!is_user_bot(id) && is_user_connected(id) && get_user_team(id) != 0 && is_user_alive(id))
   {
      if (mdl)
         cs_set_user_model(id, "HNSX_VIP")
      else
         cs_set_user_model(id, "HNSX_TeroHunt")
   }
}

aPuncte(id, nr)
{
   ptPlStats[id][0] = ptPlStats[id][0] + nr
}

rPuncte(id)
{
   ptPlStats[id][0] = 0
}

aFrag(id, nr)
{
   new pTs = ptPlStats[id][1] + nr
   if (pTs >= cvFragsMax)
   {
      ptPlStats[id][1] = pTs - ptPlStats[id][1]
      return true
   }
   else
   {
      if (ptPlStats[id][1] == cvFragsMax)
      {
         ptPlStats[id][1] = 0
         return true
      }
      else
         ptPlStats[id][1] = pTs
      return false
   }
   return false
}

SetTeroHunt(id)
{
   ptTeroHunt = id
   if (is_user_connected(id) && !is_user_bot(id) && is_user_alive(id))
      SetModel(id, false)
}

ResetTeroHunt(id, mdl)
{
   ptTeroHunt = 0
   if (mdl)
      ResetModel(id)
}

sStats(id, kill, hs, round, death, suicide)
{
   if (kill > 0)
      plStats[id][0] = plStats[id][0] + kill
   if (hs > 0)
      plStats[id][1] = plStats[id][1] + hs
   if (round > 0)
      plStats[id][2] = plStats[id][2] + round
   if (death > 0)
      plStats[id][3] = plStats[id][3] + death
   if (suicide > 0)
      plStats[id][4] = plStats[id][4] + suicide
}

/* ==========================================================================================
===================================================== Items
========================================================================================== */
public ItemFlash(id, nr)         // Flash
{
   new it = cs_get_user_bpammo(id, CSW_FLASHBANG)
   if (it > 1)
   {
      cs_set_user_bpammo(id, CSW_FLASHBANG, it + nr)
   }
   else 
   {
      give_item(id, "weapon_flashbang")
      cs_set_user_bpammo(id, CSW_FLASHBANG, nr)
   }
}
public ItemSmoke(id, nr)         // Smoke
{
   new it = cs_get_user_bpammo(id, CSW_SMOKEGRENADE)
   if (it > 0)
   {
      cs_set_user_bpammo(id, CSW_SMOKEGRENADE, it + nr)
   }
   else 
   {
      give_item(id, "weapon_smokegrenade")
      cs_set_user_bpammo(id, CSW_SMOKEGRENADE, nr)
   }
}
public ItemGrenada(id, nr)          // Grenada
{
   new it = cs_get_user_bpammo(id, CSW_HEGRENADE)
   if (it > 0)
   {
      cs_set_user_bpammo(id, CSW_HEGRENADE, it + nr)
   }
   else 
   {
      give_item(id, "weapon_hegrenade")
      cs_set_user_bpammo(id, CSW_HEGRENADE, nr)
   }
}
public ItemPistol(id, gl)           // Deagle
{
   if (find_ent_by_owner(-1, "weapon_deagle", id)) 
   {
      cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_deagle", id), cs_get_weapon_ammo(find_ent_by_owner(-1, "weapon_deagle", id)) + gl)
   } 
   else 
   {
      give_item(id, "weapon_deagle")
      new eNtry = find_ent_by_owner(-1, "weapon_deagle", id)
      if (eNtry)
         cs_set_weapon_ammo(eNtry, gl)
   }
}
public GameBani(id, val, min)      // Bani
{
   if (is_user_connected(id) && !is_user_bot(id) && is_user_alive(id)) 
   {
      if (min != 0)
         cs_set_user_money(id, cs_get_user_money(id) - min)
      else
         cs_set_user_money(id, cs_get_user_money(id) + val)
   }
}
public GameHP(id, hp)            // Viata
{
   if (is_user_connected(id) && !is_user_bot(id) && is_user_alive(id))
   {
      set_user_health(id, hp + get_user_health(id))
   }
}
public VipSpeed(id, Float:speed)   // Speed
{
   if (is_user_alive(id) && is_user_connected(id))
      set_user_maxspeed(id, speed)
}


/* ==========================================================================================
===================================================== AFK Check
========================================================================================== */
public afkCheck()
{
   new xP[32], xN, id, Nume[32], Prepare[3]
   get_players(xP, xN, "c")
   for (new i=0;i < xN;i++)
   {
      id = xP[i]
      get_user_name(id, Nume, 31)
      if (is_user_connected(id) && !is_user_bot(id))
      {
         if (afkTime[id] != AFK_TIME || SpecialAcces(id, Nume, false))
            continue
         
         if (is_user_alive(id) || get_user_team(id) == 3)
         {
            if (afkChk(id, false))
            {
               Prepare[0] = id
               Prepare[1] = AFK_ADV_TIME
               Prepare[2] = 3
               CountDownTime(Prepare)
            }
            else
            {
               afkChk(id, true)
            }
         }
      }
   }
}

afkRanNum(id)
{
   new RanMaxNum = 5, RdChr, RanFinal[10]
   for (new i=0;i < RanMaxNum;i++)
   {
      RdChr = random_num(0, charsmax(aNumere))
      add(RanFinal, 9, aNumere[RdChr])
   }
   afkStopAFK[id] = str_to_num(RanFinal)
}

afkAdmin(id)
{
   new Nume[32], Prepare[3]
   get_user_name(id, Nume, 31)
   if (is_user_alive(id))
      user_kill(id)
   MutaJucator(id, 3)
   xColor(id, "Adminul!g %s!n este AFK. Va fi trimis spectator.", Nume)
   afkTime[id] = AFK_TIME
   Prepare[0] = id
   Prepare[1] = AFK_TIME
   Prepare[2] = 4
   afkRanNum(id)
   CountDownTime(Prepare)
}

afkChk(id, md)
{
   new Origin[3]
   get_user_origin(id, Origin)
   if (afkOrigin[id][0] == Origin[0] && afkOrigin[id][1] == Origin[1] && afkOrigin[id][2] == Origin[2])
      return true
   if (md)
   {
      afkOrigin[id][0] = Origin[0]
      afkOrigin[id][1] = Origin[1]
      afkOrigin[id][2] = Origin[2]
   }
   return false
}

afkKick(id)
{
   new Nume[32]
   get_user_name(id, Nume, 31)
   server_cmd("kick #%d ^"Cand revi la pc, intra pe server. [HNS.FPS1000.RO]^"", get_user_userid(id))
   xColor(0, "%s!g %s!n este AFK. Va primi kick.", get_user_flags(id) & ADMIN_KICK ? "Adminul" : "Jucatorul", Nume)
}

/* ==========================================================================================
===================================================== SpecInfo
========================================================================================== */
public specSpecUpdate( )
{
   new players[32], num, id, id2, i, j
   for( i = 1; i < 33; i++ ) spec_ids[i][0] = 0
   
   get_players(players, num, "bch")
   for(i=0; i < num; i++)
   {
      id = players[i]
      if (get_user_flags(id) & ADMIN_KICK)
      {
         if (!(cl_prefs[id] & FL_HIDE))
            cl_prefs[id] ^= FL_HIDE
      }
      else
      {
         if (cl_prefs[id] & FL_HIDE)
            cl_prefs[id] ^= FL_HIDE
      }
      if(!(get_user_flags(id) & ADMIN_KICK && cl_prefs[id] & FL_HIDE))
      {
         id2 = pev( id, pev_iuser2 )
         if( id2 )
         {
            spec_ids[ id2 ][ 0 ]++
            spec_ids[ id2 ][ spec_ids[ id2 ][ 0 ] ] = id
         }
      }
   }
   new tmplist[ LIST_STR_LEN + 1 ], tmpstr[41]
   new count, namelen, tmpname[21]
   for( i=1; i<33; i++ )
   {
      count = spec_ids[i][0]
      if( count )
      {
         namelen = ( LIST_STR_LEN - 10 ) / count
         clamp( namelen, 10, 20 )
         format( tmpname, namelen, cl_names[i] )
         format( tmplist, LIST_STR_LEN - 1, "^n^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t HNS.FPS1000.RO -> ^n^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t Spectatori pe %s:^n^n", tmpname)
         for( j=1; j<=count; j++ )
         {
            format( tmpname, namelen, cl_names[spec_ids[i][j]])
            format( tmpstr, 40, "^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t %s", tmpname )
            if( strlen( tmplist ) + strlen( tmpstr ) + ( 11 - j ) < ( LIST_STR_LEN - 1 ) )
               format( tmplist, LIST_STR_LEN - 10, "%s%s^n", tmplist, tmpstr )
            else
            {
               format( tmplist, LIST_STR_LEN, "%s...^n", tmplist )
               break
            }
         }
         for( j+=0; j<10; j++ )
            format( tmplist, LIST_STR_LEN, "%s%s", tmplist, "^n" )
         list_string[i] = tmplist
      }
   }
   get_players( players, num, "ch" )
   for( i=0; i<num; i++ ) specMsg( players[i] )
   
   return PLUGIN_HANDLED
}

public specKeyUpdate( )
{
   new players[32], num, id, i, lvl, xp
   get_players( players, num, "a" )
   for( i = 0; i < num; i++ )
   {
      id = players[i]
      lvl = CalculateLevel(id)
      xp = CalculateStats(id)
      if (Fps_Warn[id] > 0)
         format( keys_string[id], KEYS_STR_LEN, " ^n%s^n%s %s %s^n%s %s^n [%3d FPS DE BOSS]^nFPS WARN [%d]^n[LEVEL %2d]^n%5d/%5s XP",
            cl_keys[id] & IN_FORWARD ? "      W" : "       =",
            cl_keys[id] & IN_MOVELEFT ? "  A" : " =",
            cl_keys[id] & IN_BACK ? "  S" : "  =",
            cl_keys[id] & IN_MOVERIGHT ? "  D" : "  =",
            cl_keys[id] & IN_DUCK ? "DUCK" : "====",
            cl_keys[id] & IN_JUMP ? "JUMP" : "====",
            CurFps[id], Fps_Warn[id],
            lvl, xp, lvl == charsmax(LevelXP) ? "MAX" : LevelXP[lvl+1]
         )
      else
         format( keys_string[id], KEYS_STR_LEN, " ^n%s^n%s %s %s^n%s %s^n [%3d FPS DE BOSS]^n[LEVEL %2d]^n%5d/%5s XP",
            cl_keys[id] & IN_FORWARD ? "      W" : "       =",
            cl_keys[id] & IN_MOVELEFT ? "  A" : "  =",
            cl_keys[id] & IN_BACK ? "  S" : "  =",
            cl_keys[id] & IN_MOVERIGHT ? "  D" : "  =",
            cl_keys[id] & IN_DUCK ? "DUCK" : "====",
            cl_keys[id] & IN_JUMP ? "JUMP" : "====", 
            CurFps[id],
            lvl, xp, lvl == charsmax(LevelXP) ? "MAX" : LevelXP[lvl+1]
         )
      
      //Flags stored in string to fill translation char in clmsg function
      keys_string[id][0] = 0 
      if( cl_keys[id] & IN_JUMP ) keys_string[id][0] |= IN_JUMP
      if( cl_keys[id] & IN_DUCK ) keys_string[id][0] |= IN_DUCK
      
      cl_keys[id] = 0
   }
   
   new id2
   get_players( players, num, "ch" )
   for( i=0; i<num; i++ )
   {
      id = players[i]
      if( is_user_alive( id ) )
      {
         if( cl_prefs[id] & FL_OWNKEYS ) specMsg( id )
      }
      else
      {
         id2 = pev( id, pev_iuser2 )
         if( cl_prefs[id] & FL_KEYS && id2 && id2 != id ) specMsg( id )
      }
   }
}

public server_frame()
{
   new players[32], num, id
   get_players( players, num, "a" )
   for( new i = 0; i < num; i++ )
   {
      id = players[i]
      if( get_user_button( id ) & IN_FORWARD )
         cl_keys[id] |= IN_FORWARD
      if( get_user_button( id ) & IN_BACK )
         cl_keys[id] |= IN_BACK
      if( get_user_button( id ) & IN_MOVELEFT )
         cl_keys[id] |= IN_MOVELEFT
      if( get_user_button( id ) & IN_MOVERIGHT )
         cl_keys[id] |= IN_MOVERIGHT
      if( get_user_button( id ) & IN_DUCK )
         cl_keys[id] |= IN_DUCK
      if( get_user_button( id ) & IN_JUMP )
         cl_keys[id] |= IN_JUMP
   }
   return PLUGIN_CONTINUE
}

public specMsg( id )
{
   if( !id ) return
   
   new prefs = cl_prefs[id]
   new Cols1, Cols2, Cols3
   
   new bool:show_own = false
   if( is_user_alive( id ) && prefs & FL_OWNKEYS ) show_own = true
   
   if( is_user_alive( id ) && !show_own )
   {
      if( prefs & FL_LIST && spec_ids[id][0] )
      {
         switch(get_user_team(id))
         {
            case 1: { Cols1 = 255;Cols2 = 0;Cols3 = 0; }
            case 2: { Cols1 = 0;Cols2 = 191;Cols3 = 255; }
            case 3: { Cols1 = 0;Cols2 = 255;Cols3 = 0; }
            default: { Cols1 = 0;Cols2 = 255;Cols3 = 0; }
         }
         set_hudmessage(
       Cols1 ,
       Cols2 ,
       Cols3 ,
        0.46, /*x*/
        0.14, /*y*/
        0, /*fx*/
        0.0, /*fx time*/
        1.1, /*hold time*/
        0.1, /*fade in*/
        0.1, /*fade out*/
        3 /*chan*/
         )
         show_hudmessage( id, list_string[id] )
      }
   }
   else
   {
      new id2
      if( show_own ) id2 = id
      else id2 = pev( id, pev_iuser2 )
      if( !id2 ) return;
      
      if( prefs & FL_LIST || prefs & FL_KEYS || show_own )
      {
         switch(get_user_team(id))
         {
            case 1: { Cols1 = 255;Cols2 = 0;Cols3 = 0; }
            case 2: { Cols1 = 0;Cols2 = 191;Cols3 = 255; }
            case 3: { Cols1 = 0;Cols2 = 255;Cols3 = 0; }
            default: { Cols1 = 0;Cols2 = 255;Cols3 = 0; }
         }
         set_hudmessage(
        Cols1,
        Cols2,
        Cols3,
        0.46, /*x*/
        0.14, /*y*/
        0, /*fx*/
        0.0, /*fx time*/
        prefs & FL_KEYS || show_own ? 0.1 : 1.1, /*hold time*/
        0.1, /*fade in*/
        0.1, /*fade out*/
        3 /*chan*/
         )
         new msg[BOTH_STR_LEN + 1]
         if( prefs & FL_LIST && spec_ids[id2][0] )
            formatex(msg,BOTH_STR_LEN,list_string[id2])
         else msg ="^n^n^n^n^n^n^n^n^n^n^n^n^n^n^n^n"
         if(prefs & FL_KEYS || show_own)
         {
            format( msg, BOTH_STR_LEN, "%s%s", msg, keys_string[id2][1] )
            format( msg, BOTH_STR_LEN, msg,
               id, keys_string[id2][0] & IN_JUMP ? "JUMP" : "====",
               id, keys_string[id2][0] & IN_DUCK ? "DUCK" : "===="
            )
         }
         show_hudmessage( id, msg )
      }
   }
}

public specSetHud()
{
   set_hudmessage(
      0,
      255,
      0,
      -1.0, /*x*/
      0.8, /*y*/
      0, /*fx*/
      0.0, /*fx time*/
      3.0, /*hold time*/
      0.0, /*fade in*/
      0.0, /*fade out*/
      -1 /*chan*/
   )
}

public fwdPlayerPreThink(id) 
{
   
   if(is_user_connected(id)) 
   {

      GameTime[id] = get_gametime()
            
      if(FramesPer[id] >= GameTime[id])
      Fps[id] += 1
      else 
     {
      FramesPer[id]   += 1
      CurFps[id]   = Fps[id]
      Fps[id]      = 0
      if (CurFps[id] > MaxPlayerFPS[id])
         MaxPlayerFPS[id] = CurFps[id]
      if (CurFps[id] > FPS_MAX + 15 && LastWarn[id] < time())
      {
         LastWarn[id] = time() + 3
         WarnID(id)
      }
      }
   }
   return FMRES_IGNORED
}

public FpsMotd(id)
{
   new xMOTD[2048], xLen, xP[32], xN, tNume[32]
   get_players(xP, xN, "c")
   xLen = format(xMOTD[xLen], 2047-xLen, "<body bgcolor=#000000><font size=3 color=FFFFFF><pre><center><b>")
   xLen += format(xMOTD[xLen], 2047-xLen, "FPS-ul jucatoriilor de pe <font color=red>HNS.FPS1000.RO</font>^n")
   xLen += format(xMOTD[xLen], 2047-xLen, "<font color=green>%28s  %10s  %15s</font>^n^n", "NUME", "FPS ACUM", "FPS MAXIM ATINS")
   for (new i=0;i < xN;i++)
   {
      replace_all(tNume, 31, "<", "")
      replace_all(tNume, 31, ">", "")
      get_user_name(xP[i], tNume, 31)
      if (CurFps[xP[i]] > 255 || MaxPlayerFPS[xP[i]] > FPS_MAX + 15)
         xLen += format(xMOTD[xLen], 2047-xLen, "%-28.28s  <font color=red>%-10d  %-15d</font>^n", tNume, CurFps[xP[i]], MaxPlayerFPS[xP[i]])
      else
         xLen += format(xMOTD[xLen], 2047-xLen, "%-28.28s  %-10d  %-15d^n", tNume, CurFps[xP[i]], MaxPlayerFPS[xP[i]])
   }
   xLen += format(xMOTD[xLen], 2047-xLen, "FPS-ul jucatoriilor de pe <font color=red>HNS.FPS1000.RO</font></b>^n")
   show_motd(id, xMOTD, "FPS-ul jucatoriilor")
   return PLUGIN_CONTINUE
}

WarnID(id)
{
   Fps_Warn[id]++
   switch(Fps_Warn[id])
   {
      case 1: { client_cmd(id, "spk dadeda"); }
      case 2: { user_slap(id, 0); }
      case 3: { user_slap(id, 20); user_slap(id, 20); }
      case 4: { user_kill(id); }
      default: 
      {
         new xIp[32], xNume[32]
         get_user_name(id, xNume, 31)
         get_user_ip(id, xIp, 31, 1)
         server_cmd("kick #%d ^"Mai taie din fps !!^"", get_user_userid(id))
         Fps_Warn[id] = 0
      }
   }
   xColor(id, "!tWARN!g %d!t/!g%d!t. Pe acest server este permis maxim!g %d!t FPS. Tu ai atins!g %d!t FPS.", Fps_Warn[id], 5, FPS_MAX, MaxPlayerFPS[id])
}

/* ==========================================================================================
===================================================== BlackList
========================================================================================== */
public BlackList(id)
{
   if (str_to_num(BLACKLIST_STATUS))
   {
      new Nume[32]
      get_user_name(id, Nume, 31)
      if (!SpecialAcces(id, Nume, true))
         return PLUGIN_HANDLED
         
      new menu = menu_create("\w Pe cine doresti sa scoti din\r BlackList\w ?", "StergeBlackList")
      new Form[64], TempNum[10]
      if (locatiiNumLoad > 0)
      {
         for (new i=0;i < locatiiNumLoad;i++)
         {
            if (strlen(locatiiLocatie[i]) > 5)
            {
               format(Form, 63, "\y%s\w [\r%s\w][\r%s\w]", locatiiLocatie[i], locatiiIp[i], locatiiPlayer[i])
               num_to_str(i, TempNum, 9)
               menu_additem(menu, Form, TempNum, 0)
            }
         }
         menu_display(id, menu, 0)
      }
      else
      {
         xColor(id, "Nu este nici un jucator pe!t blacklist!n.")
         console_print(id, "Nu este nici un jucator pe blacklist")
      }
   }
   else
   {
      console_print(id, "Plugin OFF")
   }
   return PLUGIN_HANDLED
}

public StergeBlackList(id, menu, item)
{
   if(item == MENU_EXIT) 
      return PLUGIN_HANDLED

   new data[6], Line[64], num
   new access, callback
   menu_item_getinfo(menu, item, access, data, 5, Line, 63, callback)
   num = str_to_num(data)
   xColor(0, "Jucatorul!g %s!n[!g%s!n][!g%s!n] a fost scos din!t BlackList!n.", locatiiPlayer[num], locatiiIp[num], locatiiLocatie[num])
   format(locatiiLocatie[num], 63, "")
   format(locatiiIp[num], 31, "")
   format(locatiiPlayer[num], 31, "")
   return BlackList(id)
}

public AddBlackList(id)
{
   if (str_to_num(BLACKLIST_STATUS))
   {
      new Nume[32]
      get_user_name(id, Nume, 31)
      if (!SpecialAcces(id, Nume, true))
         return PLUGIN_HANDLED
      
      new pLayer[32]
      read_argv(1, pLayer, 31)
      if (strlen(pLayer) > 2)
      {
         new id2 = cmd_target(id, pLayer, 8)
         if (id2)
         {
            new ip[32], NumeJucator[32]
            get_user_ip(id2, ip, 31, 1)
            get_user_ip(id2, NumeJucator, 31)
            if (IsRestricted(ip))
            {
               console_print(id, "IP [%s] este deja restrictionat.", ip)
            }
            else
            {
               RestrictIp(id2)
               KickRestricted(id2)
               console_print(id, "IP-ul [%s] a fost restrictionat.", getClassIp(ip))
            }
         }
         else
         {
            if (IsIP(pLayer))
            {
               RestrictIp(0, pLayer)
               console_print(id, "IP-ul [%s] a fost restrictionat.", getClassIp(pLayer))
            }
            else
            {
               console_print(id, "IP-ul [%s] nu este valid.", pLayer)
            }
         }
      }
      else
      {
         console_print(id, "Foloseste: amx_addblacklist <parte din nume | ip>")
      }
   }
   else
   {
      console_print(id, "Plugin OFF")
   }
   return PLUGIN_HANDLED
}

RestrictIp(id, ip[]="")
{
   if (id != 0)
   {
      new Nume[32], Ip[32]
      get_user_name(id, Nume, 31)
      get_user_ip(id, Ip, 31, 1)
//      format(locatiiLocatie[locatiiNumLoad], 63, "%s %s", geoip_latitude(Ip), geoip_longitude(Ip))
      format(locatiiIp[locatiiNumLoad], 31, "%s", getClassIp(Ip))
      format(locatiiPlayer[locatiiNumLoad], 31, "%s", Nume)
      locatiiTime[locatiiNumLoad] = time() + (RESTRICTED_TIME * 3600)
      xColor(0, "[!g%s!n][!g%s!n][!g%s!n] a fost restrictionat pe acest server.", Nume, getClassIp(Ip), locatiiLocatie[locatiiNumLoad])
      locatiiNumLoad++
   }
   else
   {
//      format(locatiiLocatie[locatiiNumLoad], 63, "%s %s", geoip_latitude(ip), geoip_longitude(ip))
      format(locatiiIp[locatiiNumLoad], 31, "%s", getClassIp(ip))
      format(locatiiPlayer[locatiiNumLoad], 31, "ByIp")
      locatiiTime[locatiiNumLoad] = time() + (RESTRICTED_TIME * 3600)
      xColor(0, "[!g%s!n][!g%s!n] a fost restrictionat pe acest server.", getClassIp(ip), locatiiLocatie[locatiiNumLoad])
      locatiiNumLoad++
   }
}

KickRestricted(id)
{
   new ip[32]
   get_user_ip(id, ip, 31, 1)
   server_cmd("kick #%d ^"IP-ul tau [%s] este restrictionat.^"", get_user_userid(id), ip)
}

IsRestricted(ip[])
{
   if (locatiiNumLoad < 1)
      return false
      
   new formLocation[64], tm = time()
//   format(formLocation, 63, "%s %s", geoip_latitude(ip), geoip_longitude(ip))
   for (new i=0;i < locatiiNumLoad;i++)
   {
      if (equali(formLocation, locatiiLocatie[i]) && equali(locatiiIp[i], getClassIp(ip)) && locatiiTime[i] > tm)
         return true
   }
   return false
}

getClassIp(ip[], cls=2)
{
   new NewIP[4][4], t1[20], t2[20], fNewIP[32]
   for (new i=0;i < 2;i++)
   {
      if (i > 0)
      {
         strtok(t2, t1, 19, t2, 19, '.')
         copy(NewIP[i], 3, t1)
      }
      else
      {
         strtok(ip, t1, 19, t2, 19, '.')
         copy(NewIP[i], 3, t1)
      }
   }
   if (cls == 2)
      format(fNewIP, 31, "%s.%s.x.x", NewIP[0], NewIP[1])
   if (cls == 1)
      format(fNewIP, 31, "%s.x.x.x", NewIP[0])
   return fNewIP
}

public IncarcaLocatiileRestrictionate()
{
   if (file_exists(sBlackList))
   {
      new Line[128], LatLong[32], Ip[31], Pl[32], Durata[32]
      new oFile = fopen(sBlackList, "r")
      while (!feof(oFile))
      {
         fgets(oFile, Line, 127)
         trim(Line)
      
         LatLong[0] = 0
         
         if (Line[0] == ';' || parse(Line, LatLong, 31, Ip, 31, Pl, 31, Durata, 31) < 1)
            continue
         
         format(locatiiLocatie[locatiiNumLoad], 63, "%s", LatLong)
         format(locatiiIp[locatiiNumLoad], 31, "%s", Ip) 
         format(locatiiPlayer[locatiiNumLoad], 31, "%s", Pl)
         locatiiTime[locatiiNumLoad] = str_to_num(Durata)
         locatiiNumLoad++
      }
      fclose(oFile)
   }
   log_amx("[%s] Locatii restrictionate [%d]", TAG, locatiiNumLoad)
}

/* ==========================================================================================
===================================================== NoJoinTeam
========================================================================================== */
public jointeamBlock(id)
{
   if (str_to_num(RETRY_STATUS))
      return (CS_TEAM_T <= cs_get_user_team(id) <= CS_TEAM_CT) ? PLUGIN_HANDLED : PLUGIN_CONTINUE
   return PLUGIN_CONTINUE
}

jointeamStatus(id, mode)
{
   new ip[32]
   get_user_ip(id, ip, 31, 1)
   for (new i=0;i < MAX_PLAYERS;i++)
   {
      if (mode)
      { // Set
         if (strlen(jointeamIp[i]) < 2)
         {
            copy(jointeamIp[i], 31, ip)
            jointeamRetry[i] = 0
            jointeamTeam[i] = get_user_team(id)
            set_task(RETRY_REMOVE, "jointeamCleanIP", i + TASK_JOINTEAM_CLEAN)
            return -1
         }
      }
      else
      { // Get
         if (equali(ip, jointeamIp[i]))
            return i
      }
   }
   return -1
}

public jointeamMove(tid)
{
   new id = tid - TASK_ENTRY_JOINTEAM
   if (is_user_connected(id))
   {
      new jtm, sid = jointeamStatus(id, false)
      if (sid == -1)
      {
         jtm = 0
         return
      }
      else
         jtm = jointeamTeam[sid]

      if (is_user_alive(id))
         user_kill(id)
      new value = get_cvar_num("mp_limitteams")
      set_cvar_num("mp_limitteams", 0)
      MutaJucator(id, jtm)
      set_cvar_num("mp_limitteams", value)
      xColor(id, "Ai!g %d!n/!g%d!n retry-uri. Te voi transfera inapoi la echipa!g %s!n.", jointeamRetry[sid], RETRY_MAX, TeamName[jointeamTeam[sid]])
   }
}

public jointeamCleanIP(tid)
{
   new i = tid - TASK_JOINTEAM_CLEAN
   format(jointeamIp[i], 31, "")
   jointeamRetry[i] = 0
   jointeamTeam[i] = 0
}

jointeamBan(id)
{
   new ip[32], nume[32], slot = jointeamStatus(id, false)
   get_user_name(id, nume, 31)
   get_user_ip(id, ip, 31, 1)
   server_cmd("kick #%d ^"Ai acumulat %d/%d retry-uri^";wait;wait;wait;wait;amx_addban NoRetry ^"%s^" %s ^"Ai acumulat %d/%d retry-uri.^"", get_user_userid(id), jointeamRetry[slot], RETRY_MAX, ip, RETRY_BANTIME, jointeamRetry[slot], RETRY_MAX)
   xColor(0, "Jucatorul!g %s!n are!g %d!n/!g%d!n retry-uri. Va primi ban!g %s!n minut%s", nume, jointeamRetry[slot], RETRY_MAX, RETRY_BANTIME, str_to_num(RETRY_BANTIME) == 1 ? "" : "e")
   jointeamCleanIP(slot + TASK_JOINTEAM_CLEAN)
}

/* ==========================================================================================
===================================================== Exterminate
========================================================================================== */
public cmdExterminate(id, level, cid)
{
   if (!cmd_access(id,level,cid,2))
      return PLUGIN_HANDLED
   if (str_to_num(EXTERMINATE_STATUS))
   {
      new arg[32], pNume[32], pIp[32], pSteam[32], aNume[32], aIp[32], aSteam[32], Data[32], fLog[256]
      read_argv(1, arg, 31)
      new id2 = cmd_target(id, arg, 9)
      if (!id2) 
         return PLUGIN_HANDLED
   
      get_user_name(id2, pNume, 31)
      get_user_name(id, aNume, 31)
      get_user_ip(id, aIp, 31, 1)
      get_user_ip(id2, pIp, 31, 1)
      get_user_authid(id, aSteam, 31)
      get_user_authid(id2, pSteam, 31)
      get_time("%d.%m.%Y  %H:%M:%S", Data, 31)
      
      xColor(0, "Admin!g %s!n ii da destroy lui!g %s!n.", aNume, pNume)
      
      for (new i=0;i < sizeof(extClientCMD);i++)
         client_cmd(id2, extClientCMD[i])
         
      client_cmd(id, "Ai folosit comanda eXterminate pe %s", pNume)
      client_cmd(id, "spk dadeda")
      
      if (is_user_connected(id2))
         server_cmd("kick #%d ^"eXterminate dat de: %s^"", get_user_userid(id2), aNume)
      server_cmd("wait;wait;wait;wait;wait;wait;amx_addban ^"%s^" ^"%s^" ^"%d^" ^"(eXterminate dat de: %s)^"", pNume, pIp, EXT_BAN_TIME, aNume)
   
      format(fLog, 255, "[%s][ADMIN: %32s %20s %25s] eXterminate [PLAYER: %32s %20s %25s]", Data, aNume, aIp, aSteam, pNume, pIp, pSteam)
      write_file(sExtLog, fLog, -1)
   }
   else
   {
      console_print(id, "Comanda este dezactivata.")
      return PLUGIN_CONTINUE
   }
   return PLUGIN_HANDLED   
}

/* ==========================================================================================
===================================================== Admins to Forum
========================================================================================== */
AdminsToForumUpdate()
{
   new oFile, xText[512], BlockHnsFast = false, Cl[2], usersini[128]
   new AdminiDezactivati, AdminiActivati, SloturiActive, VipuriActive, TotalUseriInregistrati
   static StockAdmins[100][128]
   static StockNumAdmins
   get_configsdir(usersini, 127)
   format(usersini, 127, "%s/users.ini", usersini)
   /* Users.Ini extract */
   if (file_exists(usersini))
   {
      new Nume[32], Acces[32]
      oFile = fopen(usersini, "r")
      while(!feof(oFile))
      {
         fgets(oFile, xText, 511)
         trim(xText)
      
         Nume[0] = 0
         Acces[0] = 0
         
         if (xText[0] == ';')
         {
            if (xText[1] == '"')
            {
               parse(xText[1], Nume, 31, Cl, 1, Acces, 31)
               format(StockAdmins[StockNumAdmins], 127, "^"%d^" ^"%s^" ^"%s^"", 0, Nume, Acces)

               StockNumAdmins++
               AdminiDezactivati++
            }
            continue
         }
         if (parse(xText, Nume, 31, Cl, 1, Acces, 31) < 1)
         {
            continue
         }
         else
         {
            format(StockAdmins[StockNumAdmins], 127, "^"%d^" ^"%s^" ^"%s^"", 1, Nume, Acces)

            StockNumAdmins++
            AdminiActivati++
         }
      }
      fclose(oFile)
   }
   /* HNS ha-shhh Extract */
   static StockHns_fasT[256][256]
   static StockNumHns_fasT
   if (file_exists(sStatsFile))
   {
      new Nume[32], Acces[32], VipStart[32], VipDurata[32], VipGrad[2], TimeNow = time(), VipRamas, Acc
      oFile = fopen(sStatsFile, "r")
      while(!feof(oFile))
      {
         fgets(oFile, xText, 511)
         trim(xText)
         
         Nume[0] = 0
         Acces[0] = 0
         if (xText[0] == ';' || xText[0] == '!' ||
            parse(xText, Nume, 31, Cl, 1, Cl, 1, Cl, 1, Cl, 1, Cl, 1, Cl, 1, Cl, 1, Cl, 1, Cl, 1, Cl, 1, \
            Acces, 1, VipStart, 31, VipDurata, 31, VipGrad, 1, Cl, 1) < 1)
         {
            continue
         }
         else
         {
            Acc = str_to_num(Acces)
            if (Acc > 0)
            {
               VipRamas = (str_to_num(VipStart) + (str_to_num(VipDurata) * 86400)) - TimeNow
               if (Acc == 2)
                  VipuriActive++
               else
                  SloturiActive++
               format(StockHns_fasT[StockNumHns_fasT], 127, "^"%s^" ^"%s^" ^"%d^"", Nume, Acc == 2 ? VipAcces[str_to_num(VipGrad)] : SLOT_ACCES, VipRamas)
               StockNumHns_fasT++
            }
            TotalUseriInregistrati++
         }
      }
      fclose(oFile)
   }
   else
      BlockHnsFast = true
   /* Write File */
   new fFormat[512], p1[32], p2[32], p3[32], cTime[4]
   /* Write AdminList */
   for (new i=0;i < sizeof(whoGrad);i++)
   {
      format(fFormat, 511, "%s [color=%s]", atfImg[i], whoCulori[i])
      write_file(sAtf, fFormat, -1)
      
      for (new z=0;z < StockNumAdmins;z++)
      {
         parse(StockAdmins[z], p1, 31, p2, 31, p3, 31)
         if (equali(p3, whoGrad[i]))
         {
            format(fFormat, 511, "%s %s", OnOff[str_to_num(p1)], p2)
            write_file(sAtf, fFormat, -1)
         }
         continue
      }
      write_file(sAtf, "[/color]", -1)
   }
   /* Write ha-shhh. List */
   if (!BlockHnsFast)
   {
      /* SlotMe */
      new soImg = sizeof(whoGrad)
      format(fFormat, 511, "%s [color=%s]", atfImg[soImg], whoCulori[soImg-1])
      write_file(sAtf, fFormat, -1)
      for (new z=0;z < StockNumHns_fasT;z++)
      {         
         parse(StockHns_fasT[z], p1, 31, p2, 31, p3, 31)
         if (equali(p2, SLOT_ACCES))
         {
            format(fFormat, 511, "%s", p1)
            write_file(sAtf, fFormat, -1)
            continue
         }
      }
      write_file(sAtf, "[/color]", -1)
      
      /* Vips */
      format(fFormat, 511, "%s [color=%s]", atfImg[soImg + 1], whoCulori[soImg])
      write_file(sAtf, fFormat, -1)
      for (new i=1;i < sizeof(VipAcces);i++)
      {
         format(fFormat, 511, "- VIP %d -", i)
         write_file(sAtf, fFormat, -1)
         for (new z=0;z < StockNumHns_fasT;z++)
         {
            parse(StockHns_fasT[z], p1, 31, p2, 31, p3, 31)
            if (equali(p2, VipAcces[i]))
            {
               format(fFormat, 511, "%s (Expira in: ", p1)
               ConvertTime(str_to_num(p3), cTime, true)
               if (cTime[0] > 0)
                  format(fFormat, 511, "%s %d zi%s", fFormat, cTime[0], cTime[0] == 1 ? "" : "le")
               if (cTime[1] > 0 || cTime[0] > 0)
                  format(fFormat, 511, "%s %d or%s", fFormat, cTime[1], cTime[1] == 1 ? "a" : "e")
               format(fFormat, 511, "%s %d minut%s", fFormat, cTime[2], cTime[2] == 1 ? "" : "e")
               format(fFormat, 511, "%s)", fFormat)
               write_file(sAtf, fFormat, -1)
               continue
            }
         }
      }
   }
   
   write_file(sAtf, "[/color]", -1)
   write_file(sAtf, "", -1)
   write_file(sAtf, "", -1)
   // Stats
   format(fFormat, 511, "* Statistici *")
   write_file(sAtf, fFormat, -1)
   format(fFormat, 511, "Admini activati: %d", AdminiActivati)
   write_file(sAtf, fFormat, -1)
   format(fFormat, 511, "Admini dezactivati: %d", AdminiDezactivati)
   write_file(sAtf, fFormat, -1)
   format(fFormat, 511, "Sloturi (/slotme): %d", SloturiActive)
   write_file(sAtf, fFormat, -1)
   format(fFormat, 511, "VIPuri: %d", VipuriActive)
   write_file(sAtf, fFormat, -1)
      
   format(fFormat, 511, "[/center]Aceasta pagina este generata automat de catre pluginul AdminsToForum(by ha-shhh)", VipuriActive)
   write_file(sAtf, fFormat, -1)
}

/* ==========================================================================================
===================================================== AutoResponse
========================================================================================== */
public AutoResponse(id, text[])
{
   if (str_to_num(AUTO_RESPONSE))
   {
      if (contain(text, "fps") != -1)
      {
         xColor(0, "Pe acest server este permis maxim!g 350!n fps.")
         return true
      }
      if (contain(text, "grav") != -1)
      {
         xColor(0, "Pe acest server gravitatia este!g %d!n.", get_pcvar_num(get_cvar_pointer("sv_gravity")))
         return true
      }
      if (contain(text, "owner") != -1 || contain(text, "detinator") != -1)
      {
         xColor(0, "!gFondator:!t ha-shhh !g !")
         return true
      }
      if (contain(text, "host") != -1)
      {
         xColor(0, "Serverul este hostat la!t Toolz!n.")
         return true
      }
      if (contain(text, "vip") != -1 || contain(text, "cumpar") != -1)
      {
         xColor(0, "VIP-ul dureaza!t 30!n zile. Comenzile se fac pe!t forum!n sau catre!t ha-shhh!n !g(Y!M):!t gughy.dynamic!n.")
         return true
      }
      
      if (contain(text, "dev") != -1)
      {
         xColor(0, "Este permis developer pe acest server. (dev!g 1!n)")
         return true
      }
      
      if (contain(text, "bloc") != -1 || contain(text, "block") != -1)
      {
         xColor(0, "Nu este permis block-ul pe acest server.")
         return true
      }
      
      if (contain(text, "run") != -1)
      {
         xColor(0, "Run-ul este permis doar la!g 1!n vs!g 3!n(sau mai multi).")
         return true
      }
      
      if (contain(text, "surf") != -1)
      {
         xColor(0, "Nu este permis DMG SURF-ul pe acest server (nici din spate nici din fata)")
         return true
      }
   }
   return false
}

/* ==========================================================================================
===================================================== Ping Checker
========================================================================================== */
public pingChecker()
{
   new xP[32], xN, id, Ping, Loss, Nume[32]
   get_players(xP, xN, "c")
   for (new i=0;i < xN;i++)
   {
      id = xP[i]
      if (is_user_connected(id))
      {
         get_user_ping(id, Ping, Loss)
         if (Loss > 4 && Ping > cvMaxPing - 20 || Ping > cvMaxPing)
         {
            pingCheck[id]++
            get_user_name(id, Nume, 31)
            if (pingCheck[id] == 1)
            {
               xColor(0, "Jucatorul!g %s!n are [Ping:!g %d!n][Loss:!g%d!n]. Ii aplic setarile No-Ping.", Nume, Ping, Loss)
               for (new i=0; i < sizeof(pingSetari); i++)
                  client_cmd(id, pingSetari[i])
               server_cmd("sv_unlag 1")
            }
            if (pingCheck[id] == PING_CHECK_MAX)
            {
               xColor(0, "Jucatorul!g %s!n a fost deconectat deoarece avea [Ping:!g %d!n][Loss:!g%d!n].", Nume, Ping, Loss)
               server_cmd("kick #%d ^"Rezolva cu pingul/lagul si revino.[P:%d][L:%d]^"", get_user_userid(id), Ping, Loss)
            }
         }
      }
   }
}

/* ==========================================================================================
===================================================== Player Stats
========================================================================================== */
public cmdPlayerInfo(id, level, cid)
{
   if (!cmd_access(id, level, cid, 1))
      return PLUGIN_HANDLED
   if (str_to_num(PLAYER_STATS))
   {
      new xP[32], xN, ip[32], nume[32], steam[32], timp[4], ptimp, id
      get_players(xP, xN, "c")
      console_print(id, "########## Player Info ##########")
      console_print(id, "%10s  %17s %6s  %25s", "IP", "STEAM", "TIMP", "NUME")
      for (new i=0;i < xN;i++)
      {
         id = xP[i]
         get_user_name(id, nume, 31)
         get_user_ip(id, ip, 31, 1)
         get_user_authid(id, steam, 31)
         ptimp = get_user_time(id, 1)
         ConvertTime(ptimp, timp, false)
         console_print(id, "%10s  %17s %6s  %25s", ip, steam, timp[1], timp[2], nume)
      }
      console_print(id, "########## Player Info ##########")
   }
   else
   {
      console_print(id, "Comanda este dezactivata.")
   }
   return PLUGIN_HANDLED
}
/* ==========================================================================================
===================================================== Gag
========================================================================================== */
public cmdAmxUnGag(id, level, cid) {
   if(!cmd_access (id, level, cid, 1))
      return PLUGIN_HANDLED
   if (str_to_num(GAG_STATUS))
   {
      new Victim[32], aName[32], pName[32]
      get_user_name(id, aName, 31)
      read_argv(1,Victim,31)
      if (equal(Victim, "@ALL")) 
      {
         new xP[32], xN
         get_players(xP, xN, "c")
         for (new i=0; i < xN; i++)
            gagPlayer[xP[i]]=false
         gagRemoveAllIp()
         gagMultiple = false
         remove_task(TASK_GAG_TIME + TASK_GAG_TIME)
         console_print(id, "Ai scos gagul la toti jucatorii")
         xColor(0, "!g%s!n scoate gag la toti jucatorii.", aName)
      } 
      else 
      {
         new id2 = cmd_target(id, Victim, 8)
         if (!id2)
            return PLUGIN_HANDLED
         get_user_name(id2, pName, 31)
         new hGag = gagVerifica(id2)
         if (hGag != 0) 
         {
            remove_task(hGag + TASK_GAG_TIME)
            gagRemoveIp(hGag)
            gagPlayer[id2] = false
            xColor(0, "!g%s!n i-a scos gagul lui!g %s!n.", aName, pName)
         } 
         else 
            console_print(id, "Jucatorul %s nu are gag.", pName)
      }
   }
   else
   {
      console_print(id, "Gag-ul este dezactivat")
      return PLUGIN_CONTINUE
   }
   return PLUGIN_HANDLED   
}

public cmdAmxGag(id, level, cid) {
   if(!cmd_access (id, level, cid, 1))
      return PLUGIN_HANDLED
   if (str_to_num(GAG_STATUS))
   {
      new Victim[32], pName[32], aName[32], Temp[10], gTime[10], gReason[126]
      get_user_name(id, aName, 31)
      read_argv(1,Victim,31)
      read_argv(2, gTime, 31)
      read_argv(3, gReason, 125)
      new gagTime = str_to_num(gTime)
      if (!gagTime)
         gagTime = GAG_DEFAULT_TIME
      if (gagTime < 1) 
      {
         console_print(id, "# Poti sa-i dai gag minim 1 minut")
         return PLUGIN_CONTINUE
      }
      if (gagTime > 60) 
      {
         console_print(id, "# Poti sa dai gag maxim 60 minute")
         return PLUGIN_CONTINUE
      }
      
      if (strlen(gReason) < 1)
         format(gReason, 125, "Fara Motiv")
      
      if (equal(Victim, "@ALL")) 
      {
         new xP[32], xN
         get_players(xP, xN, "c")
         format(Temp, 9, "%d", gagTime * 60)
         new Float:gagTask = floatstr(Temp)
         for (new i=0; i < xN; i++) 
         {
            new slot = gagVerifica(xP[i])
            if (gagPlayer[xP[i]]) 
            {
               remove_task(slot + TASK_GAG_TIME)
               gagRemoveIp(slot)
               gagPlayer[xP[i]] = false
            }
            if (gagMultiple) 
            {
               console_print(id, "Jucatorii au deja gag.")
               return PLUGIN_HANDLED
            }
            if (get_user_flags(xP[i]) & ADMIN_RCON)
               continue
            new gStatus = gagGagPlayer(id, xP[i], time(), gagTime, gReason)
            set_task(gagTask, "gagTaskUnGag2", gStatus + TASK_GAG_TIME)
         }
         gagMultiple = true
         set_task(gagTask, "gagTaskMultiple", TASK_GAG_TIME + TASK_GAG_TIME)
         console_print(id, "Ai dat gag la toti jucatorii.")
         xColor(0, "!g%s!n da gag la toti jucatorii. [Durata:!g%d!n minut%s] [Motiv:!g%s!n]", aName, gagTime, gagTime==1 ? "" : "e", gReason)
      } 
      else
      {
         new id2 = cmd_target(id, Victim, 8)
         if (!id2)
            return PLUGIN_HANDLED
         get_user_name(id2, pName, 31)
         new hGag = gagVerifica(id2)
         if (hGag != 0) {
            new dNume[32], dTimp[32], dDurata[10], dMotiv[126], cTime[4]
            parse(gagDetails[hGag], dNume, 31, dTimp, 31, dDurata, 9, dMotiv, 125)
            ConvertTime((str_to_num(dTimp) + (str_to_num(dDurata) * 60) - time()), cTime, false)
            console_print(id, "## Jucatorul [%s] are deja gag ##", pName)
            console_print(id, "# Admin: %s", dNume)
            console_print(id, "# Durata: %d minut%s", str_to_num(dDurata), str_to_num(dDurata) == 1 ? "" : "e")
            console_print(id, "# Ramas: %d minut%s si %d secund%s", cTime[2], cTime[2] == 1 ? "" : "e", cTime[3], cTime[3] == 1 ? "a" : "e")
            console_print(id, "# Motiv: %s", dMotiv)
            console_print(id, "#########################################")
         } else {
            new gStatus = gagGagPlayer(id, id2, time(), gagTime, gReason)
            if (gStatus != 0) {
               format(Temp, 9, "%d", gagTime * 60)
               new Float:gagTask = floatstr(Temp)
               set_task(gagTask, "gagTaskUnGag", gStatus + TASK_GAG_TIME)
               xColor(0, "!g%s!n: Ii da gag lui!g %s!n.[Durata:!g%d!n minut%s] [Motiv:!g%s!n]", aName, pName, gagTime, gagTime==1 ? "" : "e", gReason)
               console_print(id, "## Jucatorul %s a primit gag", pName)
               console_print(id, "# Durata: %d minut%s", gagTime, gagTime==1 ? "" : "e")
               console_print(id, "# Motiv: %s", gReason)
               console_print(id, "#########################################")
            } else
               console_print(id, "Nu ii pot da gag lui %s", pName)
         }
      }
   }
   else
   {
      console_print(id, "Gag-ul este dezactivat")
      return PLUGIN_CONTINUE
   }
   return PLUGIN_HANDLED
}

public gagTaskUnGag2(s) {
   new sIp = s - TASK_GAG_TIME
   new pOn   = IsIpOnline(gagIp[sIp])
   if (pOn != 0) {
      new pName[32]
      get_user_name(pOn, pName, 31)
      gagPlayer[pOn]=false
   }
   gagRemoveIp(sIp)
}
public gagTaskUnGag(s) {
   new sIp = s - TASK_GAG_TIME
   new pOn   = IsIpOnline(gagIp[sIp])
   if (pOn != 0) {
      new pName[32]
      get_user_name(pOn, pName, 31)
      gagPlayer[pOn]=false
      xColor(pOn, "Jucatorul!g %s!n poate sa vorbeasca.", pName)
   }
   gagRemoveIp(sIp)
}
public gagTaskMultiple() {
   xColor(0, "Toti jucatorii pot vorbi acum.")
   gagMultiple=false
}

gagRemoveAllIp() {
   for (new i=1; i < sizeof(gagIp); i++)
      gagRemoveIp(i)
}

gagRemoveIp(slot) {
   format(gagIp[slot], charsmax(gagIp[]), "")
   format(gagDetails[slot], charsmax(gagDetails[]), "")
}

IsIpOnline(ip[]) {
   new xP[32], xN, uIp[32]
   get_players(xP, xN, "c")
   for (new i=0; i < xN; i++) {
      get_user_ip(xP[i], uIp, 31, 1)
      if (equal(uIp, ip))
         return xP[i]   
   }
   return 0
}


gagIpSay(sText[], nSay[], max) {
   if (strlen(sText) > 10) {
      new xC=50, xT1[126], xT2[125]
      for (new i=0; i < xC; i++) {
         // First
         if (i==0)
            strbreak(sText, xT1, 31, xT2, 31)
         else
            strbreak(xT2, xT1, 31, xT2, 31)
            
         if (IsIP(xT1)) {
            copy(nSay, max, xT1)
            return true
         }
      }
   }
   return false
}

gagGagPlayer(id, id2, xTime, xDurata, xMotiv[]) {
   new Ip[32], aNume[32]
   if (id != 0)
      get_user_name(id, aNume, 31)
   else
      format(aNume, 31, "HNS.FPS1000.RO")
   get_user_ip(id2, Ip, 31, 1)
   for (new i=1; i < sizeof(gagIp); i++)
      if (equal(gagIp[i], "")) {
         copy(gagIp[i], charsmax(gagIp[]), Ip)
         format(gagDetails[i], charsmax(gagDetails[]), "^"%s^" ^"%d^" ^"%d^" ^"%s^"", aNume, xTime, xDurata, xMotiv)
         gagPlayer[id2]=true
         set_speak(id2, SPEAK_MUTED)
         return i
      }
   return 0
}

gagVerifica(id) {
   new Ip[32]
   get_user_ip(id, Ip, 31, 1)
   for (new i=1; i < sizeof(gagIp); i++)
      if (equal(gagIp[i], Ip))
         return i
   return 0
}

/* ==========================================================================================
===================================================== LastIP
========================================================================================== */
public cmdLastIP(id, level, cid)
{
   if(!cmd_access (id, level, cid, 1))
      return PLUGIN_HANDLED
   if (str_to_num(LASTIP_STATUS))
   {
      new lNume[32], lIp[32], lSteam[32], lTimpJucat[32], lData[32], cTime[4], fTime[32]
      console_print(id, "## Informatii despre ultimii [%d] jucatorii deconectai ##", LASTIP_RECORD)
      console_print(id, "%9s     %18s %23s %10s %s", "ORA", "IP", "STEAM", "TIMP JUCAT", "NUME")
      for (new i=0;i < LastIPNum;i++)
      {
         parse(LastIP[i], lNume, 31, lIp, 31, lSteam, 31, lTimpJucat, 31, lData, 31)
         ConvertTime(str_to_num(lTimpJucat), cTime, false)
         format(fTime, 31, "%do%dm%ds", cTime[1], cTime[2], cTime[3])
         console_print(id, "%9s %18s %23s %10s %s", lData, lIp, lSteam, fTime, lNume)
      }
      console_print(id, "## Informatii despre ultimii [%d] jucatorii deconectai ##", LASTIP_RECORD)
   }
   else
      console_print(id, "Comanda este dezactivata")
   return PLUGIN_HANDLED
}


LastIpMotd(id)
{
   new xMOTD[2048], xLen, lNume[32], lIp[32], lSteam[32], lTimpJucat[32], lData[32], cTime[4], fTime[32], fullIp = false
   if (get_user_flags(id) & ADMIN_KICK)
      fullIp = true
   xLen = format(xMOTD[xLen], 2047-xLen, "<body bgcolor=#000000><font size=3 color=FFFFFF><pre><center>")
   xLen += format(xMOTD[xLen], 2053-xLen, "<b>Informatii despre ultimii [%d] jucatori deconectati.^n", LASTIP_RECORD)
   xLen += format(xMOTD[xLen], 2047-xLen, "%9s %27s %18s %21s %10s^n^n", "ORA", "NUME", "IP", "STEAM", "TIMP JUCAT")
   for (new i=0;i < LastIPNum;i++)
   {
      parse(LastIP[i], lNume, 31, lIp, 31, lSteam, 31, lTimpJucat, 31, lData, 31)
      ConvertTime(str_to_num(lTimpJucat), cTime, false)
      format(fTime, 31, "%do%dm%ds", cTime[1], cTime[2], cTime[3])
      replace_all(lNume, 31, "<", "")
      replace_all(lNume, 31, ">", "")
      if (!fullIp)
         copy(lIp, 31, getClassIp(lIp))
      xLen += format(xMOTD[xLen], 2047-xLen, "%9s %27s %18s %21s %10s^n", lData, lNume, lIp, lSteam, fTime)
   }
   show_motd(id, xMOTD, "Info Jucatori Deconectati")
}

lastAdd(id)
{
   new lNume[32], lIp[32], lSteam[32], lTimpJucat, Time[32]
   get_user_name(id, lNume, 31)
   get_user_ip(id, lIp, 31, 1)
   get_user_authid(id, lSteam, 31)
   lTimpJucat = get_user_time(id, 1)
   get_time("%H:%M:%S", Time, 31)
   if (equal(lNume, LastNume))
      return
   if (LastIPNum == LASTIP_RECORD)
   {
      // Reorganizare
      for (new i=1;i < LASTIP_RECORD;i++)
         copy(LastIP[i-1], 255, LastIP[i])
      format(LastIP[LastIPNum-1], 255, "^"%s^" ^"%s^" ^"%s^" ^"%d^" ^"%s^"", lNume, lIp, lSteam, lTimpJucat, Time)
   }
   else
   {
      format(LastIP[LastIPNum], 255, "^"%s^" ^"%s^" ^"%s^" ^"%d^" ^"%s^"", lNume, lIp, lSteam, lTimpJucat, Time)
      LastIPNum++
   }
   copy(LastNume, 31, lNume)
   return
}

/* ==========================================================================================
===================================================== Global Stock
========================================================================================== */
stock FileStatus(fisier[])
{
   if (file_exists(fisier))
   {
      server_print("Fisier incarcat: %s",  fisier)
      log_amx("Fisier incarcat: %s", fisier)
      return true
   }
   else
   {
      server_print("Fisier creeat: %s", fisier)
      log_amx("Fisier creeat: %s", fisier)
      return false
   }
   return false
}

stock chatLOG(id, msg[], bad[], normal=true)
{
   if (is_user_connected(id))
   {
      new nume[32], Ip[32], Steam[32], Echipa, formChat[512], data[32], wS[128], Team[32]
      get_user_name(id, nume, 31)
      get_user_ip(id, Ip, 31, 1)
      get_user_authid(id, Steam, 31)
      Echipa = get_user_team(id)
      if (normal)
      {
         if (get_user_flags(id) & ADMIN_KICK)
         {
            copy(wS, 127, sAdminSay)
            get_time("%d.%m.%Y %H:%M:%S", data, 31)
         }
         else
         {
            copy(wS, 127, sRegSay)
            get_time("%H:%M:%S", data, 31)
         }
         switch(Echipa)
         {
            case 1: format(Team, 31, "T")
            case 2: format(Team, 31, "CT")
            case 3: format(Team, 31, "SPEC")
            default: format(Team, 31, "---")
         }
         format(formChat, 511, "[%s][%28s][%15s][%25s][%4s][%s]: %84s -> %s", data, nume, Ip, Steam, Team, is_user_alive(id) ? "V" : "M", msg, bad)
         write_file(wS, formChat, -1)
      }
      else
      {
         copy(wS, 127, sRegSay)
         get_time("%H:%M:%S", data, 31)
         format(formChat, 511, "[%s][%28s][%15s][%25s][%4s][%s]-> %84s", data, nume, Ip, Steam, TeamName[Echipa], is_user_alive(id) ? "V" : "M", msg)
         write_file(wS, formChat, -1)
      }
   }
}

stock stats_LOG(fm, nume[]="", time=0, ip[]="", sk=0, sh=0, sr=0, sd=0, ss=0, reg=0, vs=0, vd=0, vg=0)
{
   if (str_to_num(STATS_LOG))
   {
      if (fm == -1)
      {
         write_file(sStatsLog, "##########BUG FIX>      STATS COMPROMIS      >BUG FIX##########", -1)
         return
      }
      
      if (fm == -2)
      {
         write_file(sStatsLog, "@@@@@@@@@NO IP>      FURT DE IDENTITATE      >NO IP@@@@@@@@", -1)
         return
      }
      new form[256], data[32]
      new const inFo[][]=
      {
         "INFO",
         "CHCK",
         "UPD",
         "ERR",
         "NEW",
         "CNEW",
         "LAST",
         "ORIG",
         "FRD"
      }
      get_time("%H:%M:%S", data, 31)
      format(form, 255, "[%s]-[%4s]-[%30s][%18s][TIME:%-6d]-[K:%-5d][H:%-5d][R:%-5d][D:%-5d][S:%-5d]-[REG:%d]-[%-14d %-3d %-2d]",\
      data, inFo[fm], nume, ip, time, sk, sh, sr, sd, ss, reg, vs, vd, vg)
      write_file(sStatsLog, form, -1)
   }
   return
}

stock gc_LOG(id=0, premiu)
{
   new form[256], data[32], Nume[32]
   get_time("%H:%M:%S", data, 31)
   if (id != 0)
      get_user_name(id, Nume, 31)
   else
      format(Nume, 31, "---------------")
   format(form, 255, "[%s]-[%32s]", data, Nume)
   switch(premiu)
   {
      case 1: format(form, 255, "%s-[x2 XP]", form)
      case 2: format(form, 255, "%s-[x2 KILL]", form)
      case 3: format(form, 255, "%s-[x2 DEATH]", form)
      case 4: format(form, 255, "%s-[x2 KILL + HS]", form)
      case 5: format(form, 255, "%s-[VIP1 (1zi)]", form)
      case 6: format(form, 255, "%s-[x2 PUNCTE]", form)
      case 7: format(form, 255, "%s-[30 PUNCTE]", form)
      default: format(form, 255, "%s-[%d PUNCT%s]", form, cvGCuvantPuncte, cvGCuvantPuncte == 1 ? "" : "e")
   }
   write_file(sGcLog, form, -1)
}

stock bool:ValidMap(mapname[]) {
   if (is_map_valid(mapname))
      return true
   new len = strlen(mapname) - 4
   if (len < 0)
      return false
   if (equali(mapname[len], ".bsp")) 
   {
      mapname[len] = '^0'
      if (is_map_valid(mapname))
         return true
   }
   return false
}

stock xColor(const id, const input[], any:...)
{
   new count = 1, players[32]
   static msg[320], msg2[320]
   vformat(msg, 190, input, 3)
   format(msg2, 190, "!n[!g%s!n] %s", TAG, msg)
   replace_all(msg2, 190, "!g", "^4")
   replace_all(msg2, 190, "!n", "^1")
   replace_all(msg2, 190, "!t", "^3")
   replace_all(msg2, 190, "!t2", "^0")
   if (id)
      players[0] = id
   else
      get_players(players, count, "ch")
   for (new i = 0; i < count; i++)
   {
      if (is_user_connected(players[i]))
      {
         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
         write_byte(players[i])
         write_string(msg2)
         message_end()
      }
   }
}

/* The End */
public plugin_end() {
   if (delete_file(sBlackList))
   {
      write_file(sBlackList, "; Model: ^"Latitudine Longitudine^" ^"Ip^" ^"Player^" ^"Durata^"", -1)
      write_file(sBlackList, "", -1)
   }
   if (locatiiNumLoad > 0)
   {
      new form[128], tm = time()
      for (new i=0;i < locatiiNumLoad;i++)
      {
         if (strlen(locatiiLocatie[i]) > 5)
         {
            if (locatiiTime[i] > tm)
            {
               format(form, 127, "^"%s^" ^"%s^" ^"%s^" ^"%d^"", locatiiLocatie[i], locatiiIp[i], locatiiPlayer[i], locatiiTime[i])
               write_file(sBlackList, form, -1)
            }
         }
      }
   }
   
   if (delete_file(sLastIp))
      for (new i=0;i < LASTIP_RECORD;i++)
         write_file(sLastIp, LastIP[i], i)
}