SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 29/11/2012, 08:41 AM   #1
JaKe Elite
High-roller
 
JaKe Elite's Avatar
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,691
Reputation: 486
Default Making the chat and the message split?

Is it possible to split up the chat??

Like if i've 120 lengths in my word it will automatically do like

Code:
I love Chicken I ha-
te McDonalds
I've one but it shows the name like

Code:
* Romel Rowan junking in the yard for 3 mon-
* Romel Rowan ths
Here is the code

pawn Code:
if(IsPlayerInRangeOfPoint(i, radi, x, y, z))
{
    if(strlen(string) <= 120) SendClientMessage(i, color, string);
    else
    {
        new texts[120];
        strmid(texts, string, 120, 129);
        strins(string, "-", 120, 1);
        strdel(string, 121, 129);
        SendClientMessage(i, color, string);
        SendClientMessage(i, color, string);
    }
}
__________________
Haven County Roleplay (Click here to join the server)
Discord: Click here to join our Discord
Website: Click here to register
____________________________
Discord: Corporal★Shepard#3135
JaKe Elite is offline   Reply With Quote
Old 29/11/2012, 08:48 AM   #2
Boooth
Banned
 
Join Date: Oct 2010
Posts: 195
Reputation: 24
Default Re: Making the chat and the message split?

Can you show me your OnPlayerCommandText.
Boooth is offline   Reply With Quote
Old 29/11/2012, 08:49 AM   #3
JaKe Elite
High-roller
 
JaKe Elite's Avatar
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,691
Reputation: 486
Default Re: Making the chat and the message split?

I'm not using OnPlayerCommandText
__________________
Haven County Roleplay (Click here to join the server)
Discord: Click here to join our Discord
Website: Click here to register
____________________________
Discord: Corporal★Shepard#3135
JaKe Elite is offline   Reply With Quote
Old 29/11/2012, 11:39 AM   #4
GiamPy.
Huge Clucker
 
GiamPy.'s Avatar
 
Join Date: Apr 2011
Location: Ravenna, Italy
Posts: 221
Reputation: 16
Default Re: Making the chat and the message split?

pawn Code:
stock SendPlayerExtendedMessage(playerid, color, const string[])
{
    new firstString[128],
        secondString[128],
        finalStringLINE1[128],
        finalStringLINE2[128];
       
    if(strlen(string) > 70) // here you can choose the lenght of the first string
    {
        format(firstString, sizeof(firstString), string);
        format(secondString, sizeof(secondString), string);
       
        strdel(firstString, 70, 140);
        strdel(secondString, 0, 70);
       
        format(finalStringLINE1, sizeof(finalStringLINE1), "%s ...", firstString);
        SendClientMessage(playerid, color, finalStringLINE1);
        format(finalStringLINE2, sizeof(finalStringLINE2), "... %s", secondString);
        SendClientMessage(playerid, color, finalStringLINE2);
        return true;
    }
    else
    {
        SendClientMessage(playerid, color, string);
        return true;
    }
}
GiamPy. is offline   Reply With Quote
Old 29/11/2012, 11:46 AM   #5
[MM]RoXoR[FS]
Gangsta
 
[MM]RoXoR[FS]'s Avatar
 
Join Date: Mar 2012
Location: Gurgaon,India
Posts: 738
Reputation: 138
Default Re: Making the chat and the message split?

Try this

UNTESTED


pawn Code:
if(IsPlayerInRangeOfPoint(i, radi, x, y, z))
{
    new j=0;
    new temp[121];
    for(;string[j]!='\0';)
    {
        for(new i=0;i<=119 && string[j]!='\0';++i)
        {
            temp[i]=string[j];
            ++j;
        }
        temp[120]='-';
        SendClientMessage(i, color,temp);
    }
}
__________________
My Works
Top Players Include[Sorts Player's Kills|Money|Deaths|ANYTHING YOU WANT|
pawn Code:
public OnPlayerConnect(playerid)
{
  Ban(playerid);
  return 1;
}

Scripting for Money
[MM]RoXoR[FS] is offline   Reply With Quote
Old 30/11/2012, 12:03 AM   #6
JaKe Elite
High-roller
 
JaKe Elite's Avatar
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,691
Reputation: 486
Default Re: Making the chat and the message split?

I will try later. I'm in mobile.
__________________
Haven County Roleplay (Click here to join the server)
Discord: Click here to join our Discord
Website: Click here to register
____________________________
Discord: Corporal★Shepard#3135
JaKe Elite is offline   Reply With Quote
Old 30/11/2012, 09:25 AM   #7
JaKe Elite
High-roller
 
JaKe Elite's Avatar
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,691
Reputation: 486
Default Re: Making the chat and the message split?

RoXor it works but it fails to split up.
I type random words at the end i type.

Code:
xenialoveu
but it shows

Code:
xenialove-x
__________________
Haven County Roleplay (Click here to join the server)
Discord: Click here to join our Discord
Website: Click here to register
____________________________
Discord: Corporal★Shepard#3135
JaKe Elite is offline   Reply With Quote
Old 30/11/2012, 09:46 AM   #8
cosbraa
Big Clucker
 
Join Date: Apr 2012
Posts: 126
Reputation: 19
Default Re: Making the chat and the message split?

pawn Code:
stock strsplit(source[], first[], second[], split_pos)
{
    strmid(source, first, 0, split_pos);
    strins(first, "-", split_pos);
    strmid(source, second, split_pos, strlen(source));
    return 1;
}
I had something like this, don't have access to it right now.
Might have to play around with it, but it worked for me.
cosbraa is offline   Reply With Quote
Old 30/11/2012, 09:49 AM   #9
JaKe Elite
High-roller
 
JaKe Elite's Avatar
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,691
Reputation: 486
Default Re: Making the chat and the message split?

How could i use it.?
__________________
Haven County Roleplay (Click here to join the server)
Discord: Click here to join our Discord
Website: Click here to register
____________________________
Discord: Corporal★Shepard#3135
JaKe Elite is offline   Reply With Quote
Old 30/11/2012, 10:14 AM   #10
cosbraa
Big Clucker
 
Join Date: Apr 2012
Posts: 126
Reputation: 19
Default Re: Making the chat and the message split?

pawn Code:
CMD:me(playerid, params[])
{
    new line1[128], line2[128], string[128];
    if(strlen(params) > 120)
    {
        // "* 012345678901234567890123 " = 27 characters. 128 - 27 = 101
        strsplit(params, line1, line2, 101);
        format(string, sizeof(string), "* %s %s", GetNameEx(playerid), line1);
        NearByMessage(playerid, COLOUR, string);
        format(string, sizeof(string), "* %s ((%s)), line2, GetNameEx(playerid));
        NearByMessage(playerid, COLOUR, string);
    }
    else
    {
        format(string, sizeof(string), "
* %s %s", GetNameEx(playerid), params);
        NearByMessage(playerid, COLOUR, string);
    }
    return 1;
}
that kind of way. on ipod, may have mistakes.
cosbraa is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
making chat longer megamind2067 Client Support 3 26/11/2012 07:19 PM
[Tutorial] Making New Chat Amel_PAtomAXx Tutorials 10 10/08/2011 02:21 PM
Split /me | /do message to next line SaW_[VrTx] Help Archive 1 07/03/2011 01:11 PM
making local chat amrour Help Archive 8 17/02/2009 02:11 PM


All times are GMT. The time now is 06:37 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.