English Incorrect code message

23 replies
Goto Page
To the start Previous 1 2 Next To the start
01.08.18 01:54:41 pm
Up
phalenkO
User
Offline Off
How to make a bad code message?
edited 2×, last 02.08.18 01:27:01 pm
01.08.18 03:07:50 pm
Up
Gaios
Security Supporter
Offline Off
Code:
1
local wrong = 'message'
IMG:https://i.imgur.com/itOslkM.gif
This community is a meme.
01.08.18 03:39:39 pm
Up
phalenkO
User
Offline Off
@user Gaios: thx but i can not write
edited 1×, last 01.08.18 08:58:00 pm
01.08.18 11:28:11 pm
Up
Avo
User
Offline Off
@user phalenkO: You should definitely change your translation provider.
01.08.18 11:44:03 pm
Up
phalenkO
User
Offline Off
@user Avo: i do not have enough english to tell the situation, but i do not look at the translator. im serious and i do not use it a lot because there are too many mistakes in translation from turkish to english, just looking at the words i do not know. But now i look
02.08.18 12:20:13 am
Up
Gaios
Security Supporter
Offline Off
IMG:https://i.imgur.com/itOslkM.gif
This community is a meme.
02.08.18 12:54:52 am
Up
phalenkO
User
Offline Off
@user Gaios: can u give an example?
02.08.18 03:37:17 pm
Up
Masea
Super User
Offline Off
@user phalenkO: Go check my profile and see the Discord ID of mine. You can contact me from there for translating, I'm a Turkish person.
Create and design your GUI easy and fast: file cs2d GUI Framework (12) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (25)
03.08.18 02:11:20 pm
Up
phalenkO
User
Offline Off
@user Gaios: even if i writee normal text in this code i get an error message, can you find the error?

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

addhook("say","kck")
function kck(id,txt)
for _, usgn in ipairs(admin) do 
if txt:sub(1,5) == "!kick" then 
kid = txt:sub(6)
parse("kick "..kid)
msg("kicked!!!")
else 
end
msg("code is wrong!")
return 1
end
end
03.08.18 02:56:21 pm
Up
Rainoth
Moderator
Offline Off
Start tabbing your code and you'll find mistakes.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
admin = {142925}

addhook("say","kck")
function kck(id,txt)
     for _, usgn in ipairs(admin) do 
          if txt:sub(1,5) == "!kick" then 
               kid = txt:sub(6)
               parse("kick "..kid) -- results in "kick  <id>" (one space too many, provided you write '!kick <id>')
               msg("kicked!!!") -- Global message that the kicked player won't see because he'd be kicked
          else -- what is this? 
          end -- did you misplace this 'end' ?
          msg("code is wrong!")
          return 1
     end
end
03.08.18 02:57:44 pm
Up
Bowlinghead
User
Offline Off
Always TAB your code!!

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("say","kck")
function kck(id,txt)
     for _, usgn in ipairs(admin) do 
          if txt:sub(1,5) == "!kick" then 
               kid = txt:sub(6)
               parse("kick "..kid)
               msg("kicked!!!")
          else 
               -- nothing...
          end
          msg("code is wrong!") -- this is written always cuz its not in the if
     return 1
     end
end


So you gotta replace line 11 and 12 in your code
Share time limited free games here
03.08.18 04:00:54 pm
Up
phalenkO
User
Offline Off
@user Bowlinghead: how is it going to be? will this happen? i probably misunderstood
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
admin = {142925}

addhook("say","kck")
function kck(id,txt)
     for _, usgn in ipairs(admin) do 
          if txt:sub(1,5) == "!kick" then 
               kid = txt:sub(6)
               parse("kick "..kid)
               msg("kicked!!!")
          else 
               -- nothing...
          end
          return 1
          msg("code is wrong!") 
          end
end
03.08.18 05:12:48 pm
Up
Bowlinghead
User
Offline Off
user Bowlinghead has written:
So you gotta replace line 11 and 12 in your code


In your code that you posted, not on mine :3
Share time limited free games here
03.08.18 05:20:03 pm
Up
LoaderFRA
User
Offline Off
Return 1, it's not before the end ?

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

addhook("say","kck")
function kck(id,txt)
     for _, usgn in ipairs(admin) do 
          if txt:sub(1,5) == "!kick" then 
               kid = txt:sub(6)
               parse("kick "..kid)
               msg("kicked!!!")
          else
               msg("code is wrong!")
               return 1
               end
          end
     end
end
03.08.18 06:28:07 pm
Up
phalenkO
User
Offline Off
@user Bowlinghead: i get an error code even when i write a regular article
edited 2×, last 04.08.18 01:39:54 pm
04.08.18 04:40:58 pm
Up
Quattro
User
Offline Off
Could someone help me fix my code? it no works plz help :(((
Code:
1
2
3
4
5
6
7
8
9
d = 50 for i = 1, d
if player(1,'exists')then if player(1,'team')==1 then
if player(1,'health')>0 then
if player(1,'health')<50 then msg2(1,'this is a nice piece of new generation style code') end var = 'kids are stupid'
end 
parse('restart')
end msg(var) end return
end
end
04.08.18 06:31:11 pm
Up
panteon00
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
d = 50
for i = 1, d do
     if player(1,'exists') then
          if player(1,'team')==1 then
               if player(1,'health')>0 then
                    if player(1,'health')<50 then
                         msg2(1,'this is a nice piece of new generation style code')
                    end
               var = 'kids are stupid'
               end 
          parse('restart')
          end
     msg(var)
     end
return
end


@user Quattro:
you missed the do after the for-statement (line 2)

this code will throw an error message, if player 1 is dead and it is executed, because the variable var is unknown.
But why do you use a for-Loop, in this case it is pointless.
please tab your code

@user phalenkO:
you get the error-message because your message wasn't "!kick <id>"
remove the else-statement to avoid this
edited 2×, last 04.08.18 06:44:40 pm
loading...
04.08.18 10:20:06 pm
Up
Masea
Super User
Offline Off
user panteon00 has written:
please tab your code

You either don't know how to tab.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
d = 50
for i = 1, d do
     if player(1,'exists') then
          if player(1,'team')==1 then
               if player(1,'health')>0 then
                    if player(1,'health')<50 then
                         msg2(1,'this is a nice piece of new generation style code')
                    end
                    var = 'kids are stupid'
               end 
               parse('restart')
          end
          msg(var)
     end
     return
end
Create and design your GUI easy and fast: file cs2d GUI Framework (12) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (25)
04.08.18 11:03:48 pm
Up
phalenkO
User
Offline Off
@user panteon00: Sorry, but couldd u please give me an example?
04.08.18 11:32:17 pm
Up
panteon00
User
Offline Off
@user Masea: yes, you are right, my fault

@user phalenkO:
based on this code:
Spoiler >


if you write "hello" as a message,
the if-statement in line 4 returns false so that the else-statement is executed.

btw:
The return 1 is executed every time, that's why on your server no message are shown
and every body can kick players, because you don't test the identity of the player
loading...
To the start Previous 1 2 Next To the start