puching all hitsound configuration into one

This commit is contained in:
Steven Howard 2018-10-11 14:35:21 +01:00
parent 598b0c6fda
commit 45dcae630d
3 changed files with 56 additions and 47 deletions

View File

@ -32,6 +32,11 @@ enum E_DAMAGE_FEED
E_WEAPON, E_TICK, E_WEAPON, E_TICK,
}; };
enum E_HITMARKER_SOUND
{
E_NAME[ 10 ], E_SOUND_ID,
};
static stock 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 ],
@ -40,6 +45,12 @@ static stock
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, ... }, PlayerText: p_DamageTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
g_HitmarkerSounds [ ][ E_HITMARKER_SOUND ] =
{
{ "Bell Ding", 17802 }, { "Soft Beep", 5205 }, { "Low Blip", 1138 }, { "Med Blip", 1137 },
{ "High Blip", 1139 }, { "Bling", 5201 }
},
p_damageFeedTimer [ MAX_PLAYERS ] = { -1, ... }, p_damageFeedTimer [ MAX_PLAYERS ] = { -1, ... },
p_DamageTDTimer [ MAX_PLAYERS ] = { -1, ... }, p_DamageTDTimer [ MAX_PLAYERS ] = { -1, ... },
bool: p_FeedActive [ MAX_PLAYERS char ], bool: p_FeedActive [ MAX_PLAYERS char ],
@ -68,6 +79,24 @@ hook OnPlayerConnect( playerid )
return 1; return 1;
} }
hook OnPlayerDisconnect( playerid, reason )
{
p_HitmarkerSound{ playerid } = 0;
return 1;
}
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
if ( dialogid == DIALOG_MODIFY_HITSOUND && response )
{
p_HitmarkerSound{ playerid } = listitem;
SendClientMessageFormatted( playerid, -1, ""COL_GREY"[SERVER]"COL_WHITE" You have changed your hitmarker sound to "COL_GREY"%s"COL_WHITE".", g_HitmarkerSounds[ listitem ] [ E_NAME ] );
ShowSoundsMenu( playerid );
}
return 1;
}
/* ** Functions ** */ /* ** Functions ** */
function OnHitmarkerHide( playerid ) function OnHitmarkerHide( playerid )
return PlayerTextDrawHide( playerid, p_DamageTD[ playerid ] ); return PlayerTextDrawHide( playerid, p_DamageTD[ playerid ] );
@ -428,6 +457,20 @@ stock AddDamageFeedHit( playerid, issuerid, Float: amount, weaponid, type )
} }
} }
stock ShowSoundsMenu( playerid )
{
static
szSounds[ 11 * sizeof( g_HitmarkerSounds ) ];
if ( szSounds[ 0 ] == '\0' )
{
for( new i = 0; i < sizeof( g_HitmarkerSounds ); i++ )
format( szSounds, sizeof( szSounds ), "%s%s\n", szSounds, g_HitmarkerSounds[ i ] [ E_NAME ] );
}
ShowPlayerDialog( playerid, DIALOG_MODIFY_HITSOUND, DIALOG_STYLE_LIST, ""COL_WHITE"Hitmarker Sound", szSounds, "Select", "Close" );
}
/* ** Commands ** */ /* ** Commands ** */
CMD:feed( playerid, params[ ] ) CMD:feed( playerid, params[ ] )
{ {
@ -435,4 +478,13 @@ CMD:feed( playerid, params[ ] )
SendServerMessage( playerid, "You have %s the damage feed.", p_FeedActive{ playerid } ? ( "toggled" ) : ( "un-toggled" ) ); SendServerMessage( playerid, "You have %s the damage feed.", p_FeedActive{ playerid } ? ( "toggled" ) : ( "un-toggled" ) );
return 1; return 1;
} }
CMD:hitmarker( playerid, params[ ] )
{
if ( p_VIPLevel[ playerid ] < 1 )
return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" );
ShowSoundsMenu( playerid );
return 1;
}

View File

@ -234,7 +234,8 @@ 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 },
p_HitmarkerSound [ MAX_PLAYERS char ]
; ;
/* ** Getters And Setters** */ /* ** Getters And Setters** */

View File

