My text is too short?
#1

This is a problem on all of my commands. I type in something long, that should be 100-200 character, but the server shows me the result in short, like only the first 50 or characters. What's wrong here?

pawn Код:
CMD:o(playerid, params[350])
{
    new text[371];
    if(sscanf(params, "%s", params)) return SendClientMessage(playerid, USAGE_COLOR, "Usage: /s [Global OOC]");
    format(text, sizeof(text), "> [OOC] %s: (( %s ))",pName[playerid], params);
    SendClientMessageToAll(GOOC_COLOR, text);
    return 1;
}
Also, when player types in normal chat, if he types too long of a line, the message won't show up. I want it to show the message, and if it's too long it should show the characters that are over the limit cut off, missing.

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(!pLoggedIn[playerid]) return 1;
    new chat[371];
    format(chat, sizeof(chat), "%s Says: %s", pName[playerid], text);
    ProxDetector(17.0, playerid, chat, LCHAT1_COLOR, LCHAT2_COLOR, LCHAT3_COLOR, LCHAT4_COLOR, LCHAT5_COLOR);
    return 0;
}
Reply
#2

It works, but now if the text is too long, the message won't show up.
Reply
#3

pawn Код:
CMD:o(playerid, params[])
{
    if(!pLoggedIn[playerid]) return 0;
    new input[128];
    if(sscanf(params, "s[128]", input)) return SendClientMessage(playerid, USAGE_COLOR, "Usage: /s [Global OOC]");
    if(!sscanf(params, "s[128]", input))
    {
        new text[129];
        format(text, sizeof(text), "> [OOC] %s: (( %s ))", pName[playerid], input);
        if(strlen(text > 128)) return SendClientMessage(playerid, 0xFF0000, "Your text is too long to show. Try to resize your text.");
        SendClientMessageToAll(GOOC_COLOR, text);
    }
    return 1;
}
Reply
#4

Okay, it works now. I've got one more question. How can I remove that global chat? Whenever I type something into regular chat, I get a local chat message displayed and a global chat message (2 messages instead of one). So, how to disable global chat?
Reply
#5

https://sampwiki.blast.hk/wiki/LimitGlobalChatRadius
Reply
#6

If you return 0 your OnPlayerChat the global chat shouldn't appear.
Reply
#7

Yes, it works now. Thanks all.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)