Forum

> > CS2D > Scripts > How to create script?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to create script?

15 replies
To the start Previous 1 Next To the start

old How to create script?

Mxcd2345
COMMUNITY BANNED Off Offline

Quote
Hello.
I wanted to ask how to create a script on the system of rank type :
1.SuperVip
2.Vip
3.ExtraVip
4.MegaVip
I like to set each rank could write in color .

If you helped me not insulted or ignored it thanks .

Sorry My English is NOT Perfect!

old Re: How to create script?

sonkii
User Off Offline

Quote
How to change the tags,

Someone has written
Open chat.lua inside modules folder, just right the start of file you will see
1
2
3
4
5
6
hc.chat.SAY_TAGS = {
    [hc.VIP] = "VIP",
    [hc.MODERATOR1] = "Mod",
    [hc.MODERATOR2] = "Mod",
    [hc.ADMINISTRATOR] = "Adm"
}

Just modify it for your own.


Believe me.That was not lying you.

Tips for asking:

> Use the Search functions before asking!
> If you wanna asking for something,just use this thread!
> And ask the owner of the script if you have a problem of his/her script.

old Re: How to create script?

Mami Tomoe
User Off Offline

Quote
This is not enough to change the tags, some parts of the script might remain with the old names and it will cause confusion, I recommend not changing the tags unless you know what you're doing.

old Re: How to create script?

Rainoth
Moderator Off Offline

Quote
Here's a SUPER old code for ranks.
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
admin = {1}
mod = {55555}
vip = {12345}

local rnd1 = math.random(0,255)
local rnd2 = math.random(0,255)
local rnd3 = math.random(0,255)
local color =("0"):rep(3-#rnd1)..rnd1..("0"):rep(3-#rnd2)..rnd2..("0"):rep(3-#rnd3)..rnd3

addhook("say","coloredtext")
function coloredtext(id,txt)
	for k,v in ipairs(admin) do
		if player(id,"usgn") == v then
			msg("©255255255Admin "..player(id,"name").." : ©"..color.." "..txt)
			return 1
		end
	end
	for k,v in ipairs(mod) do
		if player(id,"usgn") == v then
			msg("©255255255Moderator "..player(id,"name").." : ©"..color.." "..txt)
			return 1
		end
	end
	for k,v in ipairs(vip) do
		if player(id,"usgn") == v then
			msg("©255255255Very Important Person "..player(id,"name").." : ©"..color.." "..txt)
			return 1
		end
	end
end

old Re: How to create script?

GeoB99
Moderator Off Offline

Quote
@user Rainoth: Your script will bug afterwards. Considering rnd1, rnd2 and rnd3 as numbers you cannot get the length of them with
#
operator since they're not strings. We gotta use
tostring()
for that then.
The Code >

I tweaked the code a bit. It should work properly now.

old Re: How to create script?

Rainoth
Moderator Off Offline

Quote
@user GeoB99: I was aware of that, but I remember the script working. Maybe it didn't work as intended.
Didn't care for it because the guy asked for showing ranks, not making chat in random colors so I didn't bother to fix it and I assumed (and still assume) those parts will be deleted.

old Re: How to create script?

sonkii
User Off Offline

Quote
And I dont know to help you and I cannot understand what are you say.Maybe you can read tutorials.Next time,i hope you write understandable words.

old Re: How to create script?

sonkii
User Off Offline

Quote
Oh,i forgot about this.You can also see one of the samples to help you.The samples are at (your cs2d folder/sys/lua/samples).I'll recommend you to read the tutorial.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview