How to hide text from params?
#1

Hello reader,

I didn't know how to explain it in the title so fast but I mean like someone types the command "/pm 0 test." and it should just show "test." at params, I am using ZCMD.

This is the code I'm using:
pawn Код:
CMD:pm(playerid, params[])
{
    if (isnull(params)) return SendClientMessage(playerid, KLEUR_VOORB, "USAGE: /pm [ID] [text]");
    else if (strlen(params) >= 62) return SendClientMessage(playerid, KLEUR_VOORB, "You have exceeded the maximum command length, please use a shorter command.");
        else
        {
        new pmontvang[110];
        format(pmontvang, sizeof(pmontvang), "(( PM To %s [ %d ]: %s ))", pNaam(playerid), playerid, params);
        SendClientMessage(senderid, KLEUR_PM, pmontvang);
        new pmverstuur[110];
        format(pmverstuur, sizeof(pmverstuur), "(( PM From %s [ %d ]: %s ))", pNaam(playerid), playerid, params);
        SendClientMessage(playerid, KLEUR_PM, pmverstuur);
        }
    return 1;
}
and it works as this:

in game.

Thank you in advance.

Best regards,
Jesse
Reply
#2

i don't what you mean x) explain more; )
Reply
#3

By using params, it will use the whole text you are typing except the command name. Use sscanf.
pawn Код:
CMD:pm( playerid, params[ ] )
{
    new senderid, text[ 64 ], pmontvang[ 128 ];
    if( sscanf( params, "rs[64]", senderid, text ) ) return SendClientMessage( playerid, KLEUR_VOORB, "USAGE: /pm [ID] [text]" );
    if( strlen( params ) >= 62 ) return SendClientMessage( playerid, KLEUR_VOORB, "You have exceeded the maximum command length, please use a shorter command." );
    format( pmontvang, sizeof( pmontvang ), "(( PM To %s [ %d ]: %s ))", pNaam(playerid), playerid, text );
    SendClientMessage( senderid, KLEUR_PM, pmontvang);
    format( pmontvang, sizeof( pmontvang ), "(( PM From %s [ %d ]: %s ))", pNaam(playerid), playerid, text );
    SendClientMessage( playerid, KLEUR_PM, pmontvang );
    return 1;
}
Reply
#4

That when he uses /pm 0 test that there shouldn't come PM to/From Daniel Reagent [0]: 0 Test.
That the ''0'' is gone from the PM.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)