From e46ece5acefef2dac30aa177438c0a287c3a496d Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Sat, 13 Oct 2018 14:07:39 +0100 Subject: [PATCH 1/9] removes invalid vehicles http://forum.sfcnr.com/showthread.php?60671-Infernus-placements --- gamemodes/irresistible/cnr/static/server_vehicles.pwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamemodes/irresistible/cnr/static/server_vehicles.pwn b/gamemodes/irresistible/cnr/static/server_vehicles.pwn index 7913664..7f2e56a 100644 --- a/gamemodes/irresistible/cnr/static/server_vehicles.pwn +++ b/gamemodes/irresistible/cnr/static/server_vehicles.pwn @@ -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 ); From c15ea9ef49c8a0696dce11f9a9be1421371f6606 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Sat, 13 Oct 2018 14:11:21 +0100 Subject: [PATCH 2/9] adds /viewpolicechat for level 5 admins --- gamemodes/irresistible/cnr/commands/admin/_admin.pwn | 1 + .../irresistible/cnr/commands/admin/admin_five.pwn | 12 ++++++++++++ gamemodes/irresistible/cnr/player.pwn | 1 + gamemodes/sf-cnr.pwn | 8 ++++++++ 4 files changed, 22 insertions(+) diff --git a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn index 92a959b..20c6223 100644 --- a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn @@ -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" }, diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn index 6630a21..cc492a1 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn @@ -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 diff --git a/gamemodes/irresistible/cnr/player.pwn b/gamemodes/irresistible/cnr/player.pwn index 1953156..0fb853b 100644 --- a/gamemodes/irresistible/cnr/player.pwn +++ b/gamemodes/irresistible/cnr/player.pwn @@ -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 ], diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 8a2f7c6..b2d5ee9 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -3427,6 +3427,14 @@ public OnPlayerText( playerid, text[ ] ) } } SendClientMessageToCops( -1, ""COL_BLUE" %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" %s(%d):"COL_GREY" %s", ReturnPlayerName( playerid ), playerid, szBigString[ 1 ] ); + } + } return 0; } From ad8a8b9385e35dbe6ff00ecf12edc90a449f378f Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Sat, 13 Oct 2018 14:15:48 +0100 Subject: [PATCH 3/9] removes invalid defines --- gamemodes/irresistible/cnr/features/damage_feed.pwn | 3 --- 1 file changed, 3 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/damage_feed.pwn b/gamemodes/irresistible/cnr/features/damage_feed.pwn index 9283629..eff6826 100644 --- a/gamemodes/irresistible/cnr/features/damage_feed.pwn +++ b/gamemodes/irresistible/cnr/features/damage_feed.pwn @@ -16,9 +16,6 @@ #define HIDE_FEED_DELAY ( 3000 ) #define MAX_UPDATE_RATE ( 250 ) -#define TYPE_GIVEN ( 1 ) -#define TYPE_TAKEN ( 2 ) - #define TEXTDRAW_ADDON ( 100.0 ) /* ** Forwards ** */ From aeabfdcdf50b71d06b86d9c937181acda2a086a2 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Sat, 13 Oct 2018 14:16:59 +0100 Subject: [PATCH 4/9] removed unused function --- gamemodes/irresistible/cnr/features/damage_feed.pwn | 7 ------- 1 file changed, 7 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/damage_feed.pwn b/gamemodes/irresistible/cnr/features/damage_feed.pwn index eff6826..29cb940 100644 --- a/gamemodes/irresistible/cnr/features/damage_feed.pwn +++ b/gamemodes/irresistible/cnr/features/damage_feed.pwn @@ -185,13 +185,6 @@ public OnPlayerFeedUpdate( playerid ) return 1; } -stock CreateBulletLabel( playerid, weaponid, Float: amount ) -{ - if ( IsPlayerInCasino( playerid ) || IsPlayerInPaintBall( playerid ) || IsPlayerInEvent( playerid ) || IsPlayerInMinigame( playerid ) ) - return; - -} - stock DamageFeedAddHitGiven( playerid, issuerid, Float: amount, weaponid ) { foreach( new i : Player ) if ( p_Spectating{ i } && p_whomSpectating[ i ] == playerid && i != playerid ) { From 76d2629b0aa57b66c12a30773b6454c6539af96c Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Sat, 13 Oct 2018 15:38:02 +0100 Subject: [PATCH 5/9] starting sync player. --- .../irresistible/cnr/features/damage_feed.pwn | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/gamemodes/irresistible/cnr/features/damage_feed.pwn b/gamemodes/irresistible/cnr/features/damage_feed.pwn index 29cb940..1b008ed 100644 --- a/gamemodes/irresistible/cnr/features/damage_feed.pwn +++ b/gamemodes/irresistible/cnr/features/damage_feed.pwn @@ -46,6 +46,7 @@ static stock //g_BulletTimer [ MAX_PLAYERS ], bool: p_GotHit [ MAX_PLAYERS char ], + bool: p_SyncingPlayer [ MAX_PLAYERS char ], PlayerText: g_damageFeedTakenTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, PlayerText: g_damageFeedGivenTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, @@ -86,6 +87,7 @@ hook OnPlayerConnect( playerid ) hook OnPlayerDisconnect( playerid, reason ) { p_HitmarkerSound{ playerid } = 0; + p_SyncingPlayer{ playerid } = false; return 1; } @@ -104,6 +106,14 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) return 1; } +hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) +{ + if ( PRESSED( KEY_SPRINT ) && PRESSED( KEY_AIM ) ) { + SyncPlayer( playerid ); + } + return 1; +} + /* ** Functions ** */ function DamageFeed_HideBulletLabel( labelid ) { @@ -499,6 +509,53 @@ stock ShowSoundsMenu( playerid ) 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[ ] ) { From 3fe26389594e70b3a6919b657af4e821c93daeec Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Sat, 13 Oct 2018 15:44:04 +0100 Subject: [PATCH 6/9] textdraw changes --- .../irresistible/cnr/features/damage_feed.pwn | 93 ++++++------------- 1 file changed, 26 insertions(+), 67 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/damage_feed.pwn b/gamemodes/irresistible/cnr/features/damage_feed.pwn index 1b008ed..2ab6629 100644 --- a/gamemodes/irresistible/cnr/features/damage_feed.pwn +++ b/gamemodes/irresistible/cnr/features/damage_feed.pwn @@ -81,6 +81,27 @@ hook OnPlayerConnect( playerid ) 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; } @@ -106,14 +127,6 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) return 1; } -hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) -{ - if ( PRESSED( KEY_SPRINT ) && PRESSED( KEY_AIM ) ) { - SyncPlayer( playerid ); - } - return 1; -} - /* ** Functions ** */ function DamageFeed_HideBulletLabel( labelid ) { @@ -132,7 +145,7 @@ public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypar GetPlayerLastShotVectors( issuerid, fromX, fromY, fromZ, toX, toY, toZ ); new - Text3D: bullet_label = CreateDynamic3DTextLabel( sprintf( "%.0f", amount ), 0xFFFFFF80, toX, toY, toZ, 100.0, .interiorid = GetPlayerVirtualWorld( playerid ), .worldid = GetPlayerInterior( playerid ), .testlos = 1 ); + 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 ) ) { @@ -215,60 +228,6 @@ stock DamageFeedAddHitTaken( playerid, issuerid, Float: amount, weaponid ) stock UpdateDamageFeed( playerid, bool: modified = false ) { - if ( !IsDamageFeedActive( playerid ) ) - { - if ( g_damageFeedGivenTD[ playerid ] != PlayerText: INVALID_TEXT_DRAW ) { - PlayerTextDrawDestroy( playerid, g_damageFeedGivenTD[ playerid ] ); - g_damageFeedGivenTD[ playerid ] = PlayerText: INVALID_TEXT_DRAW; - } - - if ( g_damageFeedTakenTD[ playerid ] != PlayerText: INVALID_TEXT_DRAW ) { - PlayerTextDrawDestroy( playerid, g_damageFeedTakenTD[ playerid ] ); - g_damageFeedTakenTD[ playerid ] = PlayerText: INVALID_TEXT_DRAW; - } - - return 1; - } - - /* ** Textdraws ** */ - if ( g_damageFeedGivenTD[ playerid] == PlayerText: INVALID_TEXT_DRAW ) - { - new PlayerText: handle = CreatePlayerTextDraw( playerid, ( 320.0 - TEXTDRAW_ADDON ), 340.0, "_"); - - if ( handle == PlayerText: INVALID_TEXT_DRAW ) - return print("[DAMAGE FEED ERROR]: Unable to create TD (given damage)" ); - - PlayerTextDrawBackgroundColor(playerid, handle, 117 ); - PlayerTextDrawAlignment( playerid, handle, 2 ); - PlayerTextDrawFont( playerid, handle, 1 ); - PlayerTextDrawLetterSize( playerid, handle, 0.200000, 0.899999 ); - PlayerTextDrawColor( playerid, handle, 0xDD2020FF ); - PlayerTextDrawSetOutline( playerid, handle, 1 ); - PlayerTextDrawSetProportional( playerid, handle, 1 ); - PlayerTextDrawSetSelectable( playerid, handle, 0 ); - - g_damageFeedGivenTD[ playerid ] = handle; - } - - if ( g_damageFeedTakenTD[ playerid] == PlayerText: INVALID_TEXT_DRAW ) - { - new PlayerText: handle = CreatePlayerTextDraw( playerid, ( TEXTDRAW_ADDON + 320.0 ), 340.0, "_"); - - if ( handle == PlayerText: INVALID_TEXT_DRAW ) - return print("[DAMAGE FEED ERROR]: Unable to create TD (taken damage)" ); - - PlayerTextDrawBackgroundColor(playerid, handle, 117 ); - PlayerTextDrawAlignment( playerid, handle, 2 ); - PlayerTextDrawFont( playerid, handle, 1 ); - PlayerTextDrawLetterSize( playerid, handle, 0.200000, 0.899999 ); - PlayerTextDrawColor( playerid, handle, 1069804543 ); - PlayerTextDrawSetOutline( playerid, handle, 1 ); - PlayerTextDrawSetProportional( playerid, handle, 1 ); - PlayerTextDrawSetSelectable( playerid, handle, 0 ); - - g_damageFeedTakenTD[ playerid ] = handle; - } - /* ** Core ** */ new szTick = GetTickCount( ); if ( szTick == 0 ) szTick = 1; @@ -509,14 +468,14 @@ stock ShowSoundsMenu( playerid ) ShowPlayerDialog( playerid, DIALOG_MODIFY_HITSOUND, DIALOG_STYLE_LIST, ""COL_WHITE"Hitmarker Sound", szSounds, "Select", "Close" ); } -stock SyncPlayer( playerid ) +/*stock SyncPlayer( playerid ) { if ( !IsPlayerConnected( playerid ) || !IsPlayerSpawned( playerid ) || p_SyncingPlayer{ playerid } == true || IsPlayerInAnyVehicle( playerid ) || IsPlayerAFK( playerid ) ) return 0; p_SyncingPlayer{ playerid } = true; - /* ** Obtaining Information ** */ + // ** Obtaining Information ** static Float: fX, Float: fY, Float: fZ, Float: fA, Float: iHealth, Float: iArmour, iSkin, iInterior, iWorld, iWeapon, weaponData[ 13 ][ 2 ]; @@ -536,7 +495,7 @@ stock SyncPlayer( playerid ) ClearAnimations( playerid ); - /* ** Reinstating Information ** */ + // ** Reinstating Information ** * SetSpawnInfo( playerid, GetPlayerTeam( playerid ), iSkin, fX, fY, fZ - 0.4, fA, 0, 0, 0, 0, 0, 0 ); SpawnPlayer( playerid ); @@ -554,7 +513,7 @@ stock SyncPlayer( playerid ) SendServerMessage( playerid, "You are now synced." ); return 1; -} +}*/ /* ** Commands ** */ CMD:hitmarker( playerid, params[ ] ) From 7d0d72260bcd316635f801787643a863af00ba94 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Sat, 13 Oct 2018 17:04:32 +0100 Subject: [PATCH 7/9] global object replacement --- gamemodes/irresistible/cnr/features/damage_feed.pwn | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/damage_feed.pwn b/gamemodes/irresistible/cnr/features/damage_feed.pwn index 2ab6629..25e1a7e 100644 --- a/gamemodes/irresistible/cnr/features/damage_feed.pwn +++ b/gamemodes/irresistible/cnr/features/damage_feed.pwn @@ -47,6 +47,7 @@ static stock 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, ... }, @@ -163,7 +164,10 @@ public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypar if ( GetPlayerArmour( playerid, armour ) ) { - 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 ); + 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 ); @@ -190,8 +194,8 @@ public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypar function HideDamageObject( playerid ) { - if( IsPlayerAttachedObjectSlotUsed( playerid, 4 ) ) - RemovePlayerAttachedObject( playerid, 4 ); + if( IsValidObject( p_DamageObject[ playerid ] ) ) + DestroyObject( p_DamageObject[ playerid ] ); p_GotHit{ playerid } = false; return 1; From 18ff02951b48b2c106ff827acf36b45f900aa84e Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Sat, 13 Oct 2018 17:06:06 +0100 Subject: [PATCH 8/9] hidden syncing for the time being --- gamemodes/irresistible/cnr/features/damage_feed.pwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/damage_feed.pwn b/gamemodes/irresistible/cnr/features/damage_feed.pwn index 25e1a7e..04a7d15 100644 --- a/gamemodes/irresistible/cnr/features/damage_feed.pwn +++ b/gamemodes/irresistible/cnr/features/damage_feed.pwn @@ -46,7 +46,7 @@ static stock //g_BulletTimer [ MAX_PLAYERS ], bool: p_GotHit [ MAX_PLAYERS char ], - bool: p_SyncingPlayer [ MAX_PLAYERS char ], + //bool: p_SyncingPlayer [ MAX_PLAYERS char ], p_DamageObject [ MAX_PLAYERS ] = { -1, ... }, PlayerText: g_damageFeedTakenTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, @@ -109,7 +109,7 @@ hook OnPlayerConnect( playerid ) hook OnPlayerDisconnect( playerid, reason ) { p_HitmarkerSound{ playerid } = 0; - p_SyncingPlayer{ playerid } = false; + //p_SyncingPlayer{ playerid } = false; return 1; } From 9ed522155021cd3f85d88f5e8eedc989e6d0a029 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Sun, 14 Oct 2018 13:38:34 +1100 Subject: [PATCH 9/9] destroy damage object if it exists --- gamemodes/irresistible/cnr/features/damage_feed.pwn | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/damage_feed.pwn b/gamemodes/irresistible/cnr/features/damage_feed.pwn index 04a7d15..f887609 100644 --- a/gamemodes/irresistible/cnr/features/damage_feed.pwn +++ b/gamemodes/irresistible/cnr/features/damage_feed.pwn @@ -164,13 +164,15 @@ public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypar 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 ); + //Streamer_Update( playerid, STREAMER_TYPE_OBJECT ); p_GotHit{ playerid } = true; } } @@ -194,8 +196,10 @@ public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypar function HideDamageObject( playerid ) { - if( IsValidObject( p_DamageObject[ playerid ] ) ) + if( IsValidObject( p_DamageObject[ playerid ] ) ) { DestroyObject( p_DamageObject[ playerid ] ); + p_DamageObject[ playerid ] = -1; + } p_GotHit{ playerid } = false; return 1; @@ -476,7 +480,7 @@ stock ShowSoundsMenu( playerid ) { if ( !IsPlayerConnected( playerid ) || !IsPlayerSpawned( playerid ) || p_SyncingPlayer{ playerid } == true || IsPlayerInAnyVehicle( playerid ) || IsPlayerAFK( playerid ) ) return 0; - + p_SyncingPlayer{ playerid } = true; // ** Obtaining Information ** @@ -498,7 +502,7 @@ stock ShowSoundsMenu( playerid ) } ClearAnimations( playerid ); - + // ** Reinstating Information ** * SetSpawnInfo( playerid, GetPlayerTeam( playerid ), iSkin, fX, fY, fZ - 0.4, fA, 0, 0, 0, 0, 0, 0 ); SpawnPlayer( playerid );