Forum

> > CS2D > Scripts > Marked for Delete
Forums overviewCS2D overview Scripts overviewLog in to reply

German Marked for Delete

4 replies
To the start Previous 1 Next To the start

old Re: Marked for Delete

sheeL
User Off Offline

Quote
nicht getestet, aber es kann eine gute idee sein

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
adminList = {112408,10464,98327} --Admins

function isAdmin(id) --Check admin
        if not player(id,"exists") then return false end
        for _, usgn in pairs(adminList) do
                if player(id,'usgn') == usgn then
                        return true
                end
        end
        return false
end

addhook("say","bring_cmd")
function bring_cmd(id,message)
        if isAdmin(id) then
          if message:sub(1, 2) == '!c' then
				local pl = tonumber(message:sub(1,2))
               if player(pl, 'exists') then
               parse("setpos "..id.." "..player(pl,"x").." "..player(pl,"y"))
				return 1
			end
		end
	end
end

old Leider Nein

DryDay
User Off Offline

Quote
user sheeL has written
nicht getestet, aber es kann eine gute idee sein

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
adminList = {112408,10464,98327} --Admins

function isAdmin(id) --Check admin
        if not player(id,"exists") then return false end
        for _, usgn in pairs(adminList) do
                if player(id,'usgn') == usgn then
                        return true
                end
        end
        return false
end

addhook("say","bring_cmd")
function bring_cmd(id,message)
        if isAdmin(id) then
          if message:sub(1, 2) == '!c' then
				local pl = tonumber(message:sub(1,2))
               if player(pl, 'exists') then
               parse("setpos "..id.." "..player(pl,"x").." "..player(pl,"y"))
				return 1
			end
		end
	end
end


Wen ich diese mache kommt der error :
LUA ERROR: sys/lua/autorun/admin1.lua:227: bad argument #1 to 'player' (number expected, got nil)

old Re: Marked for Delete

sheeL
User Off Offline

Quote
user DryDay has written
user sheeL has written
nicht getestet, aber es kann eine gute idee sein

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
adminList = {112408,10464,98327} --Admins

function isAdmin(id) --Check admin
        if not player(id,"exists") then return false end
        for _, usgn in pairs(adminList) do
                if player(id,'usgn') == usgn then
                        return true
                end
        end
        return false
end

addhook("say","bring_cmd")
function bring_cmd(id,message)
        if isAdmin(id) then
          if message:sub(1, 2) == '!c' then
				local pl = tonumber(message:sub(1,2))
               if player(pl, 'exists') then
               parse("setpos "..id.." "..player(pl,"x").." "..player(pl,"y"))
				return 1
			end
		end
	end
end


Wen ich diese mache kommt der error :
LUA ERROR: sys/lua/autorun/admin1.lua:227: bad argument #1 to 'player' (number expected, got nil)


sorry, mein fehler
fixiert
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
adminList = {45813}

function isAdmin(id) 
        for _, usgn in pairs(adminList) do
                if player(id,'usgn') == usgn then
                        return true
                end
        end
        return false
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

addhook("say","_say")
function _say(id,text)
local words = totable(text)
local cmd = tostring(words[1])
local param = tonumber(words[2])

if string.lower(cmd) == "!bring" then
	if player(param,"exists") then
		if isAdmin(id) then
			if player(param,"health") > 0  and player(id,"health") > 0 then
				parse("setpos "..param.." "..player(id,"x").." "..player(id,"y"))
					return 1
					else
				msg2(id,"©255000000[ERROR] - Cant use this command with you/"..player(param,"name").." dead ")
				msg2(id,"©255000000[ERROR] - Kann nicht mit diesem Befehl mit Ihnen / "..player(param,"name").." tot")
				return 1
				end
			else
			msg2(id,"©255000000[ERROR] - Nur Admins verwenden Sie diesen Befehl")
			return 1
			end
		else
		msg2(id,"©255000000[ERROR] - Spieler "..param.." existiert nicht")
		return 1
		end
		
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview