Forum

> > CS2D > Scripts > [Solved] - This error - no solution .
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch [Solved] - This error - no solution .

30 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt [Solved] - This error - no solution .

script favor
User Off Offline

Zitieren
Hi,again

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

Spoiler >


And code is
Spoiler >


So,x5cookies
1× editiert, zuletzt 21.02.18 20:03:29

alt That's it

script favor
User Off Offline

Zitieren
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

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

TrialAndError
User Off Offline

Zitieren
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
};

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

Bowlinghead
User Off Offline

Zitieren
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?)
3× editiert, zuletzt 20.02.18 21:55:39

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

TrialAndError
User Off Offline

Zitieren
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

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

script favor
User Off Offline

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

This my code :
Your code >

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

script favor
User Off Offline

Zitieren
Below,

Mehr >

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

Bowlinghead
User Off Offline

Zitieren
@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?
1× editiert, zuletzt 20.02.18 22:15:49

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

Joni And Friends
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht