SA-MP Forums Archive
Little Help With RegEx - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Little Help With RegEx (/showthread.php?tid=407600)



Little Help With RegEx - [AU]Ownage - 14.01.2013

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;
    }



Re: Little Help With RegEx - mineralo - 14.01.2013

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;
    }



Re: Little Help With RegEx - [AU]Ownage - 14.01.2013

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