SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 08/07/2012, 12:01 PM   #1
[WSF]ThA_Devil
Gangsta
 
[WSF]ThA_Devil's Avatar
 
Join Date: Sep 2010
Location: United Kingdom
Posts: 662
Reputation: 55
Default Multi Lined Dynamic Strings.

Hello, I am developing a role-play server and i have difficulties with making strings / text what player enters in chatbot in multiple lines IF it exeeds string limit
I've tried this way:
pawn Code:
public OnPlayerText(playerid, text[])
{
    new message[128],message2[128];
    format(message, sizeof(message), "%s says: %s", GetName(playerid), text);
    message = message2;
    new stringLength = strlen(message);
    if(stringLength >= 127)
    {
        strdel(message,128,256);
        ProxDetector(30.0, playerid, message, -1);
        strdel(message2,0,127);
        ProxDetector(30.0, playerid, message2, -1);
    } else {
        ProxDetector(30.0, playerid, message, -1);
    }
    return 0;
}
But, all it does is it makes new 2 empty lines...
Help is apreetiated.
__________________
Quote:
Originally Posted by Shinobu View Post
Somebody save me, I am not a server.
[WSF]ThA_Devil is offline   Reply With Quote
Old 08/07/2012, 12:14 PM   #2
Toreno
Gangsta
 
Join Date: Nov 2010
Posts: 725
Reputation: 41
Default Re: Multi Lined Dynamic Strings.

Hey there, try this one.
pawn Code:
public OnPlayerText(playerid, text[])
{
    if(strlen(text) > 64)
    {
        new str_one[64], str_two[64];
        strmid(str_two, text, 64, 128);
        strmid(str_one, text, 0, 64);
        format(str_one, 64, "%s says: %s", GetName(playerid), str_one);
        format(str_two, 64, "%s says: %s", GetName(playerid), str_two);
        ProxDetector(30.0, playerid, str_one, -1);
        ProxDetector(30.0, playerid, str_two, -1);
    }
    else
    {
        format(str_one, 64, "%s says: %s", GetName(playerid), text);
        ProxDetector(30.0, playerid, str_one, -1);
    }
    return 1;
}
Toreno is offline   Reply With Quote
Old 08/07/2012, 12:20 PM   #3
[WSF]ThA_Devil
Gangsta
 
[WSF]ThA_Devil's Avatar
 
Join Date: Sep 2010
Location: United Kingdom
Posts: 662
Reputation: 55
Default Re: Multi Lined Dynamic Strings.

Thanks, worked. Btw, u missed return 0;
__________________
Quote:
Originally Posted by Shinobu View Post
Somebody save me, I am not a server.
[WSF]ThA_Devil 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
3dtextlabel dynamic or not dynamic help! Dubbystep Scripting Help 0 05/02/2012 04:19 PM
Gta-Multi alpha500delta Server Support 3 21/06/2011 05:10 PM


All times are GMT. The time now is 04:55 AM.


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