Split Text
#1

solved!
Reply
#2

This is what I use!

PHP код:
CMD:me(playeridparams[])
{
    new 
msg[125], string[124];
    if(!
sscanf(params"s[128]"msg))
    {
        if(!
CharacterData[playerid][pLoggedIn])
        {
            return 
ErrorMessage(playerid"You haven't spawned yet");
        }
        if(
strlen(params) > 64// If it's bigger then this number make it two lines!
        
{
            new 
text1[65], text2[65];
            
strmid(text2params64128);
            
strmid(text1params064);
            
format(string128"* %s %s...",PlayerRPName(playerid), text1);
               
SendLocalMessage(playerid20.0PURPLEstring);
            
format(string128"...%s (( %s ))."text2PlayerRPName(playerid));
            
SendLocalMessage(playerid20.0PURPLEstring);
        }
        else 
// Make it a single line!
        
{
            
format(stringsizeof(string), "* %s %s"PlayerRPName(playerid), msg);
            
SendLocalMessage(playerid20.0PURPLEstring);
        }
    }
    else
    {
        
SyntaxMessage(playerid"USAGE: /me [action]");
    }
    return 
1;

PHP код:
So, if you need a string splitted at 24 characters:
        if(
strlen(params) > 24// If it's bigger then this number make it two lines!
        
{
            
// Do something!
        
}
        else 
// Make it a single line!
        
{
            
// DO something!
        

Reply
#3

Thanks, but if you haven't noticed yet, I am using Textdraws which makes it a bit complex
Reply
#4

pawn Код:
new string[128];
format(string, sizeof(string), "~p~%s", Text);

for(new count, len = strlen(Text); count < len; count+=24)
    strins(string, "~n~", count);

PlayerTextDrawSetString(playerid, DescriptionTD[3], string);
Reply
#5

Above should work haha ^ (Removed my code)


If this doens't help send the entire command/code!
Reply
#6

@Jefff wow! That's what I meant for ages, but I couldn't conclude your simple code, Could you please explain how this code works??
Reply
#7

PHP код:
new string[128]; // Creates the string
format(stringsizeof(string), "~p~%s"Text); // Add text to the string
for(new countlen strlen(Text); count lencount+=24// Makes a loop for each 24 times it adds a ~n~
    
strins(string"~n~"count); // Function to add the ~с~
PlayerTextDrawSetString(playeridDescriptionTD[3], string); // Set the string of the textdraw 
Reply
#8

Quote:
Originally Posted by jihadmeneer
Посмотреть сообщение
PHP код:
new string[128]; // Creates the string
format(stringsizeof(string), "~p~%s"Text); // Add text to the string
for(new countlen strlen(Text); count lencount+=24// Makes a loop for each 24 times it adds a ~n~
    
strins(string"~n~"count); // Function to add the ~с~
PlayerTextDrawSetString(playeridDescriptionTD[3], string); // Set the string of the textdraw 
lol, I know this already, of course thank you! But I need to get this in details, for instance;
PHP код:
count lencount+=24 
how this part is working exactly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)