How to hide text from params? - 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: How to hide text from params? (
/showthread.php?tid=320013)
How to hide text from params? -
jessejanssen - 21.02.2012
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
Re: How to hide text from params? -
deltapro - 21.02.2012
i don't what you mean x) explain more; )
Re: How to hide text from params? -
Konstantinos - 21.02.2012
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;
}
Re: How to hide text from params? -
Kellicia - 21.02.2012
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.