how to make chat continue in 2nd line
#1

Hello, I just want to ask, How do I make my chat to the 2nd line if the chat in line 1 is already full? example:

/b HELLO WORLD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ... <<<<<<EXAMPLE 128 CHARACTERSS

then I want to continue it in 2nd line, so it will be something like

Quote:

James_Phillip: HELLO WORLD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ...
James_Phillip: ... HIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII

I tried using code from THE_KNOWN but I keep getting error
Code:
stock splitstring(actualstring,&split1[],&split2[])
{
	if(sizeof(actualstring) > 100)
	{
	    new rlen = sizeof(actualstring) - 100, str[rlen];
	    format(split1,100,"%s",actualstring);
	    for(new i;i<rlen;i++)
	    {
			split2[i]=actualstring[99+i];
	    }
	}
	return 1;
}
Error:
Quote:

error 067: variable cannot be both a reference and an array (variable "split1")

Reply
#2

Code:
stock splitstring(actualstring,&split1[],&split2[])
Arrays are passed by reference you don't need to use & remove it
Reply
#3

Quote:
Originally Posted by Sreyas
View Post
Code:
stock splitstring(actualstring,&split1[],&split2[])
Arrays are passed by reference you don't need to use & remove it
how do I make it continue in 2nd line without it?
Reply
#4

Quote:
Originally Posted by DGRP
View Post
how do I make it continue in 2nd line without it?
It is not the thing splitting it. & means passing the memory address of a variable to function so what ever the changes made in that function's formal parameter affects in actual parameter (calling statement).
But the size of the array can't be predicted by compiler as it needs some computation to determine the size and is static allocation(cant predict what happens in run time).Therefore the arrays can't be copied and can't be passed as value.Hence,using references on array is pointless.What ever changes made in formal parameter will be reflected back to actual parameter if it is an array.

Note:Using strmid function you can make this function more simple.
Reply
#5

You could do something like this instead:
Code:
if (strlen(string) > 100)
{
    new message[100];

    format(message, sizeof(message), "%.100s", string);
    SendClientMessage(playerid, -1, message);
    format(message, sizeof(message), "...%s", string[100]);
    SendClientMessage(playerid, -1, message);
}
else SendClientMessage(playerid, -1, string);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)