English Block "!"?

13 replies
Goto Page
To the start Previous 1 Next To the start
23.09.15 07:54:55 pm
Up
Mami Tomoe
User
Offline Off
Everything below was solved, but I still have problems in the comments if you wish to help.
Spoiler >
edited 5×, last 24.09.15 06:21:35 am
fish
23.09.15 08:27:45 pm
Up
eledah
User
Offline Off
«
Code:
1
\171


»
Code:
1
\187
[̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]
23.09.15 08:36:08 pm
Up
Mami Tomoe
User
Offline Off
@user eledah: Thank you, you solved my second problem!
fish
23.09.15 08:41:42 pm
Up
Rainoth
Moderator
Offline Off
Code:
1
2
3
if string.sub(txt, #txt-1,#txt) == "@C" then
     txt = string.sub(txt, 1, #txt-2)
end

Add this 'if' before your 'gmsg' command.
MAL • DeviantArt • For Wallpaper Engine users • Check YT for playlists... •
23.09.15 09:13:41 pm
Up
Mami Tomoe
User
Offline Off
@user Rainoth: Yay it worked!
I have another minor problem though:

Code:
1
msg("/169255255000[Server]: /169000255000..player(id,"name").. is now level 25 and was rewarded with 250k + VIP.")


I'm positive that I forgot to add something there but I just cant find it...


Also I have this thing:
Code:
1
2
3
4
5
6
7
if stag[id] == 0 then
if string.sub(txt, #txt-1,#txt) == "@C" then
     txt = string.sub(txt, 1, #txt-2)
      end
gmsg("255255255",player(id,"name").." [Level: "..cs_level[id].."]: "..txt)
return 1
end


When this tag is activated and I say something like !kick 1 it will show that I said !kick 1 but I don't want it to show that.
edited 1×, last 23.09.15 09:44:25 pm
fish
23.09.15 09:53:07 pm
Up
Rainoth
Moderator
Offline Off
@First Code: You missed quotes (") in a few spots. You tell lua that it's text if you quote something:
"This is a text because it's in quotes"
but sometimes you need to insert non-static stuff like say the player name so you have to concatenate it (..)
You've been doing that successfully but not defining text when it began or ended.

"this is text "..and_a_variable.." and text again"

Compare your code with this line above and you'll see where you miss quotes

@Second Code: It's a common problem. You've got contradicting returns. The most obvious reason is probably when you have multiple say hooks. To fix that, use only one say hook √
MAL • DeviantArt • For Wallpaper Engine users • Check YT for playlists... •
23.09.15 10:15:16 pm
Up
Mami Tomoe
User
Offline Off
@user Rainoth:
First code:
Yay it worked! I now understand that msg works like that:
Code:
1
msg("Welcome, "..player(id,"name").." to my server!")


Second code: I tried removing every single lua file and only left the original role play but the command will still show, and yes the say thing is in the role play script so there is only 1 hook for this say thing...

Can we create something like your @C block?

Code:
1
2
3
if string.sub(txt, #txt-1,#txt) == "!" then
     txt = string.sub(txt, 1, #txt-9999)
end
edited 5×, last 24.09.15 01:59:28 pm
fish
24.09.15 02:40:57 pm
Up
Yates
Reviewer
Offline Off
@user Mami Tomoe: Stop editing your post as new. You have a return 1 which fucks things up, stop bugging everyone and fix it. It's not that hard.

Or..

Give the full fucking code. We can't help you otherwise.
24.09.15 02:55:20 pm
Up
Mami Tomoe
User
Offline Off
Spoiler >


NEVER MIND! I fixed it myself! With the help of Yates

Spoiler >


All I added was:
Code:
1
2
3
4
if txt:sub(1,1)=="!" then
     ParseCommand(id,txt)
     else
gmsg("255255255",player(id,"name").." [Level: "..cs_level[id].."]: "..txt)


Thanks all for the hints
edited 1×, last 24.09.15 03:41:35 pm
fish
24.09.15 05:08:01 pm
Up
Yates
Reviewer
Offline Off
Told you so.
24.09.15 05:09:18 pm
Up
Mami Tomoe
User
Offline Off
@user Yates: But do you know how to make peoples able to say "rank"? Its not very needed but I would like them to be able to say that.
fish
24.09.15 05:10:19 pm
Up
Yates
Reviewer
Offline Off
Code:
1
2
3
if txt:sub(1,4)=="rank" then
     return 0
end

You're obviously not reading the docs so here:

www.cs2d.com/help.php
24.09.15 06:21:14 pm
Up
Mami Tomoe
User
Offline Off
@user Yates: Thanks :DDDD
I now learned a new thingy in lua

if txt:sub(1,4)=="rank" then

(1,4)
This is the number of letters from the start to end

"rank"
This is the word


Yay Yates :3
fish
25.09.15 10:11:18 am
Up
Nekomata
User
Offline Off
You might as well learn the differences between
Code:
1
return 0
and
Code:
1
return 1
too...

and lua.
and cs2d functions.
and the meaning of life. (?!)
To the start Previous 1 Next To the start