Forum

> > CS2D > Scripts > what is wrong with this script?
Forums overviewCS2D overview Scripts overviewLog in to reply

English what is wrong with this script?

1 reply
To the start Previous 1 Next To the start

old what is wrong with this script?

NanuPlayer
User Off Offline

Quote
Hey, my script is not working and idk why
what is wrong with it?

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
AdminS = {}
Admin = {178715}

function new_players_array()
  local players = {}
  for id=1,32 do
    players[id] = {image = nil} -- player's "properties"
  end
  return players
end

players = new_players_array()


addhook("join","joinAdmin")
function joinAdmin(id)
      for _, Adminusgn in ipairs(Admin) do
	   if player(id,"usgn") == Adminusgn then
	   admins[id] = 1
       msg("\169255255000Admin has joined the server")
	   else
	   admins[id] = 0
	   end
	   end
	   end
	   
addhook("say","say")
function say(id,txt,arguments)
      for _, Adminusgn in ipairs(Admin) do
	   if player(id,"usgn") == Adminusgn then
	msg("\169180250247"..player(id,"name").."\169217217025 [ Admin ]: \169255255255"..txt.."")
	return 1
	else
	admins[id] = 0
	end
	end
	end

addhook("use","usebuttonworkaround")
function usebuttonworkaround(id)
     local x,y=player(id,"tilex"),player(id,"tiley")
	 if admins[id] == 1 then
     if x==41 and y==17 or x==42 and y==17 or x==43 and y==17 or x==44 and y==17 then
     parse("trigger admdoor")
else
 if admins[id] == 1 then
     if x==57 and y==15 then
     parse("trigger modoor")
end
end
end
end
end

old Re: what is wrong with this script?

Cure Pikachu
User Off Offline

Quote
Describing what isn't working will be really helpful here.
But I went through your given code and uh... cleaned it up.
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
admins = {}
Admin = {178715}

players = {}
for i=1,32 do
	players[i] = {} -- player's "properties"
end

addhook("join","joinAdmin")
function joinAdmin(id)
	admins[id] = 0
	for _, Adminusgn in ipairs(Admin) do
		if player(id,"usgn") == Adminusgn then
			admins[id] = 1
			msg("\169255255000Admin has joined the server")
			break
		end
	end
end
        
addhook("say","_say")
function _say(id,txt)
	if admins[id] == 1 then
		msg("\169180250247"..player(id,"name").."\169217217025 [ Admin ]: \169255255255"..txt.."")
		return 1
	end
end

addhook("use","usebuttonworkaround")
function usebuttonworkaround(id,event,data,x,y)
	if admins[id] == 1 then
		if (x >= 41 and x <= 44) and y == 17 then
			parse("trigger admdoor")
		elseif x == 57 and y == 15 then
			parse("trigger modoor")
		end
	end
end
edited 5×, last 23.04.20 11:41:48 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview