Raised This Month: $ Target: $400
 0% 

String Operations


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 10-09-2010 , 13:31   String Operations
Reply With Quote #1

Hi, i need help again

I have my string array: szText[192]
I put some words in the array using:
PHP Code:
public RegisterText(id)
{
    
client_cmd(id"messagemode Register_Text")
    
    
client_print(idprint_center"Write String")
    
set_hudmessage(255000.00.000.14.00.010.01, -1)
    
ShowSyncHudMsg(idg_MsgSync2"^n^n^n  Write String")
    
    return 
PLUGIN_CONTINUE;
}

public 
Text_register(id)
{
    
read_argsszText191 )
    
remove_quotesszText )
    
trim szText )
        
    
    
copyText[id], charsmaxText ), szText )
    
    
client_printidprint_chat"Tu string es: %s"Text[id] )
    
RegisterPassword(id)
    return 
PLUGIN_CONTINUE;
    

Now i want to put each 2 words of the string in a independent array but i donīt have any idea to do this

I want to do something like that

He --> Array1
ll ---> Array2
o^0 --->Array3
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.

Last edited by S34Qu4K3; 10-09-2010 at 13:37.
S34Qu4K3 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-09-2010 , 13:49   Re: String Operations
Reply With Quote #2

Code:
new szPieces[ 10 ][ 3 ]; // 10 max pieces with length of 2 // szInput is the string you are finding pieces of new i, iPos; while( i < sizeof( szPieces ) && szInput[ iPos ] ) {     iPos+= copy( szPieces[ i++ ], charsmax( szPieces ), szInput ); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 10-09-2010 , 13:56   Re: String Operations
Reply With Quote #3

Thanks Exolent
More questions:
if i want to operate with the first array Itīs well that i use:
PHP Code:
szPieces[0][3
??
How can i convert all the words using the ASCII alphabet to a number ej: A= 97, B=98 etc
I want this to make this operation with each array

_---------|a b |
(97, 98 )x |___| = (97 x a + 98 x c, 98 x b + 98 x d)
_---------|c d |



Thank you and sorry for all my doubts
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.

Last edited by S34Qu4K3; 10-09-2010 at 14:01.
S34Qu4K3 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-09-2010 , 13:59   Re: String Operations
Reply With Quote #4

Quote:
Originally Posted by S34Qu4K3 View Post
Thanks Exolent
More questions:
if i want to operate with the first array Itīs well that i use:
PHP Code:
szPieces[0][3
??
How can i convert all the words using the ASCII alphabet to a number ej: A= 97, B=98 etc

Thank you and sorry for all my doubts
Using that code, here is what you would get:
Code:
// szInput = "Testing" szPieces[ 0 ][ 0 ] = 'T' szPieces[ 0 ][ 1 ] = 'e' szPieces[ 1 ][ 0 ] = 's' szPieces[ 1 ][ 1 ] = 't' szPieces[ 2 ][ 0 ] = 'i' szPieces[ 2 ][ 1 ] = 'n' szPieces[ 3 ][ 0 ] = 'g' szPieces[ 4 ][ 1 ] = '^0' or 0

Characters in Pawn are also integers.

Try this:
Code:
server_print( "'a' = %i", 'a' )
It will output:
Code:
'a' = 97
Also, a=97, b=98, and A=65, B=66.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Old 10-09-2010, 14:05
S34Qu4K3
This message has been deleted by S34Qu4K3. Reason: go down
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:18.


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