Forum

> > CS2D > Scripts > Where is the error
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Where is the error

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Where is the error

- - - - - - - - - - - - -
User Off Offline

Zitieren
Can Some one fix it

[/code]
Adminz ={88574,87857,20045,38795,89675,79431,89675,66415,94707,95247,19887}

parse("mp_wpndmg tmp 2000")
parse("mp_wpndmg laser 25")

function isadmin(id)
for _, usgn in ipairs(admins) do
if player(id,"usgn")==usgn then
return true
else
return false
end
end
end


AdminList = {88574,83835,66415,87857,20045,38795,89675,79431,95247,19887}
function rp_msg2(id,clr,txt)
     if player(id,"exists") then
     msg2(id,"©"..clr..txt)
     end
end
function Admin(id)
for _, usgn in ipairs(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" , "GiveWeapons")
function GiveWeapons(id,txt)
     local p = totable(txt)
     local cmd = tostring(p[1])
if Admin(id) then
if cmd =="!setwpn" then
local pl = tonumber(p[2])
local weapon = tonumber(p[3])
if pl ~= nil and weapon ~= nil then
if player(pl,"exists") then
parse("equip "..pl.." "..weapon)
rp_msg2(pl,"000255000",player(id,"name").." gave you New Weapon!")
rp_msg2(id,"000255000","You gave new Weapon ID["..weapon.."] to "..player(pl,"name"))
           return 1
end
end
end
end
end
[/code]

alt Re: Where is the error

DC
Admin Off Offline

Zitieren
How to use tags in the forum:
Opening tags do not start with [/..] just closing tags do...

How to ask for help when your Lua script gives you an error/doesn't work:
Also you should provide the error that your (probably stolen and modified without any clue?) script generates. You can find it in the console along with the number of the line that causes the problem... you can even copy&paste that line by right clicking it and clicking "copy line"

alt Re: Where is the error

Cure Pikachu
User Off Offline

Zitieren
Wow how many tables and similar functions do you need?
After removing the excess, this is the result:
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
adminlist = {88574,87857,20045,38795,89675,79431,66415,94707,95247,19887,83835}

parse("mp_wpndmg tmp 2000")
parse("mp_wpndmg laser 25")

function isadmin(id)
	for _, usgn in ipairs(adminlist) do
		if player(id,"usgn")==usgn then
			return true
		end
	end
	return false
end

function rp_msg2(id,clr,txt)
	if player(id,"exists") then
		msg2(id,"©"..clr..txt)
	end
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","GiveWeapons")
function GiveWeapons(id,txt)
	local p = totable(txt)
	local cmd = tostring(p[1])
	if cmd == "!setwpn" then
		if isadmin(id) then
			local pl = tonumber(p[2])
			local weapon = tonumber(p[3])
			if pl ~= nil and weapon ~= nil then
				if player(pl,"exists") then
					parse("equip "..pl.." "..weapon)
					rp_msg2(pl,"000255000",player(id,"name").." gave you New Weapon!")
					rp_msg2(id,"000255000","You gave new Weapon ID["..weapon.."] to "..player(pl,"name"))
				end
			end
		end
		return 1
	end
end
1× editiert, zuletzt 03.12.15 03:09:49
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht