adds /passivelist

adds a textdraw quite like "admon on duty" and it's "Passive Mode"
This commit is contained in:
Steven Howard 2018-09-25 16:17:34 +01:00
parent 05e994fe46
commit 1ebbadeeb8
3 changed files with 36 additions and 1 deletions

View File

@ -160,6 +160,28 @@ CMD:passive( playerid, params[ ] )
return 1; return 1;
} }
CMD:passivelist( playerid, params[ ])
{
new
count = 0;
szBigString[ 0 ] = '\0';
foreach ( new i : Player )
{
if ( IsPlayerPassive( i ) )
{
format( szBigString, sizeof( szBigString ), "%s%s(%d)\n", szBigString, ReturnPlayerName( i ), i );
count ++;
}
}
if ( count == 0 )
return SendError( playerid, "There is currently no players in passive mode." );
else
return ShowPlayerDialog(playerid, DIALOG_NULL, DIALOG_STYLE_LIST, ""COL_WHITE"Passive List", szBigString, "Close", "" ), 1;
}
/* ** Functions ** */ /* ** Functions ** */
stock IsPlayerSettingToggled( playerid, settingid ) { stock IsPlayerSettingToggled( playerid, settingid ) {
return p_PlayerSettings[ playerid ] { settingid }; return p_PlayerSettings[ playerid ] { settingid };

View File

@ -25,6 +25,7 @@ new
Text: g_AdminLogTD = Text: INVALID_TEXT_DRAW, Text: g_AdminLogTD = Text: INVALID_TEXT_DRAW,
Text: g_ProgressBoxTD = Text: INVALID_TEXT_DRAW, Text: g_ProgressBoxTD = Text: INVALID_TEXT_DRAW,
Text: g_AdminOnDutyTD = Text: INVALID_TEXT_DRAW, Text: g_AdminOnDutyTD = Text: INVALID_TEXT_DRAW,
Text: g_PassiveModeTD = Text: INVALID_TEXT_DRAW,
Text: g_VehiclePreviewBoxTD = Text: INVALID_TEXT_DRAW, Text: g_VehiclePreviewBoxTD = Text: INVALID_TEXT_DRAW,
Text: g_VehiclePreviewTxtTD = Text: INVALID_TEXT_DRAW, Text: g_VehiclePreviewTxtTD = Text: INVALID_TEXT_DRAW,
Text: p_VehiclePreviewCloseTD = Text: INVALID_TEXT_DRAW, Text: p_VehiclePreviewCloseTD = Text: INVALID_TEXT_DRAW,
@ -423,6 +424,14 @@ hook OnScriptInit( )
TextDrawSetOutline(g_AdminOnDutyTD, 1); TextDrawSetOutline(g_AdminOnDutyTD, 1);
TextDrawSetProportional(g_AdminOnDutyTD, 1); TextDrawSetProportional(g_AdminOnDutyTD, 1);
g_PassiveModeTD = TextDrawCreate(555.000000, 66.500000, "PASSIVE MODE" );
TextDrawBackgroundColor(g_PassiveModeTD, 255);
TextDrawFont(g_PassiveModeTD, 1);
TextDrawLetterSize(g_PassiveModeTD, 0.180000, 0.899999);
TextDrawColor(g_PassiveModeTD, -65281);
TextDrawSetOutline(g_PassiveModeTD, 1);
TextDrawSetProportional(g_PassiveModeTD, 1);
/* ** Player TextDraws ** */ /* ** Player TextDraws ** */
for(new playerid; playerid != MAX_PLAYERS; playerid ++) for(new playerid; playerid != MAX_PLAYERS; playerid ++)
{ {

View File

@ -9389,7 +9389,7 @@ CMD:pm( playerid, params[ ] )
pID, msg[100] pID, msg[100]
; ;
if ( sscanf( params, "us[100]", pID, msg ) ) return SendUsage( playerid, "/pm [PLAYER_ID] [MESSAGE]" ); if ( sscanf( params, "us[128]", pID, msg ) ) return SendUsage( playerid, "/pm [PLAYER_ID] [MESSAGE]" );
else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." );
else if ( pID == playerid ) return SendError( playerid, "You cannot pm yourself." ); else if ( pID == playerid ) return SendError( playerid, "You cannot pm yourself." );
else if ( p_BlockedPM[ pID ] [ playerid ] == true ) return SendError( playerid, "This person has blocked pm's coming from you." ); else if ( p_BlockedPM[ pID ] [ playerid ] == true ) return SendError( playerid, "This person has blocked pm's coming from you." );
@ -25703,6 +25703,7 @@ stock SetPlayerPassiveMode( playerid )
// place label // place label
if ( ! IsPlayerInPaintBall( playerid ) && GetPlayerClass( playerid ) != CLASS_POLICE ) { if ( ! IsPlayerInPaintBall( playerid ) && GetPlayerClass( playerid ) != CLASS_POLICE ) {
p_PassiveModeLabel[ playerid ] = CreateDynamic3DTextLabel( "Passive Mode", COLOR_GREEN, 0.0, 0.0, -0.6, 15.0, .attachedplayer = playerid ); p_PassiveModeLabel[ playerid ] = CreateDynamic3DTextLabel( "Passive Mode", COLOR_GREEN, 0.0, 0.0, -0.6, 15.0, .attachedplayer = playerid );
TextDrawShowForPlayer( playerid, g_PassiveModeTD );
} }
return 1; return 1;
} }
@ -25719,12 +25720,15 @@ stock ResetPlayerPassiveMode( playerid, bool: passive_disabled = false )
p_PassiveModeLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID; p_PassiveModeLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID;
p_PassiveModeExpireTimer[ playerid ] = -1; p_PassiveModeExpireTimer[ playerid ] = -1;
p_PassiveModeDisabled{ playerid } = passive_disabled; p_PassiveModeDisabled{ playerid } = passive_disabled;
TextDrawHideForPlayer( playerid, g_PassiveModeTD );
} }
function PassiveMode_Reset( playerid, time_left ) function PassiveMode_Reset( playerid, time_left )
{ {
if ( p_WantedLevel[ playerid ] > 0 || p_Class[ playerid ] != CLASS_CIVILIAN || -- time_left <= 0 ) if ( p_WantedLevel[ playerid ] > 0 || p_Class[ playerid ] != CLASS_CIVILIAN || -- time_left <= 0 )
{ {
TextDrawHideForPlayer( playerid, g_PassiveModeTD );
ResetPlayerPassiveMode( playerid, .passive_disabled = true ); ResetPlayerPassiveMode( playerid, .passive_disabled = true );
ShowPlayerHelpDialog( playerid, 2000, "Passive mode is ~r~disabled." ); ShowPlayerHelpDialog( playerid, 2000, "Passive mode is ~r~disabled." );
} }