Raised This Month: $ Target: $400
 0% 

how to replace to _ if command have space?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lucky109
Senior Member
Join Date: Jan 2005
Old 06-07-2007 , 16:01   how to replace to _ if command have space?
Reply With Quote #1

how to replace space to _ if command have space?

E.G
Code:
#include <amxmodx>

public plugin_init() { 
   register_plugin("test","1.0",test")
   register_clcmd("test","test_function",0,"test <sentence words>")
   return PLUGIN_CONTINUE
} 

public test_function(id) {
new arg[32]
read_argv(1,arg,31) 
client_print(id,print_chat,"%s",arg) 
}
if i have to type "test helo goodmorning john"
it's show "helo" only

how can i get the full sentence " helo goodmorning john" ??

thanks
lucky109 is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 06-07-2007 , 16:16   Re: how to replace to _ if command have space?
Reply With Quote #2

read_args ( output[], len )

greetz regalis
__________________
regalis is offline
ChanT
Junior Member
Join Date: Mar 2006
Old 06-07-2007 , 16:17   Re: how to replace to _ if command have space?
Reply With Quote #3

Quote:
Originally Posted by lucky109 View Post
how to replace space to _ if command have space?

E.G
Code:
#include <amxmodx>

public plugin_init() { 
   register_plugin("test","1.0",test")
   register_clcmd("test","test_function",0,"test <sentence words>")
   return PLUGIN_CONTINUE
} 

public test_function(id) {
new arg[32]
read_argv(1,arg,31) 
client_print(id,print_chat,"%s",arg) 
}
if i have to type "test helo goodmorning john"
it's show "helo" only

how can i get the full sentence " helo goodmorning john" ??

thanks
If i correctly understood what u meant then just try to replace read_argv(1,arg,31) with: read_args(arg,31)

EDIT: eww a sec to late
ChanT is offline
_Master_
Senior Member
Join Date: Dec 2006
Old 06-08-2007 , 05:36   Re: how to replace to _ if command have space?
Reply With Quote #4

Note: you should specify a len value large enough to hold the whole argument line, otherwise it will be truncated
_Master_ is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 06-09-2007 , 12:58   Re: how to replace to _ if command have space?
Reply With Quote #5

@lucky109

test helo goodmorning john
Will return "helo"
test "helo goodmorning john"
Will return "helo goodmorning john"
@others
I'm not sure if read_args will work like you guys say, haven't tested it recently.
stupok is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:36.


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