Forum

> > CS2D > Scripts > return 1 NOT working
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch return 1 NOT working

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt return 1 NOT working

Hidder
BANNED Off Offline

Zitieren
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

alt Re: return 1 NOT working

DC
Admin Off Offline

Zitieren
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

alt Re: return 1 NOT working

GeoB99
Moderator Off Offline

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