Forum

> > CS2D > Scripts > how to make this script work
Forums overviewCS2D overview Scripts overviewLog in to reply

English how to make this script work

20 replies
Page
To the start Previous 1 2 Next To the start

old how to make this script work

KagamineLen
User Off Offline

Quote
i can't get this script working i get the error


1
2
3
4
5
6
7
8
9
10
11
12
13
14
[22:12:31] ----- Server started -----
[22:12:31] Warning: 'Offline / LAN'-mode is ENABLED. Server will NOT be added to serverlist. Other players on the internet will NOT see this server on their serverlist. Enter 'sv_lan 0' in your console or disable the 'Offline / LAN'-checkbox to change this setting.
[22:12:34] Lua: Adding function 'join_hook' to hook 'join'
[22:12:34] Lua: Adding function 'help_button' to hook 'serveraction'
[22:12:34] Lua: Adding function 'show' to hook 'join'
[22:12:34] Lua: Adding function 'command' to hook 'say'
[22:12:34] Lua: Adding function 'mtime' to hook 'minute'
[22:12:34] Lua: Adding function 'usermenu' to hook 'menu'
[22:12:34] LUA ERROR: sys/lua/PBS_Commands.lua:26: unexpected symbol near '
[22:12:34] LUA ERROR: attempt to call a nil value
[22:12:34] Player Shinichi Kudo joined from Reserved
[22:12:34] Welcome To [PBS] Pilipinas | Construction, Shinichi Kudo!
[22:12:41] LUA ERROR: attempt to call a nil value
[22:12:43] Shinichi Kudo joins the Counter-Terrorist Forces

Here's the script

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
38
39
function Privileges(id)

usgnid = player(id,"usgn")
privi = "Player"

	for _, u in ipairs(admins) do
	 if player(id,"usgn") == u then
			usgnid = player(id,"usgn")
			privi = "Administrators"
			color[id] = ©255000000
			end
		end

	for _, u in ipairs(moderators) do
	 if player(id,"usgn") == u then
			usgnid = player(id,"usgn")
			privi = "Moderators"
			color[id] = ©255000000
			end
		end

	for _, u in ipairs(members) do
	 if player(id,"usgn") == u then
			usgnid = player(id,"usgn")
			privi = "Members"
			color[id] = ©255000000
			end
		end

	for _, u in ipairs(vip) do
	 if player(id,"usgn") == u then
			usgnid = player(id,"usgn")
			privi = "V.i.p"
			color[id] = ©255000000
			end
		end
			parse('hudtxt2 '..id..' 10 "©000255000Your Usgn is: '..usgnid..'" 480 150')
			parse('hudtxt2 '..id..' 11 "©000255000Privilege: '..color[id]..''..privi..'" 480 165')
	end

old Re: how to make this script work

KagamineLen
User Off Offline

Quote
here

More >
edited 1×, last 01.03.13 03:48:04 pm

old Re: how to make this script work

KagamineLen
User Off Offline

Quote
here

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function string.split(text,b)
	local cmd = {}
	if b then
		b = b
		else
		b = "%s"
	end
	b = "[^"..b.."]+"
	for o in string.gmatch(text,b) do
		table.insert(cmd,o)
	end
	return cmd
end

function totable(t,match)
     local cmd = {}
     if not match then match = "[^%s]+" end
     for word in string.gmatch(t, match) do
          table.insert(cmd, word)
     end
     return cmd
end 

function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

function Array(size,value) 
    local array = {}
    for i = 1, size do
        array[i]=value
    end
    return array
end

function c_array(c,v)
	local t={}
	for i=1,c do
		t[i]=v
	end
	return t
end

Scripts = "sys/lua"
dofile(Scripts.."/Locmod/main.lua")

addhook("serveraction","help_button")
addhook("join","show")
addhook('say', 'command')
addhook("minute","mtime")
addhook("menu","usermenu")

dofile(Scripts.."/PBS_Configuration.lua")
dofile(Scripts.."/PBS_Commands.lua")
dofile(Scripts.."/PBS_FastBuild.lua")
dofile(Scripts.."/PBS_UTSFX.lua")

