Forum

> > CS2D > Scripts > With this bug in the several commands.
Forums overviewCS2D overview Scripts overviewLog in to reply

English With this bug in the several commands.

8 replies
To the start Previous 1 Next To the start

old With this bug in the several commands.

GamerX 17323
User Off Offline

Quote
I'm creating the simple commands to my server. But it only takes !info functioning. I wonder what's wrong and how to correct this error. Sorry for my bad english !

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
addhook("say","say")
function say(id,txt)
 if(txt=="!info") then
  if _G["mtime1"]==nil then
  local tleft = game("mp_timelimit")
  local nmap = game("nextmap")
   parse("sv_msg ©999999999[==*Informações Do Servidor*==]")
   parse("sv_msg ©000255000Server Name: "..game("sv_name"))
   parse("sv_msg ©000255000Max Players: "..game("sv_maxplayers"))
   parse("sv_msg ©000255000Server Password: "..game("sv_password"))
   parse(os.date("sv_msg ©000255000Hora: %I:%M %p"))
   parse(os.date("sv_msg ©000255000Data: %A, %d %b %Y"))
   parse("sv_msg ©000255000Tempo Por Mapa: "..tleft.." ")
   parse("sv_msg ©000255000Mapa Atual: "..game("sv_map"))
   parse("sv_msg ©000255000Próximo Mapa: "..nmap.." ")
return 1
 elseif message:sub(1,6) == "!track" then
   local p = tonumber(message:sub(8,9))
   local name = player(p,"name")
   local usgn = player(p,"usgn")
   local port = player(p,"port")
   local ip = player(p,"ip")
   msg("©999999999[==*Dados do jogador ©000255255 "..name.."©999999999*==]")
   msg("©000255000USGN: "..usgn)
   msg("©000255000Port: "..port)
   msg("©000255000IP: "..ip)
 return 1
  elseif (txt=="!rs") then
   parse ("setscore "..id.." ..sc")
   parse ("setdeaths "..id.." ..sc")
   parse ("sv_msg ©999999999 [==*O Player ©255000000"..player(id,'name').."©999999999 resetou seu score*==]")
  return 1
  end
 end
end

old Re: With this bug in the several commands.

Happy Camper
User Off Offline

Quote
One of the end's is in the wrong place. Try this:
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
addhook("say","say")
function say(id, txt)
	if (txt == "!info") then
		if _G["mtime1"] == nil then
			local tleft = game("mp_timelimit")
			local nmap = game("nextmap")
			parse("sv_msg ©999999999[==*Informações Do Servidor*==]")
			parse("sv_msg ©000255000Server Name: " .. game("sv_name"))
			parse("sv_msg ©000255000Max Players: " .. game("sv_maxplayers"))
			parse("sv_msg ©000255000Server Password: " .. game("sv_password"))
			parse(os.date("sv_msg ©000255000Hora: %I:%M %p"))
			parse(os.date("sv_msg ©000255000Data: %A, %d %b %Y"))
			parse("sv_msg ©000255000Tempo Por Mapa: " .. tleft .. " ")
			parse("sv_msg ©000255000Mapa Atual: " .. game("sv_map"))
			parse("sv_msg ©000255000Próximo Mapa: " .. nmap .. " ")
			return 1
		end
	elseif txt:sub(1, 6) == "!track" then
		local p = tonumber(txt:sub(8, 9))
		local name = player(p, "name")
		local usgn = player(p, "usgn")
		local port = player(p, "port")
		local ip = player(p, "ip")
		msg("©999999999[==*Dados do jogador ©000255255 " .. name .. "©999999999*==]")
		msg("©000255000USGN: " .. usgn)
		msg("©000255000Port: " .. port)
		msg("©000255000IP: " .. ip)
		return 1
	elseif (txt == "!rs") then
		parse("setscore " .. id .. " ..sc")
		parse("setdeaths " .. id .. " ..sc")
		parse("sv_msg ©999999999 [==*O Player ©255000000" .. player(id, 'name') .. "©999999999 resetou seu score*==]")
		return 1
	end
end

old Re: With this bug in the several commands.

sheeL
User Off Offline

Quote
user GamerX 17323 has written
I'm creating the simple commands to my server. But it only takes !info functioning. I wonder what's wrong and how to correct this error. Sorry for my bad english !

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
addhook("say","say")
function say(id,txt)
 if(txt=="!info") then
  if _G["mtime1"]==nil then
  local tleft = game("mp_timelimit")
  local nmap = game("nextmap")
   parse("sv_msg ©999999999[==*Informações Do Servidor*==]")
   parse("sv_msg ©000255000Server Name: "..game("sv_name"))
   parse("sv_msg ©000255000Max Players: "..game("sv_maxplayers"))
   parse("sv_msg ©000255000Server Password: "..game("sv_password"))
   parse(os.date("sv_msg ©000255000Hora: %I:%M %p"))
   parse(os.date("sv_msg ©000255000Data: %A, %d %b %Y"))
   parse("sv_msg ©000255000Tempo Por Mapa: "..tleft.." ")
   parse("sv_msg ©000255000Mapa Atual: "..game("sv_map"))
   parse("sv_msg ©000255000Próximo Mapa: "..nmap.." ")
return 1
 elseif message:sub(1,6) == "!track" then
   local p = tonumber(message:sub(8,9))
   local name = player(p,"name")
   local usgn = player(p,"usgn")
   local port = player(p,"port")
   local ip = player(p,"ip")
   msg("©999999999[==*Dados do jogador ©000255255 "..name.."©999999999*==]")
   msg("©000255000USGN: "..usgn)
   msg("©000255000Port: "..port)
   msg("©000255000IP: "..ip)
 return 1
  elseif (txt=="!rs") then
   parse ("setscore "..id.." ..sc")
   parse ("setdeaths "..id.." ..sc")
   parse ("sv_msg ©999999999 [==*O Player ©255000000"..player(id,'name').."©999999999 resetou seu score*==]")
  return 1
  end
 end
end


Looks
1
function say(id,txt)
and
1
elseif message:sub(1,6) == "!track" then
you put wrong

Try this
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
addhook("say","say")
function say(id,txt)
		if string.lower(txt) == "!info" then
			if _G["mtime1"]==nil then
			local tleft = game("mp_timelimit")
			local nmap = game("nextmap")
		   parse("sv_msg ©999999999[==*Informações Do Servidor*==]")
		   parse("sv_msg ©000255000Server Name: "..game("sv_name"))
		   parse("sv_msg ©000255000Max Players: "..game("sv_maxplayers"))
		   parse("sv_msg ©000255000Server Password: "..game("sv_password"))
		   parse(os.date("sv_msg ©000255000Hora: %I:%M %p"))
		   parse(os.date("sv_msg ©000255000Data: %A, %d %b %Y"))
		   parse("sv_msg ©000255000Tempo Por Mapa: "..tleft.." ")
		   parse("sv_msg ©000255000Mapa Atual: "..game("sv_map"))
		   parse("sv_msg ©000255000Próximo Mapa: "..nmap.." ")
		return 1
	end
	elseif string.lower(txt):sub(1,6) == "!track" then
		local p = tonumber(txt:sub(8,9))
		local name = player(p,"name")
		local usgn = player(p,"usgn")
		local port = player(p,"port")
		local ip = player(p,"ip")
		msg("©999999999[==*Dados do jogador ©000255255 "..name.."©999999999*==]")
		msg("©000255000USGN: "..usgn)
		msg("©000255000Port: "..port)
		msg("©000255000IP: "..ip)
	return 1
	elseif (txt=="!rs") then
		parse ("setscore "..id.." 0")
		parse ("setdeaths "..id.." 0")
		parse ("sv_msg ©999999999 [==*O Player ©255000000"..player(id,'name').."©999999999 resetou seu score*==]")
		return 1
	end
end

old Re: With this bug in the several commands.

EngiN33R
Moderator Off Offline

Quote
user Yates has written
Since when can you name a function the same as a hook?


Despite the common opinion, there is nothing wrong with naming a function the same as the hook. The hook name is simply a string, there's no way the two could conflict.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview