View Single Post
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 06-28-2017 , 02:29   Re: Chat Text Error/ExplodingImploding String
Reply With Quote #2

PHP Code:
char gC_Colours[][][] = {

    {
"White""{white}""\x01"},
    {
"Red""{red}""\x07"},
    {
"Light Red""{lightred}""\x0F"},
    {
"Dark Red""{darkred}""\x02"},
    {
"Blue-Gray""{bluegrey}""\x0A"},
    {
"Blue""{blue}""\x0B"},
    {
"Dark Blue""{darkblue}""\x0C"},
    {
"Orchid""{orchid}""\x0E"},
    {
"Yellow""{yellow}""\x09"},
    {
"Gold""{gold}""\x10"},
    {
"Light Green""{lightgreen}""\x05"},
    {
"Green""{green}""\x04"},
    {
"Lime""{lime}""\x06"},
    {
"Gray""{grey}""\x08"},
    {
"Gray2""{grey2}""\x0D"},
    {
"Team Colour""{teamcolor}""\x03"},
    {
"Purple""{purple}""\x03"},
    {
"Default""{default}""\x01"},

}

stock void GetRandomColours(char[] message) {

    
int I_Split;
    
char C_SplitString[64][512];

    
ExplodeString(message" "C_SplitString64512);

    while (
strlen(C_SplitString[I_Split]) > 0) {

        
int I_Random GetRandomInt(0sizeof(gC_Colours) - 4);
        
Format(C_SplitString[I_Split], 512"%s%s"gC_Colours[I_Random][2], C_SplitString[I_Split]);

        
I_Split++;

    }

    
ImplodeStrings(C_SplitStringI_Split" "message512);


This is how I went about it instead of using bunch of switch statements.
hmmmmm is offline