Forum

> > CS2D > Scripts > [Solved] - This error - no solution .
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Solved] - This error - no solution .

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

old [Solved] - This error - no solution .

script favor
User Off Offline

Quote
Hi,again

I would think if you can solve my problem so it depends on this error:

Spoiler >


And code is
Spoiler >


So,x5cookies
edited 1×, last 21.02.18 08:03:29 pm

old That's it

script favor
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
Rank = {}

addhook("join","scriptfavor.admin.join")
function scriptfavor.admin.join(id)
		if isAdmin(id) then
          Rank[id] = 2
		 end
		if isMod(id) then
		Rank[id] = 1
		end
   end

old Re: [Solved] - This error - no solution .

TrialAndError
User Off Offline

Quote
Try this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
commands["!shake"] = {
     enabled = true,
     permission = 1,
     arguments = 1,
     syntax = "<id>",
     func = function(id,arguments)
          local arg = tonumber(arguments[1])
          if isAdmin(id) and isMod(id) then
               if not arg then return msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255Invalid numeric value.") end
               if not player(arg,"exists") then return msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255Player with the specified "..arg.." does not exist.") end
               if player(arg,"bot") then return msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255You can't shake a bot") end
               if arg == id then return msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255You can not shake yourself.") end
               parse("shake "..arg.." 900")
               msg(""..string.char(169).."000250155[Server]: "..string.char(169).."255255255"..player(id,"name").." Used shake on "..player(arg,"name").."")
          else
               if Rank[id] < Rank[arg]  then return msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255You can't kick higher staff")end
          end
     end
};

old Re: [Solved] - This error - no solution .

Bowlinghead
User Off Offline

Quote
You need an "else" in your join function. Theres no option for a user so theres no value.
1
2
3
4
5
6
7
8
9
10
11
12
Rank = {}

addhook("join","scriptfavor.admin.join")
function scriptfavor.admin.join(id)
		if isAdmin(id) then
          Rank[id] = 2
		 end
		if isMod(id) then
		Rank[id] = 1
		else Rank[id] = 0
		end
   end

Actually its bullshit because the error at line 16 in commands["!shake"].func will always trigger at normal users (its in the else part of line 8?)
edited 3×, last 20.02.18 09:55:39 pm

old Re: [Solved] - This error - no solution .

TrialAndError
User Off Offline

Quote
Also put an elseif, just in case if the user is both admin and mod.
1
2
3
4
5
6
7
8
9
10
11
12
Rank = {}

addhook("join","scriptfavor.admin.join")
function scriptfavor.admin.join(id)
	if isAdmin(id) then
		Rank[id] = 2
	elseif isMod(id) then
		Rank[id] = 1
	else 
		Rank[id] = 0
    end
end

old Re: [Solved] - This error - no solution .

script favor
User Off Offline

Quote
1
LUA ERROR: sys/lua/command.lua:89: attempt to compare number with nil

This my code :
Your code >

old Re: [Solved] - This error - no solution .

script favor
User Off Offline

Quote
Below,

More >

old Re: [Solved] - This error - no solution .

Bowlinghead
User Off Offline

Quote
@user TrialAndError: I think you missed the part for the normal mod.

@user script favor: Your code doesnt make sense at all.
1
if Rank[id] < Rank[arg]  then RETURN msg2(id,""..string.char(169)..
You either are a lazy tabber or you mistyped it.
Or I dont understand what your script should do.


Does this work?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Rank = {}
--untested FIXED!!!
addhook("join","scriptfavor.admin.join")
function scriptfavor.admin.join(id)
     if isAdmin(id) and isMod(id) then
          Rank[id] = 3
	  return
     end
     if isAdmin(id) then
          Rank[id] = 2
	  return
     end
     if isMod(id) then
	  Rank[id] = 1
          return
     end
     Rank[id] = 0
end

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
commands["!shake"] = {
     enabled = true,
     permission = 1,
     arguments = 1,
     syntax = "<id>",
     func = function(id,arguments)
          local arg = tonumber(arguments[1])
          if Rank[id] < Rank[arg]  then  ---------> ez
               if not arg then return msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255Invalid numeric value.") end
               if not player(arg,"exists") then return msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255Player with the specified "..arg.." does not exist.") end
               if player(arg,"bot") then return msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255You can't shake a bot") end
               if arg == id then return msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255You can not shake yourself.") end
               parse("shake "..arg.." 900")
               msg(""..string.char(169).."000250155[Server]: "..string.char(169).."255255255"..player(id,"name").." Used shake on "..player(arg,"name").."")
          end
     end
};
Now every mod&admin can kick admin&mod&user, admin can kick mod&user, mod can kick user. user


Can you please show us line 88?
edited 1×, last 20.02.18 10:15:49 pm

old Re: [Solved] - This error - no solution .

Joni And Friends
User Off Offline

Quote
add new function on your script

1
2
3
4
5
6
7
8
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

And then use this 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
31
32
33
34
35
commands["!shake"] = {
                              enabled = true,
                              permission = 1,
                              arguments = 1,
                              syntax = "<id>",
                              func = function(id,arguments)
                              if isAdmin(id) and isMod(id) then
                     		local argt=totable(arguments)
                              	local arg = tonumber(argt[1])
                              	if (arg==nil or not arg) then
					msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255Invalid numeric value.")
					return false
				end
                              	if arg~=nil and not player(arg,"exists") then
					msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255Player with the specified "..arg.." does not exist.")
					return false
				end
                              	if arg~=nil and player(arg,"bot") then
					msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255You can't shake a bot")
					return false
				end
                              	if arg~=nil and arg == id then
					msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255You can not shake yourself.")
					return false
				end

                              	if arg~=nil and Rank[id] < Rank[arg]  then 
					msg2(id,""..string.char(169).."000250155[Server]: "..string.char(169).."255255255You can't shake higher staff")
					return false
                     		end
				parse("shake "..arg.." 900")
                              	msg(""..string.char(169).."000250155[Server]: "..string.char(169).."255255255"..player(id,"name").." Used shake on "..player(arg,"name").."")
                              end
                    	      end
               };

Your code have many of errors and bad placing, you cant place return in the first of your code. You have to learn more about lua script
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview