how to read several values out of a the chat
Let's say an admin uses (say / team_say) following command "/10 20 30".
How do I intercept those 3 values which do differ? |
Code:
|
also:
Code:
|
Thanks guys I'll try this right away.
After searching through the forum I started to get a similiar idea. |
I tried this but I'm not satisfied.
When checking for the return values with this test command "/10 20 30" arg holds 49 r holds actually 10 and all the others 0 I'm not too sure how the code really works. Doesn't "read_argv" already return the appropriate string? What does Code:
read_argv(1...I'm under the impression, also after double checking with the docs, that it would return the first three arguments. Which would mean that "arg" holds "/10", "arg2" " 20" and "arg3" " 30". Here btw I see why it would be necessary to trim the second and third argument. What am I misunderstanding here? EDIT: nvm the 49, I forgot that I %d a string instaed %s. |
read_argv(1,said,31)
the 1 is the ID, said is the name of the var and 31 is the lenght |
Well that's not really what I meant.
What exactly is the "ID"? The docs say "0" returns the command. What command? Is "/" the command? And everything after "0" is arguments. So let's say if "/num" is the command, "0" returns "/num" or "num"? Will I need to register "/num" as a command first? Let's assume an admin "say"s or "team_say"s this "/num 10 20 30". "read_argv( 0 ..." holds "/num" right? And "read_argv( 1 ..." holds "10" and "read_argv( 2 ..." holds "20" and so on right? I know it doesn't but that's how I understand the docs. What am I missing? |
Quote:
Quote:
|
Quote:
Quote:
Code:
if you do a read_argv(0, example, 3) it will return the /say /say_team command. So you want to start at 1 and on. Well you read it so fix it. k? |
You are all wrong. say and teamsay commands are wrapped up in quotes.
You must do read_args, then remove_quotes, then break it apart with strbreak or similar. |
| All times are GMT -4. The time now is 16:08. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.