Официалният форум на iPlay.bg 

  • Заявка за Bomb Plant/Defuse = Money & XP Bonus

  • Искате да ви намерим определен плъгин, или пък да ви изработим такъв? Пишете тук!
Искате да ви намерим определен плъгин, или пък да ви изработим такъв? Пишете тук!
 #411613  от GOSH
 вт апр 18, 2017 9:48 am
Здравейте iplay потребители
Мисля че има такъв плъгин, но това което той предлага като функция, не ми е достатъчно, затова реших да пусна заявка за изработка на такъв подобен.
Информация:
Когато някой играч заложи (C4)бомбата, да му дава бонус пари 350$ + 2XP за ранкинг системата.
И обратното, когато даден играч обезвреди бомбата, да получи бонус пари 350$ + 2XP.
Чат съобщение [CLASSIC] Nick получи 500$ и 2XP, защото успешно заложи бомбата.
[CLASSIC] Nick получи 350$ и 2XP, защото успешно обезвреди бомбата.
Мерси.
 #411662  от GOSH
 ср апр 19, 2017 8:40 am
OciXCrom™ написа:
вт апр 18, 2017 7:43 pm
Каква ранкинг система?!?!
Нещо подобно на тази, функциите им на всички са едно към едно.
Код: Избери всички
    #include <amxmodx>
    #include <amxmisc>  
    #include <cstrike>
    #include <chatcolor>
    #include <fvault>

    #define MaxLevels 21
    #define IsPlayer(%1) (1 <= %1 <=  g_iMaxPlayers)

    #define ADMIN1 "Server Owner"
    #define ADMIN1_ACCESS ADMIN_LEVEL_A

    #define ADMIN2 "Globalen Admin"
    #define ADMIN2_ACCESS ADMIN_LEVEL_B

    #define ADMIN3 "Globalen Admin"
    #define ADMIN3_ACCESS ADMIN_LEVEL_C

    #define ADMIN4 "Admin"
    #define ADMIN4_ACCESS ADMIN_LEVEL_D

    #define ADMIN5 "SMS Admin"
    #define ADMIN5_ACCESS ADMIN_LEVEL_E

    #define ADMIN6 "V.I.P+"
    #define ADMIN6_ACCESS ADMIN_LEVEL_F

    #define ADMIN7 "V.I.P"
    #define ADMIN7_ACCESS ADMIN_LEVEL_G

    new gMaxPlayers, gMsgSayText, syncObj, Level[33], eXP[33]
    new ranks_hud, knife_xp, he_xp, hs_xp, kill_xp, kill_msg

    new const g_vault_name[] = "levelsz";

    new const Levels[MaxLevels] = 
    {
      25, 
      50, 
      70,   
      100, 
      130,
      160,
      190,
      220,
      250,
      300,
      350,
      400,
      450,
      500,
      600,
      700,
      800,
      900,
      1000,
      1100,
      1200
    }

    new const Prefix[MaxLevels +1][] =
    {
      "Bronze I", 
      "Bronze II", 
      "Bronze III",   
      "SILVER I", 
      "SILVER II",
      "SILVER III",
      "GOLD I",
      "GOLD II",
      "GOLD III",
      "CRYSTAL I",
      "CRYSTAL II",
      "CRYSTAL III",
      "MASTER I",
      "MASTER II",
      "MASTER III",
      "CHAMPION I",
      "CHAMPION II",
      "CHAMPION III",
      "TITAN I",
      "TITAN II",
      "TITAN III",
      "LEGEND"
    }

    public plugin_init() 
    {
        register_plugin("Ranks & XP mod", "1.0", "alt.nick")
        
        register_event("DeathMsg","client_death","a") 
        register_clcmd("say", "hook_say")
        register_clcmd("say_team", "hook_say")
        
        register_clcmd("say /rank", "cmdRank")
        register_clcmd("say_team /rank", "cmdRank")
        
        register_clcmd("say /reset", "reset_xp")
        register_clcmd("say_team /reset", "reset_xp")
        
        ranks_hud = register_cvar("ranks_hud", "1")     // Дали да се появява хъд при влизане в сървъра. Включено 1/0 Изключено
        knife_xp = register_cvar("knife_xp", "5")     // Колко ХР да дава за убийство с нож.
        he_xp = register_cvar("he_xp", "5")        // Колко ХР да дава за убийство с Granata (HE).
        hs_xp = register_cvar("hs_xp", "2")        // Колко ХР да дава за убийство с Headshot.
        kill_xp = register_cvar("kill_xp", "1")        // Колко ХР да дава за нормално убийство.    
        kill_msg = register_cvar("kill_msg", "0")    // Дали да показва кой сте убили и колко ХР сте получили. Включено 1/0 Изключено
        
        register_concmd ("amx_give_xp", "CmdAddXP", ADMIN_LEVEL_A, "<nick | ct | t | @all> <xp>")
        
        gMaxPlayers = get_maxplayers()
        gMsgSayText = get_user_msgid("SayText")

        syncObj     = CreateHudSyncObj()
        
        fvault_load(g_vault_name)
    }

    public ShowHud(id) 
    {
        set_hudmessage(142, 239, 39, -1.0, 0.01, 0, 6.0, 1.0, 0.0, 0.0, -1)
        ShowSyncHudMsg(id, syncObj,"Rank: %s ^nXP: %i ^nLevel: %i", Prefix[Level[id]], eXP[id], Level[id])
    }

    public client_putinserver(id)
    {
        if(get_pcvar_num(ranks_hud) == 1)
            set_task(1.0, "ShowHud", id, _, _, "b")
            
        if(Level[id] < MaxLevels-1)
            while(eXP[id] >= Levels[Level[id]])
                Level[id] += 1 
    }

    public client_death(killer, victim, weapon, hitgroup, TK)
    {        
        if(killer == victim)
            return PLUGIN_HANDLED
            
        new Name[20]
        get_user_name(victim, Name, 19)
        new headshot = (hitgroup == HIT_HEAD) ? 1 : 0
        
        if(get_user_team(killer) == 2 && killer != victim)
        {
            switch(weapon) 
            {
                case CSW_HEGRENADE:
                {
                    eXP[killer] += get_pcvar_num(he_xp)
                    CheckLevel(killer)
                    SaveData(killer)
                    if(get_pcvar_num(kill_msg) == 1)
                        client_print_color(killer, print_chat, "^4[Ranks]^1 poluchihte^4 %d XP^1 poradi ubiistwoto s^4 HE^1 na ^3%s^1.", get_pcvar_num(he_xp), Name)
                } 
                
                case CSW_KNIFE:
                {
                    eXP[killer] += get_pcvar_num(knife_xp)
                    CheckLevel(killer)
                    SaveData(killer)
                    if(get_pcvar_num(kill_msg) == 1)
                        client_print_color(killer, print_chat, "^4[Ranks]^1 poluchihte^4 %d XP^1 poradi ubiistwoto s^4 noj^1 na ^3%s^1.", get_pcvar_num(knife_xp) , Name)
                } 
            }
            
            if(headshot)
            {
                eXP[killer] += get_pcvar_num(hs_xp)
                CheckLevel(killer)
                SaveData(killer)
                if(get_pcvar_num(kill_msg) == 1)
                    client_print_color(killer, print_chat, "^4[Ranks]^1 poluchihte^4 2 XP^1 poradi ubiistwoto s^4 HS^1 na ^3%s^1.",get_pcvar_num(hs_xp),  Name)
            }
            else
            {
                eXP[killer] += get_pcvar_num(kill_xp)
                CheckLevel(killer)
                SaveData(killer)
                if(get_pcvar_num(kill_msg) == 1)
                    client_print_color(killer, print_chat, "^4[Ranks]^1 poluchihte^4 1 XP^1 poradi ubiistwoto na ^3%s^1.", get_pcvar_num(kill_xp), Name)
            }
        }
        CheckLevel(killer)
        SaveData(killer)
        return PLUGIN_CONTINUE
    }

    public CheckLevel(id)
    {
        if(Level[id] < MaxLevels-1)
            while(eXP[id] >= Levels[Level[id]])
                Level[id] += 1 
    }

    public client_connect(id)
    {
        LoadData(id)
    }


    public client_disconnect(id)
    {
        SaveData(id)
        eXP[id] = 0
        Level[id] = 0
        remove_task(id)
    }
            
    public reset_xp(id)
    {
        if(eXP[id] != 0)
        {
            Level[id] = 0
            eXP[id] = 0
            CheckLevel(id)
            client_print_color(id, print_chat, "^4[Ranks]^1 Yspeshno nulirani washite^4 XP^1 i ^4Level^1.")
        }
        else
            client_print_color(id, print_chat, "^4[Ranks]^1 Washite^4 XP^1 i ^4Level^1 weche sa nulirani.")
    }
            
    public cmdRank(id)
    {
        if(is_user_connected(id))
            client_print_color(id, print_chat, "^4[Ranks]^1 Rank:^4 %s^1 | XP:^4 %d^1 | Level:^4 %d^1.", Prefix[Level[id]], eXP[id], Level[id])
    }
            
    public CmdAddXP (iPlayer, level, cid)
    {
        if(!cmd_access(iPlayer, level, cid, 3)) return PLUGIN_HANDLED;
            
        new arg [32]
        read_argv (1, arg, 31) 
     
        new AddXP [32]
        read_argv (2, AddXP, charsmax (AddXP))
     
        new XPtoGive = str_to_num (AddXP)
            
        new AdminName [32]
        new TargetName [32]
        get_user_name (iPlayer, AdminName, charsmax (AdminName))
            
        if(arg[0]=='@')
        { 
            if(equali(arg[1],"All") || equali(arg[1],"ALL"))
            {
                new players[32], totalplayers, All
                get_players(players, totalplayers)
                 
                for (new i = 0; i < totalplayers; i++)
                {
                    All = players[i]
                            
                    eXP[All] += XPtoGive
                }
                
                CheckLevel(All)
                client_print_color(0, print_chat, "^4[Ranks]^1 ^3%s^1 dade^3 %i^1 XP na vsichki ^3igrachi^1!", AdminName, XPtoGive)
            }
            else if(equali(arg[1],"T") || equali(arg[1],"t"))
            {
                new players[32], totalplayers, T
                get_players(players, totalplayers)
                 
                for (new i = 0; i < totalplayers; i++)
                {
                    if (get_user_team(players[i]) == 1)
                    {
                        T = players[i]
                                
                        eXP[T] += XPtoGive
                    }
                }
                
                CheckLevel(T)
                client_print_color(0, print_chat, "^4[Ranks]^1 ^3%s^1 dade^3 %i^1 XP na vsichki ^3 Teroristi^1.", AdminName, XPtoGive)
            }
            else if(equali(arg[1],"CT") || equali(arg[1],"ct"))
            {
                new players[32], totalplayers, CT
                get_players(players, totalplayers)
                 
                for(new i = 0; i < totalplayers; i++)
                {
                    if(get_user_team(players[i]) == 2)
                    {
                        CT = players[i]
                                
                        eXP[CT] += XPtoGive
                    }
                }
                
                CheckLevel(CT)
                client_print_color(0, print_chat, "^4[Ranks]^1 ^3%s^1 dade^3 %i^1 XP na wsichki ^3 Kontra-Teroristi^1!", AdminName, XPtoGive)
            }
        }
        else
        {
            new iTarget = cmd_target(iPlayer, arg, 3)
            get_user_name (iTarget, TargetName, charsmax (TargetName))
            
            if(iTarget)
            {
                eXP[iTarget] += XPtoGive
                
                CheckLevel(iTarget)
                client_print_color(0, print_chat, "^4[Ranks]^1 ^3%s^1 dade^3 %i^1 XP na^3 %s^1.", AdminName, XPtoGive, TargetName)
            }
        }
        return PLUGIN_HANDLED
    }

    bool:IsValidMessage( szMessage[ ], iLen )
    {
        read_args( szMessage, iLen )
        remove_quotes( szMessage )
       
        new iPos, cChar
        while( 0 <= ( cChar = szMessage[ iPos++ ] ) <= 255 )
        {
            if( cChar != ' ' && cChar != '%' )
            {
                return true
            }
        }
       
        return false
    }

    public hook_say(id)
    {
        if(!is_user_connected(id)) 
            return PLUGIN_HANDLED_MAIN
        
        new szArgs[192]
        
        if( !IsValidMessage(szArgs, charsmax(szArgs))) 
            return PLUGIN_HANDLED_MAIN

        if(equal(szArgs,"")) return PLUGIN_HANDLED_MAIN

        
        new szName[32]
        get_user_name(id, szName, sizeof szName-1)

        new alive = is_user_alive(id)

        if(contain(szArgs,"@") >= 0) 
        return  PLUGIN_HANDLED_MAIN
     
        if(get_user_flags(id) & ADMIN1_ACCESS) 
        format(szArgs, 191,"^x04[%s] [%s] ^x03%s^x01 :^x04  %s", ADMIN1, Prefix[Level[id]], szName, szArgs)
        
        else if(get_user_flags(id) & ADMIN2_ACCESS) 
        format(szArgs, 191, "^x04[%s] [%s] ^x03%s^x01 :^x04  %s", ADMIN2, Prefix[Level[id]], szName, szArgs)
        
        else if(get_user_flags(id) & ADMIN3_ACCESS) 
        format(szArgs, 191, "^x04[%s] [%s] ^x03%s^x01 :^x04  %s", ADMIN3, Prefix[Level[id]], szName, szArgs)
        
        else if(get_user_flags(id) & ADMIN4_ACCESS) 
        format(szArgs, 191, "^x04[%s] [%s] ^x03%s^x01 :^x04  %s", ADMIN4, Prefix[Level[id]], szName, szArgs)

        else if(get_user_flags(id) & ADMIN5_ACCESS) 
        format(szArgs, 191, "^x04[%s] [%s] ^x03%s^x01 :^x04  %s", ADMIN5, Prefix[Level[id]], szName, szArgs)
        
        else if(get_user_flags(id) & ADMIN6_ACCESS) 
        format(szArgs, 191, "^x04[%s] [%s] ^x03%s^x01 :^x04  %s", ADMIN6, Prefix[Level[id]], szName, szArgs)

        else if(get_user_flags(id) & ADMIN7_ACCESS) 
        format(szArgs, 191, "^x04[%s] [%s] ^x03%s^x01 :^x04  %s", ADMIN7, Prefix[Level[id]], szName, szArgs)
        
        else 
        format(szArgs, 191, "^x04[%s] ^x03%s^x01 :  %s",  Prefix[Level[id]], szName, szArgs)

        for(new i = 1; i <= gMaxPlayers; i++)
        {
            if(!is_user_connected(i))
                continue
        
            if(alive && is_user_alive(i))
            {
                message_begin(MSG_ONE, gMsgSayText, {0, 0, 0}, i)
                write_byte(id)
                write_string(szArgs)
                message_end()
            } 
            else if(!alive && !is_user_alive(i)) 
            {
                new format[192]
                formatex(format,191,"^x01* DEAD %s",szArgs)
                message_begin(MSG_ONE, gMsgSayText, {0, 0, 0}, i)
                write_byte(id)
                write_string(format)
                message_end()
            }
        }
            
        return PLUGIN_HANDLED_MAIN
    }

    public SaveData(id)
    {
        new name[32];
        get_user_name(id,name,31);
        new vaultkey[64],vaultdata[256];
        
        format(vaultkey,63,"%s", name);
        format(vaultdata,255,"%i#%i#",eXP[id],Level[id]);
        fvault_set_data(g_vault_name,vaultkey,vaultdata);
        
        return PLUGIN_CONTINUE;
    }
    public LoadData(id)
    {
        new name[32];
        get_user_name(id,name,31);
        new vaultkey[64],vaultdata[256];
        
        format(vaultkey,63,"%s",name);
        format(vaultdata,255,"%i#%i#",eXP[id],Level[id]);
        fvault_get_data(g_vault_name,vaultkey,vaultdata,charsmax(vaultdata));
        
        replace_all(vaultdata, 255, "#", " ");
        new playerxp[32], playerlevel[32];
        parse(vaultdata, playerxp, 31, playerlevel, 31);
        
        eXP[id] = str_to_num(playerxp);
        Level[id] = str_to_num(playerlevel);
        
        return PLUGIN_CONTINUE;
    }