English Return No Works...

6 replies
Goto Page
To the start Previous 1 Next To the start
19.07.13 03:18:27 am
Up
superpegamento
User
Offline Off
the problem is that the return not work

code:

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
staffs = {74551}

addhook("say","staff_say")
function staff_say(id,t)
for _, usgn in ipairs(staffs) do
if player(id,'usgn') == usgn then
msg("©000128128[STAFF] "..player(id,"name").." :©255255255 "..t)
return 1
end
end
end

addhook("say" , "help_txt")
function help_txt(id,tx)
if tx=="!help" then     
msg2(id,"xxxxxxxxxxxxxxxxxx")
return 1
end
end
19.07.13 03:38:36 am
Up
Alexsandro
User
Offline Off
Dude, use all commands in a single function
IMG:http://img130.imageshack.us/img130/8425/2510.png
19.07.13 04:14:10 am
Up
superpegamento
User
Offline Off
user Alexsandro has written:
Dude, use all commands in a single function


Example?
19.07.13 07:59:47 am
Up
ExecL
User
Offline Off
You have to put it in the same function do not use multiple functions of the same kind!

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
staffs = {74551}

addhook("say","staff_say")
function staff_say(id,text)
for _, usgn in ipairs(staffs) do
if player(id,'usgn') == usgn then
msg("©000128128[STAFF] "..player(id,"name").." :©255255255 "..text)
return 1
end
if text=="!help" then     
msg2(id,"xxxxxxxxxxxxxxxxxx")
     return 1
     end
   end
end


Tested, works.
edited 1×, last 19.07.13 08:37:46 am
19.07.13 07:17:20 pm
Up
superpegamento
User
Offline Off
user ExecL has written:
You have to put it in the same function do not use multiple functions of the same kind!

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
staffs = {74551}

addhook("say","staff_say")
function staff_say(id,text)
for _, usgn in ipairs(staffs) do
if player(id,'usgn') == usgn then
msg("©000128128[STAFF] "..player(id,"name").." :©255255255 "..text)
return 1
end
if text=="!help" then     
msg2(id,"xxxxxxxxxxxxxxxxxx")
     return 1
     end
   end
end


Tested, works.


no works... check the script
19.07.13 07:50:30 pm
Up
Rainoth
Moderator
Offline Off
Tested it. Works fine.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
staffs = {15476}

addhook("say","staff_say")
function staff_say(id,text)
     if text=="!help" then     
          msg2(id,"xxxxxxxxxxxxxxxxxx")
          return 1
     else
          for _, usgn in ipairs(staffs) do
               if player(id,'usgn') == usgn then
                    msg("\169000128128[STAFF] "..player(id,"name").." :\169255255255 "..text)
                    return 1
               end
          end
     end
end


It might be because you're running few other scripts that use "say" hook.
21.07.13 12:47:31 am
Up
superpegamento
User
Offline Off
user Rainoth has written:
Tested it. Works fine.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
staffs = {15476}

addhook("say","staff_say")
function staff_say(id,text)
     if text=="!help" then     
          msg2(id,"xxxxxxxxxxxxxxxxxx")
          return 1
     else
          for _, usgn in ipairs(staffs) do
               if player(id,'usgn') == usgn then
                    msg("\169000128128[STAFF] "..player(id,"name").." :\169255255255 "..text)
                    return 1
               end
          end
     end
end


It might be because you're running few other scripts that use "say" hook.


tanks
To the start Previous 1 Next To the start