SA-MP Forums Archive
strlen problem - 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: strlen problem (/showthread.php?tid=291627)



strlen problem - Sascha - 20.10.2011

hi guys,
I've done a new script with a /me cmd... (/me [text]), however I've a slight problem with the params...
(using zcmd)

that's the line:
pawn Код:
if(!strlen(params)) return SendClientMessage(playerid, GREY, "Command Useage: /me <text>");
I'm not sure what's wrong, however when I use "/me" without any params, it just sends "*MyName" instead of the message...
what's wrong with this?
(using zcmd, streamer, mysql and sscanf includes if that helps)..
never had that problem before...


Re: strlen problem - SmiT - 20.10.2011

Try using: if ( isnull ( params ) ) return SendClientMessage( playerid, GREY, "Command Useage: /me <text>" );
Or show us your whole command.


Re: strlen problem - Tomejus - 20.10.2011

Quote:
Originally Posted by SmiT
Посмотреть сообщение
Try using: if ( isnull ( params ) ) return SendClientMessage( playerid, GREY, "Command Useage: /me <text>" );
Or show us your whole command.
Use this. Or if you prefer sscanf you can use:

Код:
CMD:me( playerid, params[] )
{
	new
	    variable[ 128 ];,

	if( sscanf( params, "s", variable ) ) SendClientMessage( playerid, WHITE, "[ > ]{FF7E7E} Command USAGE: /me [text]" ); // s = string, variable = variable (example: text).
	else
	{
		// code.
	}
	return true;
}