should fix the nametag despawning

http://forum.sfcnr.com/showthread.php?60956-nametags-off-doesn-t-keeps-deactivating
This commit is contained in:
Steven Howard 2018-12-02 17:19:39 +00:00
parent 77a152d929
commit bc008c3578
2 changed files with 48 additions and 4 deletions

View File

@ -223,7 +223,8 @@ 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 }
Text3D: p_PassiveModeLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID },
bool: p_NameTags [ MAX_PLAYERS char ] = false
;
/* ** Getters And Setters** */

View File

@ -78,6 +78,7 @@ new bool: False = false;
#define CreateBillboard(%0,%1,%2,%3,%4) SetDynamicObjectMaterialText(CreateDynamicObject(7246,%1,%2,%3,0,0,%4),0,(%0),120,"Arial",24,0,-1,-16777216,1)
#define MAX_BURGLARY_SLOTS 8
#define MAX_WANTED_LVL 2048
#define MAX_TIME_TIED 180
#define MAX_VEH_ATTACHED_OBJECTS 2
@ -197,6 +198,33 @@ new
p_C4Amount [ MAX_PLAYERS ]
;
/* ** Admin Ban Codes ** */
enum E_BAN_CODE
{
E_CODE[ 4 ], E_DATA[ 21 ]
};
new
g_banCodes[ ] [ E_BAN_CODE ] =
{
{ "AH", "Armor Hacking" },
{ "HH", "Health Hacking" },
{ "VHH", "Vehicle Health Hacks" },
{ "NR", "No Reload" },
{ "IA", "Infinite Ammo" },
{ "FH", "Fly Hacks" },
{ "BE", "Ban Evasion" },
{ "AB", "Air Brake" },
{ "TP", "Teleport Hacks" },
{ "WH", "Weapon Hack" },
{ "SH", "Speed Hacks" },
{ "UA", "Unlimited Ammo" },
{ "RF", "Rapid Fire" },
{ "AIM", "Aimbot" },
{ "ADV", "Advertising" }
}
;
/* ** Jail System ** */
#define JAIL_SECONDS_MULTIPLIER ( 3 )
#define ALCATRAZ_REQUIRED_TIME ( 150 )
@ -1473,6 +1501,10 @@ public OnPlayerSpawn( playerid )
CancelEdit( playerid );
HidePlayerHelpDialog( playerid );
// Name Tags
foreach( new pID : Player )
ShowPlayerNameTagForPlayer( playerid, pID, p_NameTags{ playerid } ? 1 : 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 );
@ -2298,7 +2330,7 @@ public OnPlayerDeath( playerid, killerid, reason )
}
}
if ( p_Class[ killerid ] != CLASS_POLICE && ! IsPlayerAdminOnDuty( playerid ) )
if ( p_Class[ killerid ] != CLASS_POLICE )
{
GivePlayerWantedLevel( killerid, 12 );
GivePlayerScore( killerid, 1 );
@ -3596,9 +3628,11 @@ CMD:nametags( playerid, params[ ] )
{
if ( strmatch( params, "off" ) ) {
foreach( new i : Player ) { ShowPlayerNameTagForPlayer( playerid, i, 0 ); }
p_NameTags{ playerid } = false;
SendClientMessage( playerid, 0x84aa63ff, "-> Name tags disabled" );
} else if ( strmatch( params, "on" ) ) {
foreach( new i : Player ) { ShowPlayerNameTagForPlayer( playerid, i, 1 ); }
p_NameTags{ playerid } = true;
SendClientMessage( playerid, 0x84aa63ff, "-> Name tags enabled" );
}
else SendClientMessage( playerid, 0xa9c4e4ff, "-> /nametags [ON/OFF]" );
@ -11296,6 +11330,15 @@ stock KillEveryoneInShamal( vehicleid )
}
}
stock adhereBanCodes( string[ ], maxlength = sizeof( string ) ) {
for( new i; i < sizeof( g_banCodes ); i++ ) {
if ( strfind( string, g_banCodes[ i ] [ E_CODE ], false ) != -1 ) {
strreplace( string, g_banCodes[ i ] [ E_CODE ], g_banCodes[ i ] [ E_DATA ], false, 0, -1, maxlength );
}
}
return 1;
}
stock CreateExplosionEx( Float: X, Float: Y, Float: Z, type, Float: radius, world, interior, issuerid = INVALID_PLAYER_ID )
{
foreach(new i : Player) {