edited 5×, last 24.09.15 06:21:35 am
Forum
CS2D Scripts Block "!"?Block "!"?
13 replies 1
1
\171
»
1
\187
1
2
3
2
3
if string.sub(txt, #txt-1,#txt) == "@C" then 	txt = string.sub(txt, 1, #txt-2) end
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
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
"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
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
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
Or..
Give the full fucking code. We can't help you otherwise.
NEVER MIND! I fixed it myself! With the help of Yates
All I added was:
1
2
3
4
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
1
2
3
2
3
if txt:sub(1,4)=="rank" then 	return 0 end
www.cs2d.com/help.php
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
1
return 0
1
return 1
and lua.
and cs2d functions.
and the meaning of life. (?!)
1