Merge branch 'moneygrub' of ssh://bitbucket.org/lorenc/cnr into moneygrub
This commit is contained in:
commit
02974924f4
@ -156,6 +156,7 @@ static stock
|
||||
{ 5, "/destroybusiness", "Deletes a business" },
|
||||
{ 5, "/seteventhost", "Setting event host to player" },
|
||||
{ 5, "/weather", "Settings world weather" },
|
||||
{ 5, "/viewpolicechat", "Viewing the police radio/chat" },
|
||||
|
||||
/* ** Level 6 Commands ** */
|
||||
{ 6, "/reloadeditor", "Reloads object editer script" },
|
||||
|
@ -20,6 +20,18 @@ CMD:armorall( playerid, params[ ] )
|
||||
return 1;
|
||||
}
|
||||
|
||||
CMD:viewpolicechat( playerid, params[ ] )
|
||||
{
|
||||
if ( p_AdminLevel[ playerid ] < 5 && !IsPlayerUnderCover( playerid ) ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||
p_ToggleCopChat{ playerid } = !p_ToggleCopChat{ playerid };
|
||||
|
||||
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" You have %s viewing police.", p_ToggleCopChat{ playerid } == true ? ("toggled") : ("un-toggled") );
|
||||
if ( !IsPlayerUnderCover( playerid ) ) {
|
||||
AddAdminLogLineFormatted( "%s(%d) has %s viewing police chat", ReturnPlayerName( playerid ), playerid, p_ToggleCopChat{ playerid } == true ? ("toggled") : ("un-toggled") );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
CMD:check( playerid, params[ ] )
|
||||
{
|
||||
new
|
||||
|
@ -38,7 +38,8 @@
|
||||
#include "irresistible\cnr\features\crime_reports.pwn"
|
||||
#include "irresistible\cnr\features\fires.pwn"
|
||||
#include "irresistible\cnr\features\car_jacker.pwn"
|
||||
|
||||
#include "irresistible\cnr\features\damage_feed.pwn"
|
||||
|
||||
// disabled
|
||||
// #include "irresistible\cnr\features\eastereggs.pwn"
|
||||
|
||||
|
531
gamemodes/irresistible/cnr/features/damage_feed.pwn
Normal file
531
gamemodes/irresistible/cnr/features/damage_feed.pwn
Normal file
@ -0,0 +1,531 @@
|
||||
/*
|
||||
* Irresistible Gaming (c) 2018
|
||||
* Developed by Steven Howard, Oscar "Slice" Broman
|
||||
* Module: cnr/features/damage_feed.pwn
|
||||
* Purpose: damage feed for dmers
|
||||
*/
|
||||
|
||||
/* ** Includes ** */
|
||||
#include < YSI\y_hooks >
|
||||
|
||||
/* ** Macros ** */
|
||||
#define IsDamageFeedActive(%0) ( IsPlayerSettingToggled( %0, SETTING_HITMARKER ) )
|
||||
|
||||
/* ** Definitions ** */
|
||||
#define MAX_FEED_HEIGHT ( 5 )
|
||||
#define HIDE_FEED_DELAY ( 3000 )
|
||||
#define MAX_UPDATE_RATE ( 250 )
|
||||
|
||||
#define TEXTDRAW_ADDON ( 100.0 )
|
||||
|
||||
/* ** Forwards ** */
|
||||
forward OnPlayerFeedUpdate ( playerid );
|
||||
forward OnPlayerTakenDamage ( playerid, issuerid, Float: amount, weaponid, bodypart );
|
||||
|
||||
/* ** Variables ** */
|
||||
enum E_DAMAGE_FEED
|
||||
{
|
||||
E_ISSUER, E_NAME[ MAX_PLAYER_NAME ], Float: E_AMOUNT,
|
||||
E_WEAPON, E_TICK
|
||||
};
|
||||
|
||||
enum E_HITMARKER_SOUND
|
||||
{
|
||||
E_NAME[ 10 ], E_SOUND_ID
|
||||
};
|
||||
|
||||
new
|
||||
p_HitmarkerSound [ MAX_PLAYERS char ]
|
||||
;
|
||||
|
||||
static stock
|
||||
g_damageGiven [ MAX_PLAYERS ] [ MAX_FEED_HEIGHT ] [ E_DAMAGE_FEED ],
|
||||
g_damageTaken [ MAX_PLAYERS ] [ MAX_FEED_HEIGHT ] [ E_DAMAGE_FEED ],
|
||||
|
||||
//Text3D: g_BulletLabel [ MAX_PLAYERS ],
|
||||
//g_BulletTimer [ MAX_PLAYERS ],
|
||||
|
||||
bool: p_GotHit [ MAX_PLAYERS char ],
|
||||
//bool: p_SyncingPlayer [ MAX_PLAYERS char ],
|
||||
p_DamageObject [ MAX_PLAYERS ] = { -1, ... },
|
||||
|
||||
PlayerText: g_damageFeedTakenTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||
PlayerText: g_damageFeedGivenTD [ 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_lastFeedUpdate [ MAX_PLAYERS ]
|
||||
;
|
||||
|
||||
/* ** Hooks ** */
|
||||
hook OnPlayerConnect( playerid )
|
||||
{
|
||||
for( new x = 0; x < sizeof( g_damageGiven[ ] ); x ++) {
|
||||
g_damageGiven[ playerid ] [ x ] [ E_TICK ] = 0;
|
||||
g_damageTaken[ playerid ] [ x ] [ E_TICK ] = 0;
|
||||
}
|
||||
|
||||
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);*/
|
||||
|
||||
/* ** Textdraws ** */
|
||||
g_damageFeedGivenTD[ playerid ] = CreatePlayerTextDraw( playerid, ( 320.0 - TEXTDRAW_ADDON ), 340.0, "_");
|
||||
PlayerTextDrawBackgroundColor(playerid, g_damageFeedGivenTD[ playerid ], 117 );
|
||||
PlayerTextDrawAlignment( playerid, g_damageFeedGivenTD[ playerid ], 2 );
|
||||
PlayerTextDrawFont( playerid, g_damageFeedGivenTD[ playerid ], 1 );
|
||||
PlayerTextDrawLetterSize( playerid, g_damageFeedGivenTD[ playerid ], 0.200000, 0.899999 );
|
||||
PlayerTextDrawColor( playerid, g_damageFeedGivenTD[ playerid ], 0xDD2020FF );
|
||||
PlayerTextDrawSetOutline( playerid, g_damageFeedGivenTD[ playerid ], 1 );
|
||||
PlayerTextDrawSetProportional( playerid, g_damageFeedGivenTD[ playerid ], 1 );
|
||||
PlayerTextDrawSetSelectable( playerid, g_damageFeedGivenTD[ playerid ], 0 );
|
||||
|
||||
g_damageFeedTakenTD[ playerid ] = CreatePlayerTextDraw( playerid, ( TEXTDRAW_ADDON + 320.0 ), 340.0, "_");
|
||||
PlayerTextDrawBackgroundColor(playerid, g_damageFeedTakenTD[ playerid ], 117 );
|
||||
PlayerTextDrawAlignment( playerid, g_damageFeedTakenTD[ playerid ], 2 );
|
||||
PlayerTextDrawFont( playerid, g_damageFeedTakenTD[ playerid ], 1 );
|
||||
PlayerTextDrawLetterSize( playerid, g_damageFeedTakenTD[ playerid ], 0.200000, 0.899999 );
|
||||
PlayerTextDrawColor( playerid, g_damageFeedTakenTD[ playerid ], 1069804543 );
|
||||
PlayerTextDrawSetOutline( playerid, g_damageFeedTakenTD[ playerid ], 1 );
|
||||
PlayerTextDrawSetProportional( playerid, g_damageFeedTakenTD[ playerid ], 1 );
|
||||
PlayerTextDrawSetSelectable( playerid, g_damageFeedTakenTD[ playerid ], 0 );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
hook OnPlayerDisconnect( playerid, reason )
|
||||
{
|
||||
p_HitmarkerSound{ playerid } = 0;
|
||||
//p_SyncingPlayer{ playerid } = false;
|
||||
|
||||
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 ] );
|
||||
|
||||
PlayerPlaySound( playerid, g_HitmarkerSounds[ listitem ] [ E_SOUND_ID ], 0.0, 0.0, 0.0 );
|
||||
ShowSoundsMenu( playerid );
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ** Functions ** */
|
||||
function DamageFeed_HideBulletLabel( labelid )
|
||||
{
|
||||
DestroyDynamic3DTextLabel( Text3D: labelid );
|
||||
return 1;
|
||||
}
|
||||
|
||||
public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypart )
|
||||
{
|
||||
/* ** Label Damage Indicator ** */
|
||||
if ( issuerid != INVALID_PLAYER_ID )
|
||||
{
|
||||
static Float: fromX, Float: fromY, Float: fromZ;
|
||||
static Float: toX, Float: toY, Float: toZ;
|
||||
|
||||
GetPlayerLastShotVectors( issuerid, fromX, fromY, fromZ, toX, toY, toZ );
|
||||
|
||||
new
|
||||
Text3D: bullet_label = CreateDynamic3DTextLabel( sprintf( "%.0f", amount ), 0xFFFFFF80, toX, toY, toZ, 100.0, .interiorid = GetPlayerInterior( playerid ), .worldid = GetPlayerVirtualWorld( playerid ), .testlos = 1 );
|
||||
|
||||
if ( IsValidDynamic3DTextLabel( bullet_label ) )
|
||||
{
|
||||
Streamer_Update( issuerid, STREAMER_TYPE_3D_TEXT_LABEL );
|
||||
Streamer_Update( playerid, STREAMER_TYPE_3D_TEXT_LABEL );
|
||||
SetTimerEx( "DamageFeed_HideBulletLabel", 1250, false, "d", _: bullet_label );
|
||||
}
|
||||
|
||||
/* ** Armour and Health Object Damage ** */
|
||||
|
||||
if ( ! p_GotHit{ playerid } )
|
||||
{
|
||||
static
|
||||
Float: armour;
|
||||
|
||||
if ( GetPlayerArmour( playerid, armour ) )
|
||||
{
|
||||
DestroyObject( p_DamageObject[ playerid ] );
|
||||
|
||||
p_DamageObject[ playerid ] = CreateObject( armour - amount <= 0.0 ? ( 1240 ) : ( 1242 ), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 100.0 );
|
||||
AttachObjectToPlayer( p_DamageObject[ playerid ], playerid, 0.0, 0.0, 1.5, 0.0, 0.0, 0.0 );
|
||||
|
||||
//SetPlayerAttachedObject( playerid, 4, armour - amount <= 0.0 ? ( 1240 ) : ( 1242 ), 1, 1.400000, -0.004999, 0.034999, 4.499999, 83.500030, -3.799998, 1.000000, 1.000000, 1.026999 );
|
||||
SetTimerEx( "HideDamageObject", 1000, false, "d", playerid );
|
||||
|
||||
//Streamer_Update( playerid, STREAMER_TYPE_OBJECT );
|
||||
p_GotHit{ playerid } = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* ** Hitmarker ** */
|
||||
DamageFeedAddHitGiven( issuerid, playerid, amount, weaponid );
|
||||
|
||||
// play noise
|
||||
if ( IsDamageFeedActive( issuerid ) )
|
||||
{
|
||||
new
|
||||
soundid = p_VIPLevel[ issuerid ] ? p_HitmarkerSound{ issuerid } : 0;
|
||||
|
||||
PlayerPlaySound( issuerid, g_HitmarkerSounds[ soundid ] [ E_SOUND_ID ], 0.0, 0.0, 0.0 );
|
||||
}
|
||||
}
|
||||
|
||||
DamageFeedAddHitTaken( playerid, issuerid, amount, weaponid );
|
||||
return 1;
|
||||
}
|
||||
|
||||
function HideDamageObject( playerid )
|
||||
{
|
||||
if( IsValidObject( p_DamageObject[ playerid ] ) ) {
|
||||
DestroyObject( p_DamageObject[ playerid ] );
|
||||
p_DamageObject[ playerid ] = -1;
|
||||
}
|
||||
|
||||
p_GotHit{ playerid } = false;
|
||||
return 1;
|
||||
}
|
||||
|
||||
public OnPlayerFeedUpdate( playerid )
|
||||
{
|
||||
p_damageFeedTimer[ playerid ] = -1;
|
||||
|
||||
if ( IsPlayerConnected( playerid ) && IsDamageFeedActive( playerid ) ) {
|
||||
UpdateDamageFeed( playerid, true );
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock DamageFeedAddHitGiven( playerid, issuerid, Float: amount, weaponid )
|
||||
{
|
||||
foreach( new i : Player ) if ( p_Spectating{ i } && p_whomSpectating[ i ] == playerid && i != playerid ) {
|
||||
AddDamageHit( g_damageGiven[ i ], i, issuerid, amount, weaponid );
|
||||
}
|
||||
|
||||
AddDamageHit( g_damageGiven[ playerid ], playerid, issuerid, amount, weaponid );
|
||||
}
|
||||
|
||||
stock DamageFeedAddHitTaken( playerid, issuerid, Float: amount, weaponid )
|
||||
{
|
||||
foreach( new i : Player ) if ( p_Spectating{ i } && p_whomSpectating[ i ] == playerid && i != playerid ) {
|
||||
AddDamageHit( g_damageTaken[ i ], i, issuerid, amount, weaponid );
|
||||
}
|
||||
|
||||
AddDamageHit( g_damageTaken[ playerid ], playerid, issuerid, amount, weaponid );
|
||||
}
|
||||
|
||||
stock UpdateDamageFeed( playerid, bool: modified = false )
|
||||
{
|
||||
/* ** Core ** */
|
||||
new szTick = GetTickCount( );
|
||||
if ( szTick == 0 ) szTick = 1;
|
||||
new lowest_tick = szTick + 1;
|
||||
|
||||
for( new givenid = 0; givenid < sizeof( g_damageGiven[ ] ) - 1; givenid ++)
|
||||
{
|
||||
if ( !g_damageGiven[ playerid ] [ givenid ] [ E_TICK ] ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( szTick - g_damageGiven[ playerid ] [ givenid ] [ E_TICK ] >= HIDE_FEED_DELAY )
|
||||
{
|
||||
modified = true;
|
||||
|
||||
for( new j = givenid; j < sizeof( g_damageGiven[ ] ) - 1; j++ ) {
|
||||
g_damageGiven[ playerid ] [ j ] [ E_TICK ] = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ( g_damageGiven[ playerid ] [ givenid ] [ E_TICK ] < lowest_tick ) {
|
||||
lowest_tick = g_damageGiven[ playerid ] [ givenid ] [ E_TICK ];
|
||||
}
|
||||
}
|
||||
|
||||
for( new takenid = 0; takenid < sizeof( g_damageTaken[ ] ) - 1; takenid ++)
|
||||
{
|
||||
if ( !g_damageTaken[ playerid ] [ takenid ] [ E_TICK ] ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( szTick - g_damageTaken[ playerid ] [ takenid ] [ E_TICK ] >= HIDE_FEED_DELAY )
|
||||
{
|
||||
modified = true;
|
||||
|
||||
for( new j = takenid; j < sizeof( g_damageTaken[ ] ) - 1; j++ ) {
|
||||
g_damageTaken[ playerid ] [ j ] [ E_TICK ] = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ( g_damageTaken[ playerid ] [ takenid ] [ E_TICK ] < lowest_tick ) {
|
||||
lowest_tick = g_damageTaken[ playerid ] [ takenid ] [ E_TICK ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( p_damageFeedTimer[ playerid ] != -1 ) {
|
||||
KillTimer( p_damageFeedTimer[ playerid ] );
|
||||
}
|
||||
|
||||
if ( ( szTick - p_lastFeedUpdate[ playerid ] ) < MAX_UPDATE_RATE && modified )
|
||||
{
|
||||
p_damageFeedTimer[ playerid ] = SetTimerEx( "OnPlayerFeedUpdate", MAX_UPDATE_RATE - ( szTick - p_lastFeedUpdate[ playerid ] ) + 10, false, "d", playerid );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( lowest_tick == ( szTick + 1 ) )
|
||||
{
|
||||
p_damageFeedTimer[playerid] = -1;
|
||||
modified = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_damageFeedTimer[playerid] = SetTimerEx( "OnPlayerFeedUpdate", HIDE_FEED_DELAY - ( szTick - lowest_tick ) + 10, false, "i", playerid );
|
||||
}
|
||||
|
||||
if (modified)
|
||||
{
|
||||
UpdateDamageFeedLabel( playerid );
|
||||
|
||||
p_lastFeedUpdate[ playerid ] = szTick;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock UpdateDamageFeedLabel( playerid )
|
||||
{
|
||||
new
|
||||
szLabel[ 64 * MAX_FEED_HEIGHT ] = "";
|
||||
|
||||
for( new givenid = 0; givenid < sizeof( g_damageGiven[ ] ) - 1; givenid ++)
|
||||
{
|
||||
if ( !g_damageGiven[ playerid ] [ givenid ] [ E_TICK ] )
|
||||
break;
|
||||
|
||||
new szWeapon[ 32 ];
|
||||
|
||||
if ( g_damageGiven[ playerid ] [ givenid ] [ E_WEAPON ] == -1 ) {
|
||||
szWeapon = "Multiple";
|
||||
}
|
||||
else {
|
||||
GetWeaponName( g_damageGiven[ playerid ] [ givenid ] [ E_WEAPON ], szWeapon, sizeof( szWeapon ) );
|
||||
}
|
||||
|
||||
if ( g_damageGiven[ playerid ] [ givenid ] [ E_ISSUER ] == INVALID_PLAYER_ID )
|
||||
{
|
||||
format( szLabel, sizeof( szLabel ), "%s%s +%.2f~n~", szLabel, szWeapon, g_damageGiven[ playerid ] [ givenid ] [ E_AMOUNT ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
format( szLabel, sizeof( szLabel ), "%s%s - %s +%.2f~n~", szLabel, szWeapon, g_damageGiven[ playerid ] [ givenid ] [ E_NAME ], g_damageGiven[ playerid ] [ givenid ] [ E_AMOUNT ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( g_damageFeedGivenTD[ playerid ] == PlayerText: INVALID_TEXT_DRAW ) {
|
||||
print( "[DAMAGE FEED ERROR] Doesn't have feed textdraw when needed ( g_damageFeedGivenTD )" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( szLabel[ 0 ] )
|
||||
{
|
||||
PlayerTextDrawSetString( playerid, g_damageFeedGivenTD[ playerid ], szLabel );
|
||||
PlayerTextDrawShow( playerid, g_damageFeedGivenTD[ playerid ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerTextDrawHide( playerid, g_damageFeedGivenTD[ playerid ] );
|
||||
}
|
||||
}
|
||||
|
||||
szLabel = "";
|
||||
|
||||
for( new takenid = 0; takenid < sizeof( g_damageTaken[ ] ) - 1; takenid ++)
|
||||
{
|
||||
if ( !g_damageTaken[ playerid ] [ takenid ] [ E_TICK ] )
|
||||
break;
|
||||
|
||||
new szWeapon[ 32 ];
|
||||
|
||||
if ( g_damageTaken[ playerid ] [ takenid ] [ E_WEAPON ] == -1 ) {
|
||||
szWeapon = "Multiple";
|
||||
}
|
||||
else {
|
||||
GetWeaponName( g_damageTaken[ playerid ] [ takenid ] [ E_WEAPON ], szWeapon, sizeof( szWeapon ) );
|
||||
}
|
||||
|
||||
if ( g_damageTaken[ playerid ] [ takenid ] [ E_ISSUER ] == INVALID_PLAYER_ID )
|
||||
{
|
||||
format( szLabel, sizeof( szLabel ), "%s%s -%.2f~n~", szLabel, szWeapon, g_damageTaken[ playerid ] [ takenid ] [ E_AMOUNT ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
format( szLabel, sizeof( szLabel ), "%s%s - %s -%.2f~n~", szLabel, szWeapon, g_damageTaken[ playerid ] [ takenid ] [ E_NAME ], g_damageTaken[ playerid ] [ takenid ] [ E_AMOUNT ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( g_damageFeedTakenTD[ playerid ] == PlayerText: INVALID_TEXT_DRAW ) {
|
||||
print( "[DAMAGE FEED ERROR] Doesn't have feed textdraw when needed ( g_damageFeedTakenTD )" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( szLabel[ 0 ] )
|
||||
{
|
||||
PlayerTextDrawSetString( playerid, g_damageFeedTakenTD[ playerid ], szLabel );
|
||||
PlayerTextDrawShow( playerid, g_damageFeedTakenTD[ playerid ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerTextDrawHide( playerid, g_damageFeedTakenTD[ playerid ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stock RemoveDamageHit( array[ MAX_FEED_HEIGHT ] [ E_DAMAGE_FEED ], index )
|
||||
{
|
||||
for( new i = 0; i < MAX_FEED_HEIGHT; i ++ )
|
||||
{
|
||||
if ( i >= index ) {
|
||||
array[ i ] [ E_TICK ] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stock AddDamageHit( array[ MAX_FEED_HEIGHT ] [ E_DAMAGE_FEED ], playerid, issuerid, Float: amount, weapon )
|
||||
{
|
||||
if ( ! IsDamageFeedActive( playerid ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
new szTick = GetTickCount( );
|
||||
if ( szTick == 0 ) szTick = 1;
|
||||
new wID = -1;
|
||||
|
||||
for( new i = 0; i < sizeof( array ); i ++ )
|
||||
{
|
||||
if ( ! array[ i ] [ E_TICK ] ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( szTick - array[ i ] [ E_TICK ] >= HIDE_FEED_DELAY ) {
|
||||
RemoveDamageHit( array, i );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( array[ i ] [ E_ISSUER ] == issuerid )
|
||||
{
|
||||
amount += array[ i ] [ E_AMOUNT ];
|
||||
wID = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( wID == -1 )
|
||||
{
|
||||
wID = 0;
|
||||
|
||||
for( new i = sizeof( array ) - 1; i >= 1; i -- )
|
||||
{
|
||||
array[ i ] = array[ i - 1 ];
|
||||
}
|
||||
}
|
||||
|
||||
array[ wID ] [ E_TICK ] = szTick;
|
||||
array[ wID ] [ E_AMOUNT ] = amount;
|
||||
array[ wID ] [ E_ISSUER ] = issuerid;
|
||||
array[ wID ] [ E_WEAPON ] = weapon;
|
||||
|
||||
GetPlayerName( issuerid, array[ wID ] [ E_NAME ] , MAX_PLAYER_NAME );
|
||||
|
||||
UpdateDamageFeed( playerid, true );
|
||||
}
|
||||
|
||||
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 SyncPlayer( playerid )
|
||||
{
|
||||
if ( !IsPlayerConnected( playerid ) || !IsPlayerSpawned( playerid ) || p_SyncingPlayer{ playerid } == true || IsPlayerInAnyVehicle( playerid ) || IsPlayerAFK( playerid ) )
|
||||
return 0;
|
||||
|
||||
p_SyncingPlayer{ playerid } = true;
|
||||
|
||||
// ** Obtaining Information **
|
||||
static
|
||||
Float: fX, Float: fY, Float: fZ, Float: fA, Float: iHealth, Float: iArmour,
|
||||
iSkin, iInterior, iWorld, iWeapon, weaponData[ 13 ][ 2 ];
|
||||
|
||||
GetPlayerHealth( playerid, iHealth );
|
||||
GetPlayerArmour( playerid, iArmour );
|
||||
iWeapon = GetPlayerWeapon( playerid );
|
||||
iWorld = GetPlayerVirtualWorld( playerid );
|
||||
iInterior = GetPlayerInterior( playerid );
|
||||
|
||||
GetPlayerPos( playerid, fX, fY, fZ );
|
||||
GetPlayerFacingAngle( playerid, fA );
|
||||
|
||||
for( new slotid = 0; slotid < 13; slotid ++ ) {
|
||||
GetPlayerWeaponData(playerid, slotid, weaponData[ slotid ] [ 0 ], weaponData[ slotid ] [ 1 ] );
|
||||
}
|
||||
|
||||
ClearAnimations( playerid );
|
||||
|
||||
// ** Reinstating Information ** *
|
||||
SetSpawnInfo( playerid, GetPlayerTeam( playerid ), iSkin, fX, fY, fZ - 0.4, fA, 0, 0, 0, 0, 0, 0 );
|
||||
SpawnPlayer( playerid );
|
||||
|
||||
SetPlayerHealth( playerid, iHealth );
|
||||
SetPlayerArmour( playerid, iArmour );
|
||||
|
||||
SetPlayerInterior( playerid, iInterior );
|
||||
SetPlayerVirtualWorld( playerid, iWorld );
|
||||
|
||||
for( new slotid = 0; slotid < 13; slotid ++ ) {
|
||||
GivePlayerWeapon(playerid, weaponData[ slotid ] [ 0 ], weaponData[ slotid ] [ 1 ] );
|
||||
}
|
||||
|
||||
SetPlayerArmedWeapon( playerid, iWeapon );
|
||||
|
||||
SendServerMessage( playerid, "You are now synced." );
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
/* ** Commands ** */
|
||||
CMD:hitmarker( playerid, params[ ] )
|
||||
{
|
||||
ShowSoundsMenu( playerid );
|
||||
return 1;
|
||||
}
|
@ -39,6 +39,7 @@ new
|
||||
p_Ropes [ MAX_PLAYERS ],
|
||||
bool: p_Kidnapped [ MAX_PLAYERS char ],
|
||||
bool: p_ToggledViewPM [ MAX_PLAYERS char ],
|
||||
bool: p_ToggleCopChat [ MAX_PLAYERS char ],
|
||||
p_TicketTimestamp [ MAX_PLAYERS ],
|
||||
p_TicketIssuer [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
|
||||
p_CheckpointEnterTick [ MAX_PLAYERS ],
|
||||
@ -72,7 +73,6 @@ new
|
||||
p_PmResponder [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
|
||||
bool: justConnected [ MAX_PLAYERS char ],
|
||||
p_BailOfferer [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
|
||||
p_DamageTDTimer [ MAX_PLAYERS ] = { -1, ... },
|
||||
Text3D: p_InfoLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID, ... },
|
||||
p_InfoLabelString [ MAX_PLAYERS ] [ 32 ],
|
||||
bool: p_inMovieMode [ MAX_PLAYERS char ],
|
||||
|
@ -112,7 +112,7 @@ static stock InitializeServerVehicles( )
|
||||
AddStaticVehicle( 511, -1245.295776, -95.022689, 15.472208, 135.868728, -1, -1 );
|
||||
AddStaticVehicle( 563, -1185.826293, 25.737642, 14.870979, 226.734649, -1, -1 );
|
||||
AddStaticVehicle( 563, -1224.193359, -10.034203, 14.869047, 223.632965, -1, -1 );
|
||||
AddStaticVehicle( 411, -1238.649780, 50.157535, 13.858886, 225.435058, -1, -1 );
|
||||
//AddStaticVehicle( 411, -1238.649780, 50.157535, 13.858886, 225.435058, -1, -1 );
|
||||
AddStaticVehicle( 522, -1241.090942, 63.254283, 13.680734, 44.845169, -1, -1 );
|
||||
AddStaticVehicleEx( 597, -1634.655029, 651.717651, 6.954792, 180.744827, -1, -1, 240, 1 );
|
||||
AddStaticVehicle( 497, -1682.705566, 705.820434, 30.778402, 90.953826, -1, -1 );
|
||||
@ -227,7 +227,7 @@ static stock InitializeServerVehicles( )
|
||||
AddStaticVehicle( 507, -2545.616699, 642.781616, 14.280050, 88.164779, -1, -1 );
|
||||
AddStaticVehicle( 451, -2572.311035, 658.140808, 14.159088, 92.413055, -1, -1 );
|
||||
AddStaticVehicle( 576, -2572.658935, 647.644714, 14.062355, 89.737174, -1, -1 );
|
||||
AddStaticVehicle( 411, -1943.248291, 487.249816, 31.713851, 90.106033, -1, -1 );
|
||||
//AddStaticVehicle( 411, -1943.248291, 487.249816, 31.713851, 90.106033, -1, -1 );
|
||||
AddStaticVehicle( 522, -1988.700683, 301.183624, 34.739818, 89.835449, -1, -1 );
|
||||
AddStaticVehicle( 579, -1987.592651, 304.252044, 35.113090, 90.826240, -1, -1 );
|
||||
AddStaticVehicle( 489, -1987.468261, 307.747619, 35.318893, 88.531921, -1, -1 );
|
||||
|
@ -40,7 +40,6 @@ new
|
||||
PlayerText: p_PlayerRankTextTD [ 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_DamageTD [ 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: p_HelpBoxTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||
@ -439,14 +438,6 @@ hook OnPlayerConnect( playerid )
|
||||
PlayerTextDrawSetOutline(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..." );
|
||||
PlayerTextDrawAlignment( playerid, p_LocationTD[ playerid ], 2 );
|
||||
PlayerTextDrawBackgroundColor( playerid, p_LocationTD[ playerid ], 255 );
|
||||
|
@ -343,21 +343,6 @@ new
|
||||
|
||||
/* ** Rank System ** */
|
||||
|
||||
/* ** 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 ** */
|
||||
#define MAX_RACES ( 32 )
|
||||
|
||||
@ -2234,7 +2219,6 @@ public OnPlayerDisconnect( playerid, reason )
|
||||
p_AddedEmail { playerid } = false;
|
||||
p_TicketTimestamp[ playerid ] = 0;
|
||||
p_ExtraAssetSlots{ playerid } = 0;
|
||||
p_HitmarkerSound{ playerid } = 0;
|
||||
p_CasinoRewardsPoints[ playerid ] = 0.0;
|
||||
p_OwnedBusinesses[ playerid ] = 0;
|
||||
p_ExplosiveBullets[ playerid ] = 0;
|
||||
@ -2935,45 +2919,11 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b
|
||||
amount *= 1.5;
|
||||
}
|
||||
|
||||
// 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( "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 );
|
||||
}
|
||||
}
|
||||
|
||||
CallLocalFunction( "OnPlayerTakenDamage", "ddfdd", playerid, issuerid, amount, weaponid, bodypart );
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
function hidedamagetd_Timer( playerid )
|
||||
return PlayerTextDrawHide( playerid, p_DamageTD[ playerid ] );
|
||||
|
||||
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 );
|
||||
}
|
||||
@ -3476,6 +3426,14 @@ public OnPlayerText( playerid, text[ ] )
|
||||
}
|
||||
}
|
||||
SendClientMessageToCops( -1, ""COL_BLUE"<Police Radio> %s(%d):"COL_WHITE" %s", ReturnPlayerName( playerid ), playerid, szBigString[ 1 ] );
|
||||
|
||||
foreach(new i : Player)
|
||||
{
|
||||
if ( ( p_AdminLevel[ i ] >= 5 || IsPlayerUnderCover( i ) ) && p_ToggleCopChat{ i } == true )
|
||||
{
|
||||
SendClientMessageFormatted( i, -1, ""COL_BLUE"<Police Radio> %s(%d):"COL_GREY" %s", ReturnPlayerName( playerid ), playerid, szBigString[ 1 ] );
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4395,15 +4353,6 @@ thread readplayervipnotes( playerid )
|
||||
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[ ] )
|
||||
{
|
||||
new
|
||||
@ -12362,12 +12311,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 )
|
||||
{
|
||||
SendClientMessageToAdmins( -1, ""COL_PINK"[DONOR NEEDS HELP]"COL_GREY" %s(%d) is requesting help with their VIP asset(s). (/viewnotes)", ReturnPlayerName( playerid ), playerid );
|
||||
@ -16611,19 +16554,6 @@ thread OnListGangMembers( playerid, gangid, page )
|
||||
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 ) {
|
||||
GivePlayerWeapon( playerid, 3, 1 );
|
||||
GivePlayerWeapon( playerid, 22, 250 );
|
||||
|
Loading…
Reference in New Issue
Block a user