Raised This Month: $ Target: $400
 0% 

How to parse string


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-14-2011 , 00:37   Re: How to parse string
Reply With Quote #6

This is how I would 'parse' the string:

PHP Code:
    new szArg[45]
    
read_args(szArgcharsmax(szArg))
    
// Might need a remove_quotes(szArg) here.  I can't remember.
    
new szCmd[12], szTarget[12], szTime[4], szReason[20]
    
strbreak(szArgszCmdcharsmax(szCmd), szArgcharsmax(szArg))
    
strbreak(szArgszTargetcharsmax(szTarget), szArgcharsmax(szArg))
    
strbreak(szArgszTimecharsmax(szTime), szReasoncharsmax(szReason))
    
    
client_print(idprint_console"Command: %s"szCmd// In your case szCmd should be "!mute"
    
client_print(idprint_console"Target: %s"szTarget)
    
client_print(idprint_console"Time: %d"str_to_num(szTime))
    
client_print(idprint_console"Reason: %s"szReason

Quote:
Originally Posted by minimiller View Post
Or you can use parse()
You can't use parse if you want to have any spaces in the reason section.
__________________

Last edited by fysiks; 05-14-2011 at 01:10.
fysiks is offline
 



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 04:20.


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