adding hitmarker textdraw into damage_feed file.
cleanup variables
This commit is contained in:
parent
a57114f4c1
commit
598b0c6fda
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/* ** Forwards ** */
|
/* ** Forwards ** */
|
||||||
forward OnPlayerFeedUpdate ( playerid );
|
forward OnPlayerFeedUpdate ( playerid );
|
||||||
forward OnPlayerTakenDamageFeed ( playerid, issuerid, Float: amount, weaponid, bodypart );
|
forward OnPlayerTakenDamage ( playerid, issuerid, Float: amount, weaponid, bodypart );
|
||||||
|
|
||||||
/* ** Variables ** */
|
/* ** Variables ** */
|
||||||
enum E_DAMAGE_FEED
|
enum E_DAMAGE_FEED
|
||||||
@ -32,14 +32,16 @@ enum E_DAMAGE_FEED
|
|||||||
E_WEAPON, E_TICK,
|
E_WEAPON, E_TICK,
|
||||||
};
|
};
|
||||||
|
|
||||||
new
|
static stock
|
||||||
g_damageGiven [ MAX_PLAYERS ][ MAX_FEED_HEIGHT ][ E_DAMAGE_FEED ],
|
g_damageGiven [ MAX_PLAYERS ][ MAX_FEED_HEIGHT ][ E_DAMAGE_FEED ],
|
||||||
g_damageTaken [ MAX_PLAYERS ][ MAX_FEED_HEIGHT ][ E_DAMAGE_FEED ],
|
g_damageTaken [ MAX_PLAYERS ][ MAX_FEED_HEIGHT ][ E_DAMAGE_FEED ],
|
||||||
|
|
||||||
PlayerText: g_damageFeedTakenTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: g_damageFeedTakenTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerText: g_damageFeedGivenTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: g_damageFeedGivenTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
|
PlayerText: p_DamageTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
|
|
||||||
p_damageFeedTimer [ MAX_PLAYERS ],
|
p_damageFeedTimer [ MAX_PLAYERS ] = { -1, ... },
|
||||||
|
p_DamageTDTimer [ MAX_PLAYERS ] = { -1, ... },
|
||||||
bool: p_FeedActive [ MAX_PLAYERS char ],
|
bool: p_FeedActive [ MAX_PLAYERS char ],
|
||||||
p_lastFeedUpdate [ MAX_PLAYERS ]
|
p_lastFeedUpdate [ MAX_PLAYERS ]
|
||||||
;
|
;
|
||||||
@ -53,13 +55,62 @@ hook OnPlayerConnect( playerid )
|
|||||||
}
|
}
|
||||||
|
|
||||||
p_lastFeedUpdate[ playerid ] = GetTickCount( );
|
p_lastFeedUpdate[ playerid ] = GetTickCount( );
|
||||||
|
|
||||||
|
/* ** Textdraws ** */
|
||||||
|
p_DamageTD[ playerid ] = CreatePlayerTextDraw(playerid, 357.000000, 208.000000, "~r~~h~300.24 DAMAGE");
|
||||||
|
PlayerTextDrawBackgroundColor(playerid, p_DamageTD[ playerid ], 255);
|
||||||
|
PlayerTextDrawFont(playerid, p_DamageTD[ playerid ], 3);
|
||||||
|
PlayerTextDrawLetterSize(playerid, p_DamageTD[ playerid ], 0.400000, 1.000000);
|
||||||
|
PlayerTextDrawColor(playerid, p_DamageTD[ playerid ], -1);
|
||||||
|
PlayerTextDrawSetOutline(playerid, p_DamageTD[ playerid ], 1);
|
||||||
|
PlayerTextDrawSetProportional(playerid, p_DamageTD[ playerid ], 1);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ** Functions ** */
|
/* ** Functions ** */
|
||||||
public OnPlayerTakenDamageFeed( playerid, issuerid, Float: amount, weaponid, bodypart )
|
function OnHitmarkerHide( playerid )
|
||||||
|
return PlayerTextDrawHide( playerid, p_DamageTD[ playerid ] );
|
||||||
|
|
||||||
|
public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypart )
|
||||||
{
|
{
|
||||||
AddDamageFeedHit( issuerid, playerid, amount, weaponid, TYPE_GIVEN );
|
/* ** Hitmarker ** */
|
||||||
|
if ( IsPlayerSettingToggled( issuerid, SETTING_HITMARKER ) )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
soundid = p_VIPLevel[ issuerid ] ? p_HitmarkerSound{ issuerid } : 0;
|
||||||
|
|
||||||
|
PlayerPlaySound( issuerid, g_HitmarkerSounds[ soundid ] [ E_SOUND_ID ], 0.0, 0.0, 0.0 );
|
||||||
|
|
||||||
|
PlayerTextDrawSetString( issuerid, p_DamageTD[ issuerid ], sprintf( "~r~~h~%0.2f DAMAGE", amount ) );
|
||||||
|
PlayerTextDrawShow( issuerid, p_DamageTD[ issuerid ] );
|
||||||
|
|
||||||
|
KillTimer( p_DamageTDTimer[ issuerid ] );
|
||||||
|
p_DamageTDTimer[ issuerid ] = SetTimerEx( "OnHitmarkerHide", 3000, false, "d", issuerid );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Hitmarker (while spectating) ** */
|
||||||
|
foreach ( new i : Player )
|
||||||
|
{
|
||||||
|
if ( p_Spectating{ i } && p_whomSpectating[ i ] == issuerid )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
soundid = p_VIPLevel[ issuerid ] ? p_HitmarkerSound{ issuerid } : 0;
|
||||||
|
|
||||||
|
PlayerPlaySound( i, g_HitmarkerSounds[ soundid ] [ E_SOUND_ID ], 0.0, 0.0, 0.0 );
|
||||||
|
|
||||||
|
PlayerTextDrawSetString( i, p_DamageTD[ i ], sprintf( "~r~~h~%0.2f DAMAGE", amount ) );
|
||||||
|
PlayerTextDrawShow( i, p_DamageTD[ i ] );
|
||||||
|
|
||||||
|
KillTimer( p_DamageTDTimer[ i ] );
|
||||||
|
p_DamageTDTimer[ i ] = SetTimerEx( "OnHitmarkerHide", 3000, false, "d", i );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Damage Feed ** */
|
||||||
|
if ( issuerid != INVALID_PLAYER_ID ) {
|
||||||
|
AddDamageFeedHit( issuerid, playerid, amount, weaponid, TYPE_GIVEN );
|
||||||
|
}
|
||||||
AddDamageFeedHit( playerid, issuerid, amount, weaponid, TYPE_TAKEN );
|
AddDamageFeedHit( playerid, issuerid, amount, weaponid, TYPE_TAKEN );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,6 @@ new
|
|||||||
p_PmResponder [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
|
p_PmResponder [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
|
||||||
bool: justConnected [ MAX_PLAYERS char ],
|
bool: justConnected [ MAX_PLAYERS char ],
|
||||||
p_BailOfferer [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
|
p_BailOfferer [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
|
||||||
p_DamageTDTimer [ MAX_PLAYERS ] = { -1, ... },
|
|
||||||
Text3D: p_InfoLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID, ... },
|
Text3D: p_InfoLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID, ... },
|
||||||
p_InfoLabelString [ MAX_PLAYERS ] [ 32 ],
|
p_InfoLabelString [ MAX_PLAYERS ] [ 32 ],
|
||||||
bool: p_inMovieMode [ MAX_PLAYERS char ],
|
bool: p_inMovieMode [ MAX_PLAYERS char ],
|
||||||
|
@ -40,7 +40,6 @@ new
|
|||||||
PlayerText: p_PlayerRankTextTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_PlayerRankTextTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerText: p_RobberyAmountTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_RobberyAmountTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerText: p_RobberyRiskTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_RobberyRiskTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerText: p_DamageTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
|
||||||
PlayerText: p_JailTimeTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_JailTimeTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerText: g_ZoneOwnerTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: g_ZoneOwnerTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerText: p_HelpBoxTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_HelpBoxTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
@ -441,14 +440,6 @@ hook OnPlayerConnect( playerid )
|
|||||||
PlayerTextDrawSetOutline(playerid, p_JailTimeTD[ playerid ], 1);
|
PlayerTextDrawSetOutline(playerid, p_JailTimeTD[ playerid ], 1);
|
||||||
PlayerTextDrawSetProportional(playerid, p_JailTimeTD[ playerid ], 1);
|
PlayerTextDrawSetProportional(playerid, p_JailTimeTD[ playerid ], 1);
|
||||||
|
|
||||||
p_DamageTD[ playerid ] = CreatePlayerTextDraw(playerid, 357.000000, 208.000000, "~r~~h~300.24 DAMAGE");
|
|
||||||
PlayerTextDrawBackgroundColor(playerid, p_DamageTD[ playerid ], 255);
|
|
||||||
PlayerTextDrawFont(playerid, p_DamageTD[ playerid ], 3);
|
|
||||||
PlayerTextDrawLetterSize(playerid, p_DamageTD[ playerid ], 0.400000, 1.000000);
|
|
||||||
PlayerTextDrawColor(playerid, p_DamageTD[ playerid ], -1);
|
|
||||||
PlayerTextDrawSetOutline(playerid, p_DamageTD[ playerid ], 1);
|
|
||||||
PlayerTextDrawSetProportional(playerid, p_DamageTD[ playerid ], 1);
|
|
||||||
|
|
||||||
p_LocationTD[ playerid ] = CreatePlayerTextDraw( playerid, 86.000000, 322.000000, "Loading..." );
|
p_LocationTD[ playerid ] = CreatePlayerTextDraw( playerid, 86.000000, 322.000000, "Loading..." );
|
||||||
PlayerTextDrawAlignment( playerid, p_LocationTD[ playerid ], 2 );
|
PlayerTextDrawAlignment( playerid, p_LocationTD[ playerid ], 2 );
|
||||||
PlayerTextDrawBackgroundColor( playerid, p_LocationTD[ playerid ], 255 );
|
PlayerTextDrawBackgroundColor( playerid, p_LocationTD[ playerid ], 255 );
|
||||||
|
@ -2955,45 +2955,11 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b
|
|||||||
amount *= 1.5;
|
amount *= 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hitmarker
|
CallLocalFunction( "OnPlayerTakenDamage", "ddfdd", playerid, issuerid, amount, weapon, bodypart );
|
||||||
if ( IsPlayerSettingToggled( issuerid, SETTING_HITMARKER ) )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
soundid = p_VIPLevel[ issuerid ] ? p_HitmarkerSound{ issuerid } : 0;
|
|
||||||
|
|
||||||
PlayerPlaySound( issuerid, g_HitmarkerSounds[ soundid ] [ E_SOUND_ID ], 0.0, 0.0, 0.0 );
|
|
||||||
|
|
||||||
PlayerTextDrawSetString( issuerid, p_DamageTD[ issuerid ], sprintf( "~r~~h~%0.2f DAMAGE", amount ) );
|
|
||||||
PlayerTextDrawShow( issuerid, p_DamageTD[ issuerid ] );
|
|
||||||
|
|
||||||
KillTimer( p_DamageTDTimer[ issuerid ] );
|
|
||||||
p_DamageTDTimer[ issuerid ] = SetTimerEx( "hidedamagetd_Timer", 3000, false, "d", issuerid );
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ( new i : Player )
|
|
||||||
{
|
|
||||||
if ( p_Spectating{ i } && p_whomSpectating[ i ] == issuerid )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
soundid = p_VIPLevel[ issuerid ] ? p_HitmarkerSound{ issuerid } : 0;
|
|
||||||
|
|
||||||
PlayerPlaySound( i, g_HitmarkerSounds[ soundid ] [ E_SOUND_ID ], 0.0, 0.0, 0.0 );
|
|
||||||
|
|
||||||
PlayerTextDrawSetString( i, p_DamageTD[ i ], sprintf( "~r~~h~%0.2f DAMAGE", amount ) );
|
|
||||||
PlayerTextDrawShow( i, p_DamageTD[ i ] );
|
|
||||||
|
|
||||||
KillTimer( p_DamageTDTimer[ i ] );
|
|
||||||
p_DamageTDTimer[ i ] = SetTimerEx( "hidedamagetd_Timer", 3000, false, "d", i );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
function hidedamagetd_Timer( playerid )
|
|
||||||
return PlayerTextDrawHide( playerid, p_DamageTD[ playerid ] );
|
|
||||||
|
|
||||||
stock BeginEconomyTax( starting = 1 ) {
|
stock BeginEconomyTax( starting = 1 ) {
|
||||||
mysql_function_query( dbHandle, "SELECT USER_CASH, BIZ_CASH, GANG_CASH FROM (SELECT (SUM(BANKMONEY)+SUM(CASH)) USER_CASH FROM USERS) A CROSS JOIN (SELECT SUM(BANK) BIZ_CASH FROM BUSINESSES) B CROSS JOIN (SELECT SUM(BANK) GANG_CASH FROM GANGS) C", true, "OnTaxEconomy", "i", starting );
|
mysql_function_query( dbHandle, "SELECT USER_CASH, BIZ_CASH, GANG_CASH FROM (SELECT (SUM(BANKMONEY)+SUM(CASH)) USER_CASH FROM USERS) A CROSS JOIN (SELECT SUM(BANK) BIZ_CASH FROM BUSINESSES) B CROSS JOIN (SELECT SUM(BANK) GANG_CASH FROM GANGS) C", true, "OnTaxEconomy", "i", starting );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user