Forum

> > CS2D > Scripts > Block "!"?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Block "!"?

13 replies
To the start Previous 1 Next To the start

old Block "!"?

Mami Tomoe
User Off Offline

Quote
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

old Re: Block "!"?

Rainoth
Moderator Off Offline

Quote
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.

old Re: Block "!"?

Mami Tomoe
User Off Offline

Quote
@user Rainoth: Yay it worked!
I have another minor problem though:

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:
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

old Re: Block "!"?

Rainoth
Moderator Off Offline

Quote
@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 √

old Re: Block "!"?

Mami Tomoe
User Off Offline

Quote
@user Rainoth:
First code:
Yay it worked! I now understand that msg works like that:
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?

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

old Re: Block "!"?

Yates
Reviewer Off Offline

Quote
@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.

old Re: Block "!"?

Mami Tomoe
User Off Offline

Quote
Spoiler >


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

Spoiler >


All I added was:
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

old Re: Block "!"?

Mami Tomoe
User Off Offline

Quote
@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.

old Re: Block "!"?

Mami Tomoe
User Off Offline

Quote
@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

old Re: Block "!"?

Nekomata
User Off Offline

Quote
You might as well learn the differences between
1
return 0
and
1
return 1
too...

and lua.
and cs2d functions.
and the meaning of life. (?!)
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview