AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do i split a string and remove the spaces? RESOLVED :o) (https://forums.alliedmods.net/showthread.php?t=10065)

Noobie 02-07-2005 12:16

How do i split a string and remove the spaces? RESOLVED :o)
 
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.

twistedeuphoria 02-07-2005 12:24

Haven't used this but it might be what your looking for -> http://www.amxmodx.org/funcwiki.php?go=func&id=59

Noobie 02-07-2005 12:29

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.

twistedeuphoria 02-07-2005 12:31

Where are you getting the string from? A console command or say or what?

Noobie 02-07-2005 12:36

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)

twistedeuphoria 02-07-2005 12:42

Have you tried read_argv - ing a few times?

Noobie 02-07-2005 12:53

i tried read_args, i will try argv instead and see if that works lol
thanks :)

Noobie 02-07-2005 13:00

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
:(

twistedeuphoria 02-07-2005 13:03

Don't do read_args, just read_argv's.

Noobie 02-07-2005 13:11

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. :roll:
Thanks for you help tho.


All times are GMT -4. The time now is 19:29.

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