diff --git a/gamemodes/irresistible/cnr/commands/_commands.pwn b/gamemodes/irresistible/cnr/commands/_commands.pwn index afa3562..c380983 100644 --- a/gamemodes/irresistible/cnr/commands/_commands.pwn +++ b/gamemodes/irresistible/cnr/commands/_commands.pwn @@ -11,4 +11,5 @@ /* ** Files ** */ #include "irresistible\cnr\commands\cmd_changes.pwn" #include "irresistible\cnr\commands\cmd_twitter.pwn" -#include "irresistible\cnr\commands\cmd_highscores.pwn" \ No newline at end of file +#include "irresistible\cnr\commands\cmd_highscores.pwn" +#include "irresistible\cnr\commands\cmd_nametags.pwn" \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/commands/cmd_nametags.pwn b/gamemodes/irresistible/cnr/commands/cmd_nametags.pwn new file mode 100644 index 0000000..7cfeeca --- /dev/null +++ b/gamemodes/irresistible/cnr/commands/cmd_nametags.pwn @@ -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; +} \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/player.pwn b/gamemodes/irresistible/cnr/player.pwn index dbc6805..9be818d 100644 --- a/gamemodes/irresistible/cnr/player.pwn +++ b/gamemodes/irresistible/cnr/player.pwn @@ -216,8 +216,7 @@ new p_AimedAtPolice [ MAX_PLAYERS ], bool: p_PassiveModeDisabled [ MAX_PLAYERS char ], //p_PassiveModeExpireTimer [ MAX_PLAYERS ] = { -1, ... }, - Text3D: p_PassiveModeLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID }, - bool: p_HiddenNameTags [ MAX_PLAYERS char ] + Text3D: p_PassiveModeLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID } ; /* ** Getters And Setters** */ diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 86b9817..33ae648 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -922,7 +922,6 @@ public OnPlayerDisconnect( playerid, reason ) p_SpawningIndex[ playerid ] = 0; p_IncorrectLogins{ playerid } = 0; p_VehicleBringCooldown[ playerid ] = 0; - p_HiddenNameTags{ playerid } = false; p_AntiTextSpamCount{ playerid } = 0; Delete3DTextLabel( p_AdminLabel[ playerid ] ); p_AdminLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID; @@ -1016,11 +1015,6 @@ public OnPlayerSpawn( playerid ) CancelEdit( playerid ); HidePlayerHelpDialog( playerid ); - // Hide name tags if enabled option - foreach( new pID : Player ) if ( p_HiddenNameTags{ pID } ) { - ShowPlayerNameTagForPlayer( pID, playerid, 0 ); - } - // 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 ); 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; } -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[ ] ) { if ( GetPlayerScore( playerid ) < 500 && !IsPlayerUnderCover( playerid ) && p_AdminLevel[ playerid ] < 1 )