if (strcmp("/", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_RED, "USAGE /say (message) - Enter A Message");
return 1;
}


CMD:say(playerid, params[])
{
new text[128], string[148];
if(sscanf(params, "s", text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /say (message) - Enter A Message");
format(string, sizeof(string), "%s: {FFFFFF}%s", PlayerName(playerid), text);
SendClientMessageToAll(GetPlayerColor(playerid), text);
return 1;
}

|
Oh, i forgot it thanks but the second command was working fine.
|
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success ) // this was added in ZCMD afaik
{
if( !success ) return SendClientMessage( playerid, -1, "USAGE /say (message) - Enter A Message" ); // this will work when you have typed any command which does not exist and even if you type a trailing slash.
return 1;
}
CMD:say( playerid, params[ ] )
{
if( isnull( params ) ) return SendClientMessage( playerid, COLOR_RED, "USAGE: /say (message) - Enter A Message" ); // we will be using params [parameters] as our TEXT which will be written after "/say "
new szStr[ 128 ];
format( szStr, sizeof( szStr ), "%s: {FFFFFF}%s", PlayerName( playerid ), params );
SendClientMessageToAll( GetPlayerColor( playerid ), szStr );
return 1;
}
stock PlayerName( playerid ) // if you don't have this stock you can use this
{
new szPlayerName[ MAX_PLAYER_NAME ]; // declaring a local var
GetPlayerName( playerid, szPlayerName, sizeof( szPlayerName ) ); // saving the player's name in the var
return szPlayerName; // returning the string of the name
}

|
FalconX i just changed the command system to ocmd because i want use OnPlayerCommandText too.
Problem solved you can ~close this. |