old Re: how to make this script work

Rainoth
Moderator Off Offline

Quote
It would be here if you wrote the hook and function where the error is given (line 26) if I recall. Also. Use "more" to put your code in it...

old Re: how to make this script work

KagamineLen
User Off Offline

Quote
here

More >


the error is in
1
color[id] = ©255000000
that made the error because i add that thing and error occurs i am very sure of it
edited 2×, last 01.03.13 04:11:17 pm

old Re: how to make this script work

Rainoth
Moderator Off Offline

Quote
I didn't quite understood privi concept.

Privi = "Player"
then you do privi = "administrators"
Else if I'm wrong then maybe it's the © symbol..?

Edit : I'm preety sure instead of "Player" there should be like playerNAME or something >_> Not sure though..

old Re: how to make this script work

KagamineLen
User Off Offline

Quote
the "previ" concept is if it dint find the usgn in this variables

1
2
3
4
admins = {70919}
moderators = {}
members = {58665,27690,65642,71284,54310,54383,23026,50954,14643,69165}
vip = {64674,97024,93145}

your previlege will show that you are just a player

edit: and that code is in pbs_configuration.lua

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
usgnid = player(id,"usgn")
privi = "Player" - this code will not be replaced by the code under this if they dint found your usgn in the vip,admin,mod list

     for _, u in ipairs(admins) do - replaces the "privi" if found your usgn in admins
      if player(id,"usgn") == u then
               usgnid = player(id,"usgn")
               privi = "Administrators"
               color[id] = ©255000000
               end
          end

     for _, u in ipairs(moderators) do - replaces the "privi" if found your usgn in mods
      if player(id,"usgn") == u then
               usgnid = player(id,"usgn")
               privi = "Moderators"
               color[id] = ©255000000
               end
          end

     for _, u in ipairs(members) do - replaces the "privi" if found your usgn in members
      if player(id,"usgn") == u then
               usgnid = player(id,"usgn")
               privi = "Members"
               color[id] = ©255000000
               end
          end

     for _, u in ipairs(vip) do - replaces the "privi" if found your usgn in vip's
      if player(id,"usgn") == u then
               usgnid = player(id,"usgn")
               privi = "V.i.p"
               color[id] = ©255000000
               end

in the end if nothing replaced the player variables then your a player
          end
edited 1×, last 01.03.13 04:15:27 pm

old Re: how to make this script work

Rainoth
Moderator Off Offline

Quote
That's not the point. I could easily figure out what it did (and you just repeated it without explaining)

but you make privi equal to "Player" and the next thing you do is make
"Player"(privi) equal to "administrator"

I may be wrong but if you get what I'm saying it would be same if I said.
a = 2 and then said
a = 3

old Re: how to make this script work

KagamineLen
User Off Offline

Quote
it is like

this gino = player

finding gino in admins list
if found then gino = admin

finding gino in members list
if found then gino = member

- if it dint found you in the list your just a player
- will just replace gino's variable

edit: so i found the error was really in
1
color[id] = ©255000000
i remove all of it then i go back to normal
i put it again and error goes back

maybe i mistaked the line number then that line is not 27 its 26, well im counting it on notepad gona use notepad ++

edit2: then how can i make this thing working
1
color[id] = ©255000000
edited 1×, last 01.03.13 04:30:21 pm

old Re: how to make this script work

KagamineLen
User Off Offline

Quote
i used hud

1
2
parse('hudtxt2 '..id..' 10 "©000255000Your Usgn is: '..usgnid..'" 480 150')
parse('hudtxt2 '..id..' 11 "©000255000Privilege: '..color[id]..''..privi..'" 480 165')

edit: i can upload my whole script if you wanna try finding the cause

old Re: how to make this script work

Rainoth
Moderator Off Offline

Quote
I thought u could resolve it

Maybe it's that ur trying to make 2 colors ? Just look at the two line codes. You want hud to make one color and then you tell it to make another...
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview