Forum

> > CS2D > Scripts > return 1 NOT working
Forums overviewCS2D overview Scripts overviewLog in to reply

English return 1 NOT working

2 replies
To the start Previous 1 Next To the start

old return 1 NOT working

Hidder
BANNED Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook("say","sayra")
function sayra(id,txt)
if txt == "!rs" then
if (player(id,"score")>0) or (player(id,"deaths")>0) then
parse("setscore "..id.." 0")
parse("setdeaths "..id.." 0")
msg2(id,"\169000255000Score reset successful")
return 1
else
msg2(id,"\169255000000Score is already reset")
return 1
end
end
if txt == "!ras" then
msg2(id,"\169255255255Name:".."\169255255000 ras")
msg2(id,"\169255255255USGN:".."\169255255000 5q235213")
msg2(id,"\169255255255Status:".."\169255255000 Professional")
return 1
end
end

why its not work

old Re: return 1 NOT working

DC
Admin On Online

Quote
Did you add multiple functions to the say hook?
You can check the console right after starting a server to see if this is the case.

If yes you need to work with priorities or combine the functions to one function.

Read "Hook Priority (Optional)" at cs2d lua cmd addhook

old Re: return 1 NOT working

GeoB99
Moderator Off Offline

Quote
Your code has a needless
return
keyword (8 line), keep in mind
return 1
(which hides the text) should be used when the player is writing a command or any text based on the code and not for
msg2()
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function sayra(id,txt)
   if txt == "!rs" then
      if (player(id,"score")>0) or (player(id,"deaths")>0) then
         parse("setscore "..id.." 0")
         parse("setdeaths "..id.." 0")
         msg2(id,"\169000255000Score reset successful")
      else
         msg2(id,"\169255000000Score is already reset")
      end
      return 1
   end

   if txt == "!ras" then
      msg2(id,"\169255255255Name:".."\169255255000 ras")
      msg2(id,"\169255255255USGN:".."\169255255000 5q235213")
      msg2(id,"\169255255255Status:".."\169255255000 Professional")
      return 1
   end
end

addhook("say","sayra")
Tip: ALWAYS tab your code, it makes things clear and easily to read it.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview