Inputtext Dialog help.
#1

Hello.

I'm trying to make a code where a player enters text, that will be showed on other player's screen for 6 seconds. But it's converting the inputtext to a integer, I know why it is making it a integer, but if I do
pawn Код:
new text = inputtext;
It doesn't compile.

Help is appreciated. thanks.

pawn Код:
if(dialogid == announce)
    {
        new string[25];
        new text = strval(inputtext);
        if(text > 25) return SendClientMessage(playerid,COLOR_RED, "Keep your text characters below 25.");
        format(string,sizeof(string), "~g~%s",text);
        GameTextForAll(string, 6000, 2);
        return 1;
    }
Reply
#2

pawn Код:
if(dialogid == announce)
{
    new len = strlen(inputtext);
    if(len == 0) SendClientMessage(playerid,COLOR_RED, "Empty inputtext.");
    else if(len > 25) SendClientMessage(playerid,COLOR_RED, "Keep your text characters below 25.");
    else{
        new string[30];
        format(string,sizeof(string), "~g~%s",inputtext);
        GameTextForAll(string, 6000, 2);
    }
    return 1;
}
Reply
#3

Ah, so it's strlen I was looking for. Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)