Seperate
#1

Код:
stock Seperate(Source[], Destination[][], Seperater) {
	new DestinationNum = 0,
		DestinationPos = 0;

	for(new SourcePos = 0; Source[SourcePos]; SourcePos++) {
	    if(Source[SourcePos] != Seperater) {
	        Destination[DestinationNum][DestinationPos] = Source[SourcePos];
	        DestinationPos++;
	    } else {
	        if(strlen(Destination[DestinationNum]) > 0) {
	    		DestinationNum++;
	    		DestinationPos = 0;
    		}
	    }
	}
	return true;
}
This code runs fine, I made and tested it myself.
But there's a feature I want added to it.

Код:
public OnGameModeInit() {
	new Result[5][100];
	
	Seperate("23 Hello   World! 54.5 How ya doing?", Result, ' ');
	
	printf("%s %s %s", Result[1], Result[2], Result[4]);
	return true;
}
Right now that code will display,
Quote:

Hello World! How

in the server.log.

I want it to display,
Quote:

Hello World! How ya doing?

instead.

I want it so if the person new Result[2][100]; it will ignore the Seperater after it is done creating Result[1].
I want it so if the person new Result[5][100]; it will ignore the Seperater after it is done creating Result[4].
Reply
#2

Would still love help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)