Raised This Month: $ Target: $400
 0% 

How do i split a string and remove the spaces? RESOLVED :o)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Noobie
Junior Member
Join Date: Oct 2004
Location: uk
Old 02-07-2005 , 12:16   How do i split a string and remove the spaces? RESOLVED :o)
Reply With Quote #1

Hi, i have a problem and it's really annoying me, i want to split a string into 4 pieces and remove the spaces from this:

"vote battlefield sq1 linebattle"

into this:

var1 = "vote"
map1 = "battlefield"
map2 = "sq1"
map3 = "linebattle"

i have searched and tried a lot of things like parse,copyc, read_args
and i am about to give up so any help would be great ty.
Noobie is offline
Send a message via ICQ to Noobie Send a message via AIM to Noobie Send a message via MSN to Noobie
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 02-07-2005 , 12:24  
Reply With Quote #2

Haven't used this but it might be what your looking for -> http://www.amxmodx.org/funcwiki.php?go=func&id=59
__________________
twistedeuphoria is offline
Noobie
Junior Member
Join Date: Oct 2004
Location: uk
Old 02-07-2005 , 12:29  
Reply With Quote #3

I did try that, but i couldn't get it to work
the problem i am having is that the size of the stings that i am trying to split will be different everytime, thanks anyway.
Noobie is offline
Send a message via ICQ to Noobie Send a message via AIM to Noobie Send a message via MSN to Noobie
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 02-07-2005 , 12:31  
Reply With Quote #4

Where are you getting the string from? A console command or say or what?
__________________
twistedeuphoria is offline
Noobie
Junior Member
Join Date: Oct 2004
Location: uk
Old 02-07-2005 , 12:36  
Reply With Quote #5

Yep, i'm getting it from say, so i that can do a map vote with say instead of from the console, the only bit that i'm really stuck on is splitting the strings

i tried this but i can't get it to work either

parse(CmdMsg,Cmd,32,Msg,32,Msg1,32,Msg2,32)
Noobie is offline
Send a message via ICQ to Noobie Send a message via AIM to Noobie Send a message via MSN to Noobie
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 02-07-2005 , 12:42  
Reply With Quote #6

Have you tried read_argv - ing a few times?
__________________
twistedeuphoria is offline
Noobie
Junior Member
Join Date: Oct 2004
Location: uk
Old 02-07-2005 , 12:53  
Reply With Quote #7

i tried read_args, i will try argv instead and see if that works lol
thanks
Noobie is offline
Send a message via ICQ to Noobie Send a message via AIM to Noobie Send a message via MSN to Noobie
Noobie
Junior Member
Join Date: Oct 2004
Location: uk
Old 02-07-2005 , 13:00  
Reply With Quote #8

It didn't work
Code:
read_args(CmdMsg,100)     read_argv(1,Cmd,32)     read_argv(2,Msg,32)     read_argv(3,Msg1,32)

Msg had nothing in it, Cmd had the whole line, so did CmdMsg
Noobie is offline
Send a message via ICQ to Noobie Send a message via AIM to Noobie Send a message via MSN to Noobie
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 02-07-2005 , 13:03  
Reply With Quote #9

Don't do read_args, just read_argv's.
__________________
twistedeuphoria is offline
Noobie
Junior Member
Join Date: Oct 2004
Location: uk
Old 02-07-2005 , 13:11  
Reply With Quote #10

Same thing, sigh...
Code:
    read_argv(1,Cmd,32)     read_argv(2,Msg,32)     read_argv(3,Msg1,32)

Cmd has the whole line, Msg and Msg1 are empty.
Thanks for you help tho.
Noobie is offline
Send a message via ICQ to Noobie Send a message via AIM to Noobie Send a message via MSN to Noobie
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 19:29.


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