English Reset Scores for Hc.

5 replies
Goto Page
To the start Previous 1 Next To the start
10.07.18 10:16:32 am
Up
Man Of Steel
User
Offline Off
Hi folks,
i came here for ask some help and fix my lua code for Hc Admin script.

i want to replace Reset Stats option to Reset scores respectively.

Code sys > lua > hc > modules > playerstats in Line 234 code of Reset Stats.

Code:
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
function hc.playerstats.reset_command(p)
    local entries = {
        { title = "Yes: Reset my stats!", value = true, id = p },
        { title = "No!", value = false, id = p }
    }
    hc.show_menu(p, "Reset Stats?", entries, hc.playerstats.reset_cb)
end

function hc.playerstats.reset_cb(p, _, item)
    if item.value then
        hc.players[p].playerstats = hc.playerstats.get_empty_stats();
        hc.players[p].playerstats.next_lvl = 1
        hc.players[p].playerstats.saved = hc.playerstats.get_empty_stats();

        local usgn = hc.get_usgn(p)

        if hc.playerstats.usgn[usgn] ~= nil then
        -- Move players up on the top list
            for pos=hc.playerstats.usgn[usgn].position,#hc.playerstats.top - 1 do
                hc.playerstats.top[pos] = hc.playerstats.top[pos + 1]
                hc.playerstats.top[pos].position = pos
            end
            hc.playerstats.usgn[usgn] = nil
            hc.playerstats.top[#hc.playerstats.top] = nil
        end
        hc.event(p, "\169255255000[SERVER]\169255255255: Your statistics have been reset.")
    else
        hc.event(p, "\169255255000[SERVER]\169255255255: Your statistics were not reset.")
    end
end


i want remove reset stats system and add reset scores.
Replace " Yes Reset my stats" to "Yes" And "No!" to 'No"
If click on "Yes" so our scores reset and msg appear "Scores reset" or if click on "No" so nothing happen

i really hard to did it myself but i got errors and was some confutions in parse fuction

Please help me.
edited 1×, last 11.07.18 05:57:45 am
FRiendly boYy.
10.07.18 10:23:47 am
Up
script favor
User
Offline Off
omg , just unload them in hc.conf
Visit my website : https://bounty-mafia.tk , Discord : https://discord.gg/ntNd6TX, IMG:http://i60.tinypic.com/5kixc8.gif
10.07.18 05:38:13 pm
Up
Man Of Steel
User
Offline Off
What do you mean? @user script favor:
FRiendly boYy.
22.05.19 10:28:32 am
Up
G3tWr3ck3d
User
Offline Off
Inside
Code:
1
hc/modules/playerstats.lua


Search for function
Code:
1
function hc.playerstats.init()

Add inside that function:
Code:
1
hc.add_menu_command("Reset Score", hc.playerstats.reset_score_command, hc.USER, hc.COMMAND_MENU_KEY, { category = "Activity" })


Scroll down and find a place to add the new functions:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function hc.playerstats.reset_score_command(p)
    local entries = {
        { title = "Yes: Reset my score!", value = true, id = p },
        { title = "No!", value = false, id = p }
    }
    hc.show_menu(p, "Reset Score?", entries, hc.playerstats.reset_score_cb)
end

function hc.playerstats.reset_score_cb(p, _, item)
     if item.value then
          if player(p,"deaths") > 0 or player(p,"score") > 0 then
               parse("setscore "..p.." 0")
               parse("setdeaths "..p.." 0")          
               hc.event(p, "Your score has been reset.")
          else
               hc.event(p, "Your score is already nullified.")
          end
     else
          hc.event(p, "Your score did not reset.")
     end
end


This should add you a new menu without removing the Reset Activity Menu. If you want to Disable the Reset Activity Menu then do the following:

Inside
Code:
1
function hc.playerstats.init()

Replace
Code:
1
hc.add_menu_command("Reset", hc.playerstats.reset_command, hc.RESET_STATS_LEVEL, hc.COMMAND_MENU_KEY, { category = "Activity" })

With the following:
Code:
1
--     hc.add_menu_command("Reset", hc.playerstats.reset_command, hc.RESET_STATS_LEVEL, hc.COMMAND_MENU_KEY, { category = "Activity" })


And you should be good to go √
Mess with the best, die like the rest. ༼ つ ◕_◕ ༽つ
22.05.19 07:22:57 pm
Up
Man Of Steel
User
Offline Off
my problems almost had already solved but thank so you much for taking your time for me.
FRiendly boYy.
22.05.19 07:55:12 pm
Up
G3tWr3ck3d
User
Offline Off
@user Man Of Steel: add my discord if you have any other questions
YursTrulyLeader#4084
Cheers ∗
Mess with the best, die like the rest. ༼ つ ◕_◕ ༽つ
To the start Previous 1 Next To the start