Little Help With RegEx
#1

Hey, I haven't scripted in pawn for awhile now...
I'm having trouble trying to get this little snippet to work, what I want it to do is limit the characters you are allowed to use with the /me command and I can't quite get it to work. Also how would I be able to tell them their message is too long? Thanks for your help

Код:
#define MeOutput(%1) \
    regex_search(%1, "^(.{1,72})")
I know the RegEx is correct I just can't get it to work the way I want (It doesn't return anything)
Код:
    if(!strcmp(cmdtext, "/me", true, 3))
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFFFF00AA, "USAGE: /me [action]");
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "%s %s", str, ReturnText(cmdtext[4]));
        SendClientMessageToAll(0x400080FF, str);
        return 1;
    }
Reply
#2

pawn Код:
if(!strcmp(cmdtext, "/me", true, 3))
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFFFF00AA, "USAGE: /me [action]");
        if(strlen(cmdtext) > limite) return SendClientMessage(playerid,-1,"Too long message");// add limite
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "%s %s", str, ReturnText(cmdtext[4]));
        SendClientMessageToAll(0x400080FF, str);
        return 1;
    }
Reply
#3

Quote:
Originally Posted by mineralo
Посмотреть сообщение
pawn Код:
if(!strcmp(cmdtext, "/me", true, 3))
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFFFF00AA, "USAGE: /me [action]");
        if(strlen(cmdtext) > limite) return SendClientMessage(playerid,-1,"Too long message");// add limite
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "%s %s", str, ReturnText(cmdtext[4]));
        SendClientMessageToAll(0x400080FF, str);
        return 1;
    }
Thanks

Good to go
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)