23.02.2012, 18:31
pawn Код:
CMD:mc( playerid, params[ ] ) // Command
{
new Str_mission[ 32 ], // a string of 32 Chatacters for the 'On mission' (Yes/No)
Str_maffia[ 32 ], // a string of 32 Chatacters for the 'On maffia' (Yes/No)
Str_overloaded[ 32 ], // a string of 32 Chatacters for the 'Overloaded' (Yes/No)
msg[ 128 ], // A string that we will send the message
targetplayer; // 'playerid' Variable
if( sscanf( params, "r", targetplayer )) return SendClientMessage( playerid, 0xFFFFFFFF, "[USAGE]: /mc [id]" );
// Sscanf parameter for '/mc [ID/Part Of Name]'
if( APlayerData[ targetplayer ][ JobStarted ] == true ) format( Str_mission, sizeof( Str_mission ), " On a mission: {66FF00}Yes " );
else format( Str_mission, sizeof( Str_mission ), " On a mission: {FF0000}No " );
// if the JobStarted is true it store at the 'Str_mission' Variable the text: On a mission: {66FF00}Yes
// Else it stores the text: On a mission: {FF0000}No
if( APlayerData[ targetplayer ][ MafiaLoad ] == true ) format( Str_maffia, sizeof( Str_maffia ), " Maffia load: {66FF00}Yes " );
else format( Str_maffia, sizeof( Str_maffia ), " Maffia load: {FF0000}No " );
// if the MafiaLoad is true it store at the 'Str_maffia' Variable the text: Maffia load: {66FF00}Yes
// Else it stores the text: Maffia load: {FF0000}No
if( APlayerData[ targetplayer ][ Overloaded ] == true ) format( Str_overloaded, sizeof( Str_overloaded ), " Overloaded: {66FF00}Yes " );
else format( Str_overloaded, sizeof( Str_overloaded ), " Overloaded: {FF0000}No " );
// if the MafiaLoad is true it store at the 'Overloaded' Variable the text: Overloaded: {66FF00}Yes
// Else it stores the text: Overloaded: {FF0000}No
// strcat: This function concatenates two strings into the destination reference
strcat( msg, "Player Checks: " ); // The first message
strcat( msg, Str_mission ); // then the message we stored at the Str_mission Variable
strcat( msg, Str_maffia ); // then the message we stored at the Str_maffia Variable
strcat( msg, Str_overloaded ); // and then the message we stored at the Str_overloaded Variable
SendClientMessage( playerid, 0xFFFFFFFF, msg );
// Last, we send the message that it's the 'msg' and we cat the messages before and it concatenates them
return 1;
}
// Result: 'Player Checks: On a mission: {Yes/No} Maffia load: {Yes/No} Overloaded: {Yes/No} '