SA-MP Forums Archive
Split Text - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Split Text (/showthread.php?tid=590399)



Split Text - TH3_R3D™ - 28.09.2015

solved!


Re: Split Text - jihadmeneer - 28.09.2015

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!
        




Re: Split Text - TH3_R3D™ - 28.09.2015

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


Re: Split Text - Jefff - 28.09.2015

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);



Re: Split Text - jihadmeneer - 28.09.2015

Above should work haha ^ (Removed my code)


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


Re: Split Text - TH3_R3D™ - 28.09.2015

@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??


Re: Split Text - jihadmeneer - 28.09.2015

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 



Re: Split Text - TH3_R3D™ - 28.09.2015

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