@ -365,21 +365,6 @@ stock const
} }
; ;
/* ** Hitmarker ** */
enum E_HITMARKER_SOUND
{
E_NAME[ 10 ], E_SOUND_ID
};
new
g_HitmarkerSounds[ ] [ E_HITMARKER_SOUND ] =
{
{ "Bell Ding", 17802 }, { "Soft Beep", 5205 }, { "Low Blip", 1138 }, { "Med Blip", 1137 },
{ "High Blip", 1139 }, { "Bling", 5201 }
},
p_HitmarkerSound [ MAX_PLAYERS char ]
;
/* ** Race System ** */ /* ** Race System ** */
#define MAX_RACES ( 32 ) #define MAX_RACES ( 32 )
@ -2259,7 +2244,6 @@ public OnPlayerDisconnect( playerid, reason )
p_AddedEmail { playerid } = false; p_AddedEmail { playerid } = false;
p_TicketTimestamp[ playerid ] = 0; p_TicketTimestamp[ playerid ] = 0;
p_ExtraAssetSlots{ playerid } = 0; p_ExtraAssetSlots{ playerid } = 0;
p_HitmarkerSound{ playerid } = 0;
p_CasinoRewardsPoints[ playerid ] = 0.0; p_CasinoRewardsPoints[ playerid ] = 0.0;
p_OwnedBusinesses[ playerid ] = 0; p_OwnedBusinesses[ playerid ] = 0;
p_ExplosiveBullets[ playerid ] = 0; p_ExplosiveBullets[ playerid ] = 0;
@ -2955,7 +2939,7 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b
amount *= 1.5; amount *= 1.5;
} }
CallLocalFunction( "OnPlayerTakenDamage", "ddfdd", playerid, issuerid, amount, weapon, bodypart ); CallLocalFunction( "OnPlayerTakenDamage", "ddfdd", playerid, issuerid, amount, weaponid, bodypart );
return 1; return 1;
} }
#endif #endif
@ -4421,15 +4405,6 @@ thread readplayervipnotes( playerid )
return SendError( playerid, "You do not have any V.I.P notes." ); return SendError( playerid, "You do not have any V.I.P notes." );
} }
CMD:hitmarker( playerid, params[ ] )
{
if ( p_VIPLevel[ playerid ] < 1 )
return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" );
ShowSoundsMenu( playerid );
return 1;
}
CMD:t( playerid, params[ ] ) CMD:t( playerid, params[ ] )
{ {
new new
@ -12430,12 +12405,6 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
} }
} }
} }
if ( dialogid == DIALOG_MODIFY_HITSOUND && response )
{
p_HitmarkerSound{ playerid } = listitem;
SendClientMessageFormatted( playerid, -1, ""COL_GREY"[SERVER]"COL_WHITE" You have changed your hitmarker sound to "COL_GREY"%s"COL_WHITE".", g_HitmarkerSounds[ listitem ] [ E_NAME ] );
ShowSoundsMenu( playerid );
}
if ( dialogid == DIALOG_VIP_NOTE && response ) if ( dialogid == DIALOG_VIP_NOTE && response )
{ {
SendClientMessageToAdmins( -1, ""COL_PINK"[DONOR NEEDS HELP]"COL_GREY" %s(%d) is requesting help with their VIP asset(s). (/viewnotes)", ReturnPlayerName( playerid ), playerid ); SendClientMessageToAdmins( -1, ""COL_PINK"[DONOR NEEDS HELP]"COL_GREY" %s(%d) is requesting help with their VIP asset(s). (/viewnotes)", ReturnPlayerName( playerid ), playerid );
@ -16884,19 +16853,6 @@ thread OnListGangMembers( playerid, gangid, page )
return 1; return 1;
} }
stock ShowSoundsMenu( playerid )
{
static
szSounds[ 11 * sizeof( g_HitmarkerSounds ) ];
if ( szSounds[ 0 ] == '\0' )
{
for( new i = 0; i < sizeof( g_HitmarkerSounds ); i++ )
format( szSounds, sizeof( szSounds ), "%s%s\n", szSounds, g_HitmarkerSounds[ i ] [ E_NAME ] );
}
ShowPlayerDialog( playerid, DIALOG_MODIFY_HITSOUND, DIALOG_STYLE_LIST, ""COL_WHITE"Hitmarker Sound", szSounds, "Select", "Close" );
}
stock GivePlayerLeoWeapons( playerid ) { stock GivePlayerLeoWeapons( playerid ) {
GivePlayerWeapon( playerid, 3, 1 ); GivePlayerWeapon( playerid, 3, 1 );
GivePlayerWeapon( playerid, 22, 250 ); GivePlayerWeapon( playerid, 22, 250 );