move /nametags into own module

This commit is contained in:
Lorenc Pekaj 2019-01-01 18:02:25 +11:00
parent 9aada6d568
commit 2610dd9c19
4 changed files with 45 additions and 24 deletions

View File

@ -11,4 +11,5 @@
/* ** Files ** */ /* ** Files ** */
#include "irresistible\cnr\commands\cmd_changes.pwn" #include "irresistible\cnr\commands\cmd_changes.pwn"
#include "irresistible\cnr\commands\cmd_twitter.pwn" #include "irresistible\cnr\commands\cmd_twitter.pwn"
#include "irresistible\cnr\commands\cmd_highscores.pwn" #include "irresistible\cnr\commands\cmd_highscores.pwn"
#include "irresistible\cnr\commands\cmd_nametags.pwn"

View File

@ -0,0 +1,42 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc
* Module: cnr\commands\cmd_nametags.pwn
* Purpose: command that hides player name tags
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Variables ** */,
static stock bool: p_HiddenNameTags [ MAX_PLAYERS char ];
/* ** Commands ** */
CMD:nametags( playerid, params[ ] )
{
if ( strmatch( params, "off" ) ) {
foreach( new i : Player ) { ShowPlayerNameTagForPlayer( playerid, i, 0 ); }
p_HiddenNameTags{ playerid } = true;
SendClientMessage( playerid, 0x84aa63ff, "-> Name tags disabled" );
} else if ( strmatch( params, "on" ) ) {
foreach( new i : Player ) { ShowPlayerNameTagForPlayer( playerid, i, 1 ); }
p_HiddenNameTags{ playerid } = false;
SendClientMessage( playerid, 0x84aa63ff, "-> Name tags enabled" );
}
else SendClientMessage( playerid, 0xa9c4e4ff, "-> /nametags [ON/OFF]" );
return 1;
}
/* ** Hooks ** */
hook OnPlayerDisconnect( playerid, reason ) {
p_HiddenNameTags{ playerid } = false;
return 1;
}
hook OnPlayerSpawn( playerid ) {
// Hide name tags if enabled option
foreach( new pID : Player ) if ( p_HiddenNameTags{ pID } ) {
ShowPlayerNameTagForPlayer( pID, playerid, 0 );
}
return 1;
}

View File

@ -216,8 +216,7 @@ new
p_AimedAtPolice [ MAX_PLAYERS ], p_AimedAtPolice [ MAX_PLAYERS ],
bool: p_PassiveModeDisabled [ MAX_PLAYERS char ], bool: p_PassiveModeDisabled [ MAX_PLAYERS char ],
//p_PassiveModeExpireTimer [ MAX_PLAYERS ] = { -1, ... }, //p_PassiveModeExpireTimer [ MAX_PLAYERS ] = { -1, ... },
Text3D: p_PassiveModeLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID }, Text3D: p_PassiveModeLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID }
bool: p_HiddenNameTags [ MAX_PLAYERS char ]
; ;
/* ** Getters And Setters** */ /* ** Getters And Setters** */

View File

@ -922,7 +922,6 @@ public OnPlayerDisconnect( playerid, reason )
p_SpawningIndex[ playerid ] = 0; p_SpawningIndex[ playerid ] = 0;
p_IncorrectLogins{ playerid } = 0; p_IncorrectLogins{ playerid } = 0;
p_VehicleBringCooldown[ playerid ] = 0; p_VehicleBringCooldown[ playerid ] = 0;
p_HiddenNameTags{ playerid } = false;
p_AntiTextSpamCount{ playerid } = 0; p_AntiTextSpamCount{ playerid } = 0;
Delete3DTextLabel( p_AdminLabel[ playerid ] ); Delete3DTextLabel( p_AdminLabel[ playerid ] );
p_AdminLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID; p_AdminLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID;
@ -1016,11 +1015,6 @@ public OnPlayerSpawn( playerid )
CancelEdit( playerid ); CancelEdit( playerid );
HidePlayerHelpDialog( playerid ); HidePlayerHelpDialog( playerid );
// Hide name tags if enabled option
foreach( new pID : Player ) if ( p_HiddenNameTags{ pID } ) {
ShowPlayerNameTagForPlayer( pID, playerid, 0 );
}
// Money Bags // Money Bags
if ( p_MoneyBag{ playerid } && p_Class[ playerid ] != CLASS_POLICE ) // SetPlayerAttachedObject( playerid, 1, 1550, 1, 0.131999, -0.140999, 0.053999, 11.299997, 65.599906, 173.900054, 0.652000, 0.573000, 0.594000 ); if ( p_MoneyBag{ playerid } && p_Class[ playerid ] != CLASS_POLICE ) // SetPlayerAttachedObject( playerid, 1, 1550, 1, 0.131999, -0.140999, 0.053999, 11.299997, 65.599906, 173.900054, 0.652000, 0.573000, 0.594000 );
RemovePlayerAttachedObject( playerid, 1 ), SetPlayerAttachedObject( playerid, 1, 1210, 7, 0.302650, -0.002469, -0.193321, 296.124053, 270.396881, 8.941717, 1.000000, 1.000000, 1.000000 ); RemovePlayerAttachedObject( playerid, 1 ), SetPlayerAttachedObject( playerid, 1, 1210, 7, 0.302650, -0.002469, -0.193321, 296.124053, 270.396881, 8.941717, 1.000000, 1.000000, 1.000000 );
@ -2652,21 +2646,6 @@ CMD:whisper( playerid, params[ ] )
return 1; return 1;
} }
CMD:nametags( playerid, params[ ] )
{
if ( strmatch( params, "off" ) ) {
foreach( new i : Player ) { ShowPlayerNameTagForPlayer( playerid, i, 0 ); }
p_HiddenNameTags{ playerid } = true;
SendClientMessage( playerid, 0x84aa63ff, "-> Name tags disabled" );
} else if ( strmatch( params, "on" ) ) {
foreach( new i : Player ) { ShowPlayerNameTagForPlayer( playerid, i, 1 ); }
p_HiddenNameTags{ playerid } = false;
SendClientMessage( playerid, 0x84aa63ff, "-> Name tags enabled" );
}
else SendClientMessage( playerid, 0xa9c4e4ff, "-> /nametags [ON/OFF]" );
return 1;
}
CMD:admins( playerid, params[ ] ) CMD:admins( playerid, params[ ] )
{ {
if ( GetPlayerScore( playerid ) < 500 && !IsPlayerUnderCover( playerid ) && p_AdminLevel[ playerid ] < 1 ) if ( GetPlayerScore( playerid ) < 500 && !IsPlayerUnderCover( playerid ) && p_AdminLevel[ playerid ] < 1 )