Forum

> > CS2D > Scripts > add rank for hc script
Forums overviewCS2D overview Scripts overviewLog in to reply

English add rank for hc script

1 reply
To the start Previous 1 Next To the start

old add rank for hc script

princeofpersia
User Off Offline

Quote
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
hc.user.USER_LEVELS = {
    { title = "Unregistered", level = hc.USER },
    "",
    { title = "VIP", level = hc.VIP },
    "",
    { title = "Moderator 1", level = hc.MODERATOR1 },
    { title = "Moderator 2", level = hc.MODERATOR2 },
    { title = "Moderator 3", level = hc.MODERATOR3 },
    "",
    { title = "CO-Administrator", level = hc.COADMINISTRATOR },
    { title = "Administrator", level = hc.ADMINISTRATOR }
}

hc.user.COLOURS = {
    [hc.SPEC] = "",
    [hc.T] = hc.T_RED,
    [hc.CT] = hc.CT_BLUE
}

hc.user.SHORT_NAMES = {
    [hc.USER] = "User",
    [hc.VIP] = "VIP",
    [hc.MODERATOR1] = "Mod1",
    [hc.MODERATOR2] = "Mod2",
    [hc.MODERATOR3] = "Mod3",
    [hc.COADMINISTRATOR] = "coAdm",
    [hc.ADMINISTRATOR] = "Adm"
}

hc.user.NAME_TO_LEVEL = {
    VIP = hc.VIP,
    Mod1 = hc.MODERATOR1,
    Mod2 = hc.MODERATOR2,
    Mod3 = hc.MODERATOR3,
    coAdm = hc.COADMINISTRATOR,
    Adm = hc.ADMINISTRATOR
}

i tried to add this rank but i got this error .

LUA ERROR: sys/lua/hc/core/user.lua:34: table index is nil

and i changed constant lua too
hc.USER = -1
hc.VIP = 0
hc.MODERATOR1 = 1
hc.MODERATOR2 = 2
hc.MODERATOR3 = 3
hc.COADMINISTRATOR = 4
hc.ADMINISTRATOR = 5

please help me

old Re: add rank for hc script

cs2d_is_a_Gem
User Off Offline

Quote
Hello I will help you ;o
how to create a hc rank correctly


step 1 ''Add level in user.lua'':
Ej:
1
2
3
4
5
6
7
8
9
10
11
12
hc.user.USER_LEVELS = {
    { title = "Unregistered", level = hc.USER },
    "",
    { title = "VIP", level = hc.VIP },
	"",
    { title = "Super VIP", level = hc.SVIP },
    "",
    { title = "Moderator 1", level = hc.MODERATOR1 },
    { title = "Moderator 2", level = hc.MODERATOR2 },
    "",
    { title = "Administrator", level = hc.ADMINISTRATOR }
}

step 2 .'' add short names''
1
2
3
4
5
6
7
8
hc.user.SHORT_NAMES = {
    [hc.USER] = "User",
    [hc.VIP] = "VIP",
	[hc.SVIP] = "SVIP",
    [hc.MODERATOR1] = "Mod1",
    [hc.MODERATOR2] = "Mod2",
    [hc.ADMINISTRATOR] = "Adm"
}

step 3 '' add in the name_to_level''
1
2
3
4
5
6
7
hc.user.NAME_TO_LEVEL = {
    VIP = hc.VIP,
	SVIP = hc.SVIP,
    Mod1 = hc.MODERATOR1,
    Mod2 = hc.MODERATOR2,
    Adm = hc.ADMINISTRATOR
}


add in api: '' function''

1
2
3
4
5
6
7
function hc.is_vip(p)
    return hc.get_level(p) >= hc.VIP
end

function hc.is_svip(p)
    return hc.get_level(p) >= hc.SVIP
end



that's to create a range but adding permissions and commands is a little more complicated
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview