+ Reply to Thread
Results 1 to 2 of 2
  1. Score Board Leader

    #1
    Banned DarkRed's Avatar
    Member since
    Dec 2013
    Location
    Pitesti
    Posts
    728
    Last username
    Justice01 TITAN Tetrahidrocanabinol
    Mentioned
    0 Post(s)
    Achievements Total Posts 2 Total Posts 1 Days Since Last Visited 2 Days Since Last Visited 1 Days Registered 3 Days Registered 2 Days Registered 1 Threads 2

    Score Board Leader

    Descriere:Acest plugin v-a afisa in chatul jucatorilor jucatorul cu cel mai mare scor. Cand acesta este depasit, liderul nou v-a fi afisat in chat. Cand un jucator se deconecteaza sau isi reseteaza scorul, urmatorul High Score v-a trece lider.
    Plugin: Leader Board
    Versiune: 1.1
    Autor: Natsu (aka RovlX/Cat Sith')
    Link oficial: -
    Download link:
    SMA
    #include <amxmodx>

    #define Autor "Natsu"
    #define Versiune "1.1"
    #define Nume "Leader Board"

    new cvar_on, cvar_tag, cvar_show, cvar_hudcolor, cvar_hudposition
    new TaG[8], r, kills[32], HasALeader = 0, bool:Something, Count = 0, OldMaxKills = 0, OldMaxKillsID = 0, rMaxKills = 0,
    rMaxKillsID = 0, SyncShowLeader

    public plugin_init(){
    register_plugin(Nume, Versiune, Autor)

    register_dictionary("score_leader.txt")

    register_event("HLTV", "NewRoundEvent", "a", "1=0", "2=0")

    cvar_tag = register_cvar("leader_board_tag", "Leader")
    cvar_on = register_cvar("leader_board", "1")
    cvar_show = register_cvar("leader_board_show", "1")
    cvar_hudcolor = register_cvar("leader_board_hudcolor", "255 170 0")
    cvar_hudposition = register_cvar("leader_board_hudposition", "0.05 -1.0")

    get_pcvar_string(cvar_tag, TaG, charsmax(TaG))

    SyncShowLeader = CreateHudSyncObj()

    set_task(0.5, "rLeaderCheckTask", _, _, _, "b", 0)
    }

    public rLeaderCheckTask(){
    if(get_pcvar_num(cvar_on) == 0){
    return PLUGIN_HANDLED
    }

    new rPlayers[32], rNum, rPID
    get_players(rPlayers, rNum)

    if(get_user_frags(rMaxKillsID) == 0){
    if(!is_user_connected(rMaxKillsID)){
    OldMaxKills = 0
    OldMaxKillsID = 0
    rMaxKills = 0
    rMaxKillsID = 0

    if(Count > 0)ColorChatAlpha(0, "%L", LANG_PLAYER, "DISCONNECTED", TaG)

    Count = 0
    }
    OldMaxKills = 0
    OldMaxKillsID = 0
    rMaxKills = 0
    rMaxKillsID = 0

    if(Count > 0)ColorChatAlpha(0, "%L", LANG_PLAYER, "RESET_SCORE", TaG)

    Count = 0
    }

    for(r = 0;r < rNum;r++){
    rPID = rPlayers[r]
    kills[rPID] = get_user_frags(rPID)

    if(Count == 0){
    if(get_user_frags(rPID) == 0){
    Something = false
    }
    else {
    Something = true
    Count++
    }
    }

    ShowWhosLeader(rPID)

    if(kills[rPID] > kills[rMaxKillsID]){
    rMaxKillsID = rPID
    rMaxKills = kills[rMaxKillsID]
    }
    }

    if(!Something)return PLUGIN_HANDLED

    CheckLeader(rMaxKillsID)

    return PLUGIN_HANDLED
    }

    public CheckLeader(rMaxKillsID){
    if(OldMaxKills == rMaxKills || OldMaxKillsID == rMaxKillsID)
    return

    if(rMaxKills > 0 && HasALeader == 0){
    ColorChatAlpha(0, "%L", LANG_PLAYER, "THE_LEADER", TaG, get_pname(rMaxKillsID), kills[rMaxKillsID], kills[rMaxKillsID] == 1 ? "" : "s", get_user_deaths(rMaxKillsID), get_user_deaths(rMaxKillsID) == 1 ? "" : "s")
    HasALeader = 1
    OldMaxKills = get_user_frags(rMaxKillsID)
    OldMaxKillsID = rMaxKillsID
    }
    else if(rMaxKills > 0 && HasALeader == 1){
    ColorChatAlpha(0, "%L", LANG_PLAYER, "THE_NEW_LEADER", TaG, get_pname(rMaxKillsID), kills[rMaxKillsID], kills[rMaxKillsID] == 1 ? "" : "s", get_user_deaths(rMaxKillsID), get_user_deaths(rMaxKillsID) == 1 ? "" : "s")
    OldMaxKills = rMaxKills
    OldMaxKillsID = rMaxKillsID
    }
    }

    public ShowWhosLeader(id){
    if(get_pcvar_num(cvar_show) == 1){
    static hud_red, hud_green, hud_blue, Float:hud_x, Float:hud_y

    new color[16], red[4], green[4], blue[4], position[19], positionX[6], positionY[6]
    get_pcvar_string(cvar_hudcolor, color, 15)
    get_pcvar_string(cvar_hudposition, position, 18)
    parse(color, red, 3, green, 3, blue, 3)
    parse(position, positionX, 6, positionY, 6)

    hud_red = str_to_num(red)
    hud_green = str_to_num(green)
    hud_blue = str_to_num(blue)
    hud_x = str_to_float(positionX)
    hud_y = str_to_float(positionY)

    if(!Something){
    set_hudmessage(hud_red, hud_green, hud_blue, hud_x, hud_y, 0, 0.5, 0.5)
    ShowSyncHudMsg(id, SyncShowLeader, "[The Leader]^n%s", "Still no Leader")
    }
    else {
    set_hudmessage(hud_red, hud_green, hud_blue, hud_x, hud_y, 0, 0.5, 0.5)
    ShowSyncHudMsg(id, SyncShowLeader, "[The Leader]^n%s", get_pname(rMaxKillsID))
    }
    }
    }

    public NewRoundEvent(id){
    if(get_pcvar_num(cvar_show) == 2){
    if(!Something){
    ColorChatAlpha(id, "%L", LANG_PLAYER, "STILL_NO_LEADER2", TaG)
    }
    else {
    ColorChatAlpha(id, "%L", LANG_PLAYER, "CURRENT_LEADER", TaG, get_pname(rMaxKillsID))
    }
    }
    }

    stock get_pname(index){
    new rName[32]
    get_user_name(index, rName, charsmax(rName))

    return rName
    }

    stock ColorChatAlpha(index, const text[], any:...){
    new MaxPlayers, MsgSayText
    static Msg[128]
    vformat(Msg, sizeof(Msg) - 1, text, 3)

    replace_all(Msg, sizeof(Msg) - 1, "!g", "^x04")
    replace_all(Msg, sizeof(Msg) - 1, "!n", "^x01")
    replace_all(Msg, sizeof(Msg) - 1, "!t", "^x03")

    MaxPlayers = get_maxplayers()
    MsgSayText = get_user_msgid("SayText")

    if(!index){
    for(new i = 0; i < MaxPlayers; i++){
    if(!is_user_connected(i))
    continue;

    message_begin(MSG_ONE_UNRELIABLE, MsgSayText, _, i)
    write_byte(i)
    write_string(Msg)
    message_end()
    }
    }
    }


    TXT

    [en]
    DISCONNECTED = !n[!g%s!n] The Leader has disconnected or was kicked.
    RESET_SCORE = !n[!g%s!n] The Leader has reseted his score.

    THE_LEADER = !n[!g%s!n] The !tLeader !nin board is !t%s !nwith !g%d !nkill%s and !g%d !ndeath%s.
    THE_NEW_LEADER = !n[!g%s!n] The new !tLeader !nin board is !t%s !nwith !g%d !nkill%s and !g%d !ndeath%s.

    STILL_NO_LEADER = !n[!g%s!n] Still no one is Leader

    CURRENT_LEADER = !n[!g%s!n] The current Leader is !g%s

    [ro]
    DISCONNECTED = !n[!g%s!n] Liderul s-a deconectat sau a fost dat afara.
    RESET_SCORE = !n[!g%s!n] Liderul si-a resetat scorul.

    THE_LEADER = !n[!g%s!n] !tLiderul !nin tabelul scorurilor este !t%s !ncu !g%d !nkill%s si !g%d !ndeath%s.
    THE_NEW_LEADER = !n[!g%s!n] Noul !tLider !nin tabelul scorurilor este !t%s !ncu !g%d !nkill%s si !g%d !ndeath%s.

    STILL_NO_LEADER = !n[!g%s!n] Inca nimeni nu este Lider

    CURRENT_LEADER = !n[!g%s!n] Liderul actual este !g%s


    Instalare:
    1.Fisierul score_leader.amxx il puneti in addons/amxmodx/plugins.
    [Optional]: Fisierul score_leader.txt il puneti in addons/amxmodx/data/lang..
    2.Intrati în addons/amxmodx/configs/plugins.ini si adaugati la urma: score_leader.amxx .

    Comenzi(chat/consola):-

    Cvar-uri:leader_board 1/0 - Activare/Dezactivare plugin (1 - Activ, 0 - Inactiv; Default 1)
    leader_board_tag "Leader" - Tag in chat (Default: "Leader")
    leader_board_show 0/1/2 - Activare/Comutare (0 - Nu arata Liderul actual, 1 - Arata permanent Liderul actual in HUD, 2 - Arata la inceput de runda in chat Liderul Actual) (Default: 1)
    leader_board_hudcolor "R G B" - Culoarea HUD-ului in R G B (Default: "255 170 0") (Recomand: "255 0 255"[Fuxia])
    leader_board_hudposition "X Y" - Pozitia HUD-ului pe ecran (Default: "0.05 -1.0") - Centrat pe verticala, pozitionat spre stanga.


    Modules (gen: sockets/orpheu/etc.):-

    Natives (daca exista):-

    Screenshot (daca exista):










    Last edited by ~TraNda~; 11-08-2017 at 04:14 AM.

  2. Score Board Leader

    #2
    VIP ~TraNda~'s Avatar
    Member since
    Feb 2014
    Location
    WarGods
    Posts
    12,100
    Last username
    LiOn. ~JoK3r ~
    Blog Entries
    4
    Mentioned
    95 Post(s)
    Achievements Days Registered 4 Mentions Received 2 Mentions Received 1 Mentions Given 4 Mentions Given 3 Mentions Given 2 Mentions Given 1 Threads Rating Received 1
    Doneaza
    Sustine Comunitatea WarGods!
    Fii unul de-al nostru! Doneaza
    Doneaza in Cont Bancar
    Click aici pentru a face o Donatie

    Update


    SMA
    #include <amxmodx>

    #define Autor "Natsu"
    #define Versiune "1.1"
    #define Nume "Leader Board"

    new cvar_on, cvar_tag, cvar_show, cvar_hudcolor, cvar_hudposition
    new TaG[8], r, kills[32], HasALeader = 0, bool:Something, Count = 0, OldMaxKills = 0, OldMaxKillsID = 0, rMaxKills = 0,
    rMaxKillsID = 0, SyncShowLeader

    public plugin_init(){
    register_plugin(Nume, Versiune, Autor)

    register_dictionary("score_leader.txt")

    register_event("HLTV", "NewRoundEvent", "a", "1=0", "2=0")

    cvar_tag = register_cvar("leader_board_tag", "Leader")
    cvar_on = register_cvar("leader_board", "1")
    cvar_show = register_cvar("leader_board_show", "1")
    cvar_hudcolor = register_cvar("leader_board_hudcolor", "255 170 0")
    cvar_hudposition = register_cvar("leader_board_hudposition", "0.05 -1.0")

    get_pcvar_string(cvar_tag, TaG, charsmax(TaG))

    SyncShowLeader = CreateHudSyncObj()

    set_task(0.5, "rLeaderCheckTask", _, _, _, "b", 0)
    }

    public rLeaderCheckTask(){
    if(get_pcvar_num(cvar_on) == 0){
    return PLUGIN_HANDLED
    }

    new rPlayers[32], rNum, rPID
    get_players(rPlayers, rNum)

    if(get_user_frags(rMaxKillsID) == 0){
    if(!is_user_connected(rMaxKillsID)){
    OldMaxKills = 0
    OldMaxKillsID = 0
    rMaxKills = 0
    rMaxKillsID = 0

    if(Count > 0)ColorChatAlpha(0, "%L", LANG_PLAYER, "DISCONNECTED", TaG)

    Count = 0
    }
    OldMaxKills = 0
    OldMaxKillsID = 0
    rMaxKills = 0
    rMaxKillsID = 0

    if(Count > 0)ColorChatAlpha(0, "%L", LANG_PLAYER, "RESET_SCORE", TaG)

    Count = 0
    }

    for(r = 0;r < rNum;r++){
    rPID = rPlayers[r]
    kills[rPID] = get_user_frags(rPID)

    if(Count == 0){
    if(get_user_frags(rPID) == 0){
    Something = false
    }
    else {
    Something = true
    Count++
    }
    }

    ShowWhosLeader(rPID)

    if(kills[rPID] > kills[rMaxKillsID]){
    rMaxKillsID = rPID
    rMaxKills = kills[rMaxKillsID]
    }
    }

    if(!Something)return PLUGIN_HANDLED

    CheckLeader(rMaxKillsID)

    return PLUGIN_HANDLED
    }

    public CheckLeader(rMaxKillsID){
    if(OldMaxKills == rMaxKills || OldMaxKillsID == rMaxKillsID)
    return

    if(rMaxKills > 0 && HasALeader == 0){
    ColorChatAlpha(0, "%L", LANG_PLAYER, "THE_LEADER", TaG, get_pname(rMaxKillsID), kills[rMaxKillsID], kills[rMaxKillsID] == 1 ? "" : "s", get_user_deaths(rMaxKillsID), get_user_deaths(rMaxKillsID) == 1 ? "" : "s")
    HasALeader = 1
    OldMaxKills = get_user_frags(rMaxKillsID)
    OldMaxKillsID = rMaxKillsID
    }
    else if(rMaxKills > 0 && HasALeader == 1){
    ColorChatAlpha(0, "%L", LANG_PLAYER, "THE_NEW_LEADER", TaG, get_pname(rMaxKillsID), kills[rMaxKillsID], kills[rMaxKillsID] == 1 ? "" : "s", get_user_deaths(rMaxKillsID), get_user_deaths(rMaxKillsID) == 1 ? "" : "s")
    OldMaxKills = rMaxKills
    OldMaxKillsID = rMaxKillsID
    }
    }

    public ShowWhosLeader(id){
    if(get_pcvar_num(cvar_show) == 1){
    static hud_red, hud_green, hud_blue, Float:hud_x, Float:hud_y

    new color[16], red[4], green[4], blue[4], position[19], positionX[6], positionY[6]
    get_pcvar_string(cvar_hudcolor, color, 15)
    get_pcvar_string(cvar_hudposition, position, 18)
    parse(color, red, 3, green, 3, blue, 3)
    parse(position, positionX, 6, positionY, 6)

    hud_red = str_to_num(red)
    hud_green = str_to_num(green)
    hud_blue = str_to_num(blue)
    hud_x = str_to_float(positionX)
    hud_y = str_to_float(positionY)

    if(!Something){
    set_hudmessage(hud_red, hud_green, hud_blue, hud_x, hud_y, 0, 0.5, 0.5)
    ShowSyncHudMsg(id, SyncShowLeader, "[The Leader]^n%s", "Still no Leader")
    }
    else {
    set_hudmessage(hud_red, hud_green, hud_blue, hud_x, hud_y, 0, 0.5, 0.5)
    ShowSyncHudMsg(id, SyncShowLeader, "[The Leader]^n%s", get_pname(rMaxKillsID))
    }
    }
    }

    public NewRoundEvent(id){
    if(get_pcvar_num(cvar_show) == 2){
    if(!Something){
    ColorChatAlpha(id, "%L", LANG_PLAYER, "STILL_NO_LEADER2", TaG)
    }
    else {
    ColorChatAlpha(id, "%L", LANG_PLAYER, "CURRENT_LEADER", TaG, get_pname(rMaxKillsID))
    }
    }
    }

    stock get_pname(index){
    new rName[32]
    get_user_name(index, rName, charsmax(rName))

    return rName
    }

    stock ColorChatAlpha(index, const text[], any:...){
    new MaxPlayers, MsgSayText
    static Msg[128]
    vformat(Msg, sizeof(Msg) - 1, text, 3)

    replace_all(Msg, sizeof(Msg) - 1, "!g", "^x04")
    replace_all(Msg, sizeof(Msg) - 1, "!n", "^x01")
    replace_all(Msg, sizeof(Msg) - 1, "!t", "^x03")

    MaxPlayers = get_maxplayers()
    MsgSayText = get_user_msgid("SayText")

    if(!index){
    for(new i = 0; i < MaxPlayers; i++){
    if(!is_user_connected(i))
    continue;

    message_begin(MSG_ONE_UNRELIABLE, MsgSayText, _, i)
    write_byte(i)
    write_string(Msg)
    message_end()
    }
    }
    }


    TXT

    [en]
    DISCONNECTED = !n[!g%s!n] The Leader has disconnected or was kicked.
    RESET_SCORE = !n[!g%s!n] The Leader has reseted his score.

    THE_LEADER = !n[!g%s!n] The !tLeader !nin board is !t%s !nwith !g%d !nkill%s and !g%d !ndeath%s.
    THE_NEW_LEADER = !n[!g%s!n] The new !tLeader !nin board is !t%s !nwith !g%d !nkill%s and !g%d !ndeath%s.

    STILL_NO_LEADER = !n[!g%s!n] Still no one is Leader

    CURRENT_LEADER = !n[!g%s!n] The current Leader is !g%s

    [ro]
    DISCONNECTED = !n[!g%s!n] Liderul s-a deconectat sau a fost dat afara.
    RESET_SCORE = !n[!g%s!n] Liderul si-a resetat scorul.

    THE_LEADER = !n[!g%s!n] !tLiderul !nin tabelul scorurilor este !t%s !ncu !g%d !nkill%s si !g%d !ndeath%s.
    THE_NEW_LEADER = !n[!g%s!n] Noul !tLider !nin tabelul scorurilor este !t%s !ncu !g%d !nkill%s si !g%d !ndeath%s.

    STILL_NO_LEADER = !n[!g%s!n] Inca nimeni nu este Lider

    CURRENT_LEADER = !n[!g%s!n] Liderul actual este !g%s
    -------------

    TraNda - WarGods | R.R.M - AngeL - LiOn. - pichacku - Jok3r - UnicA

    P A C E

    DISCORD: unknown.cfg


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Partners
Humble Monthly Bundle
Voucher PC-Garage