View Single Post
Riotline
AlliedModders Donor
Join Date: Oct 2015
Location: Half Life 3
Old 06-29-2017 , 03:25   Re: Chat Text Error/ExplodingImploding String
Reply With Quote #4

Quote:
Originally Posted by hmmmmm View Post
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.
After trying to apply this, the logs show an error everytime with the C_SplitString
__________________
Riotline is offline