AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Args - Help! (https://forums.alliedmods.net/showthread.php?t=159282)

-B1ng0- 06-15-2011 05:57

Args - Help!
 
Hello guys.

ex: i write in game chat: B1ng0 is here

in plugin i have: read_args(message, charsmax(message))

How i can get from message just first word "B1ng0"

jimaway 06-15-2011 06:41

Re: Args - Help!
 
you could just do:
read_argv(1,message,charsmax(message))

or use strbreak or something to break the message from read_args apart to get the first word

-B1ng0- 06-15-2011 08:41

Re: Args - Help!
 
Quote:

Originally Posted by jimaway (Post 1488606)
you could just do:
read_argv(1,message,charsmax(message))

or use strbreak or something to break the message from read_args apart to get the first word


with read_argv(1,message,charsmax(message)) dont work...

but second variant i dont know how to use...

drekes 06-15-2011 09:04

Re: Args - Help!
 
You can use parse()

PHP Code:

new szString[] = "Drekes is here";

new 
szFirst[10], szSecond[10];
parse(szStringszFirstcharsmax(szFirst), szSecondcharsmax(szSecond));

// szFirst = "Drekes"
// szSecond = "is here" 


-B1ng0- 06-15-2011 09:27

Re: Args - Help!
 
Quote:

Originally Posted by drekes (Post 1488664)
You can use parse()

PHP Code:

new szString[] = "Drekes is here";

new 
szFirst[10], szSecond[10];
parse(szStringszFirstcharsmax(szFirst), szSecondcharsmax(szSecond));

// szFirst = "Drekes"
// szSecond = "is here" 


Don't work...

new said[192];
read_args(said, charsmax(said));

if (!said[0])
return PLUGIN_CONTINUE;

new msg1[32], msg2[32];

parse(said, msg1, charsmax(msg1), msg2, charsmax(msg));

if i write: hello b1ng0

msg1 show me : hello b1ng0
msg2 dont show nothing...

Nyuszy 06-15-2011 09:36

Re: Args - Help!
 
add remove_quotes(said) after read_args(said, charsmax(said))

-B1ng0- 06-15-2011 09:44

Re: Args - Help!
 
#drekes & #Nyuszy ty guys, works perfectly!


All times are GMT -4. The time now is 23:30.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.