From 7ea55e0743c4e2a17a13c306bdd8b16b1b62f1b6 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Sun, 16 Sep 2018 15:34:42 +1000 Subject: [PATCH] convert more player textdraws (that use global td) to actual player textdraw --- .../cnr/features/minijobs/pilot.pwn | 43 ++--- .../cnr/features/minijobs/trucking.pwn | 12 +- .../cnr/features/visage/blackjack.pwn | 2 +- gamemodes/irresistible/cnr/textdraws.pwn | 173 ++++++++++-------- gamemodes/sf-cnr.pwn | 58 +++--- scriptfiles/updates.txt | 1 + 6 files changed, 156 insertions(+), 133 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/minijobs/pilot.pwn b/gamemodes/irresistible/cnr/features/minijobs/pilot.pwn index 8b45b17..637b95f 100644 --- a/gamemodes/irresistible/cnr/features/minijobs/pilot.pwn +++ b/gamemodes/irresistible/cnr/features/minijobs/pilot.pwn @@ -9,7 +9,7 @@ #include < YSI\y_hooks > /* ** Definitions ** */ -#define PILOT_BONUS ( 6000 ) +#define PILOT_BONUS ( 4000 ) #define INVALID_PILOT_ROUTE ( 0xFF ) /* ** Variables ** */ @@ -26,7 +26,7 @@ enum E_AIRPORT_DATA Float: E_X, Float: E_Y, Float: E_Z, }; -new +new g_DropOffLocations[ ] [ E_PILOT_DATA ] = { // SF @@ -62,7 +62,7 @@ new { "Los Santos Airport", 1921.8281, -2252.9990, 13.5469 }, { "Abandoned Airstrip", 175.2288, 2504.6611, 16.4844 }, - { "Abandoned Airstrip", 266.3593, 2535.8496, 16.8125 } + { "Abandoned Airstrip", 266.3593, 2535.8496, 16.8125 } }, g_CargoName[ ][ 8 ] = { "Wheat", "Weed", "Meth", "Coke", "Weapons", "Clothes", "Drinks" }, @@ -142,11 +142,11 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid ) static aPlayer[ 1 ]; aPlayer[ 0 ] = playerid; p_PilotPositionTimer[ playerid ] = SetTimerEx( "OnPilotPositionUpdate", 750, false, "dd", playerid, p_PilotRoute[ playerid ] { 1 } ); - TextDrawShowForPlayer( playerid, p_TruckingTD[ playerid ] ); + PlayerTextDrawShow( playerid, p_TruckingTD[ playerid ] ); KillTimer( p_PilotLoadTimer[ playerid ] ); p_PilotLoadTimer [ playerid ] = 0xFFFF; - p_PilotLoadTimer [ playerid ] = SetTimerEx( "OnPilotLoadCargo", 5000, false, "d", playerid ); + p_PilotLoadTimer [ playerid ] = SetTimerEx( "OnPilotLoadCargo", 5000, false, "d", playerid ); TogglePlayerControllable(playerid, false); @@ -158,20 +158,15 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid ) p_PilotMapIcon [ playerid ] = CreateDynamicMapIconEx( g_DropOffLocations[ p_PilotRoute[ playerid ] { 1 } ] [ E_X ], g_DropOffLocations[ p_PilotRoute[ playerid ] { 1 } ] [ E_Y ], g_DropOffLocations[ p_PilotRoute[ playerid ] { 1 } ] [ E_Z ], 51, 0, MAPICON_GLOBAL, 6000.0, { -1 }, { -1 }, aPlayer ); p_PilotCheckPoint [ playerid ] = CreateDynamicRaceCP( 4, g_DropOffLocations[ p_PilotRoute[ playerid ] { 1 } ] [ E_X ], g_DropOffLocations[ p_PilotRoute[ playerid ] { 1 } ] [ E_Y ], g_DropOffLocations[ p_PilotRoute[ playerid ] { 1 } ] [ E_Z ] + 50.0, 15.0, 0.0, 0.0, 10.0, -1, -1, playerid ); - return ( p_PilotRoute[ playerid ] { 0 } = INVALID_PILOT_ROUTE ), 1; + return ( p_PilotRoute[ playerid ] { 0 } = INVALID_PILOT_ROUTE ), 1; } else if ( p_PilotRoute[ playerid ] { 1 } != INVALID_PILOT_ROUTE ) { new - iCashEarned; + iCashEarned = floatround( p_PilotDistance[ playerid ] * ( p_PilotDifficulty[ playerid ] == RISK_FACTOR_EASY ? 1.0 : 2.0 ) + PILOT_BONUS ); - if ( p_PilotDifficulty[ playerid ] == RISK_FACTOR_EASY) - iCashEarned = floatround( p_PilotDistance[ playerid ] * 1.0 + PILOT_BONUS ); - else - iCashEarned = floatround( p_PilotDistance[ playerid ] * 2.0 + PILOT_BONUS ); - - TextDrawHideForPlayer( playerid, p_TruckingTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_TruckingTD[ playerid ] ); GivePlayerScore( playerid, 1 + floatround( p_PilotDistance[ playerid ] / 1000.0 ) ); GivePlayerCash( playerid, iCashEarned ); @@ -189,7 +184,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid ) p_PilotRoute [ playerid ] { 0 } = INVALID_PILOT_ROUTE; p_PilotRoute [ playerid ] { 1 } = INVALID_PILOT_ROUTE; - return ( p_PilotRoute[ playerid ] { 1 } = INVALID_PILOT_ROUTE ), 1; + return ( p_PilotRoute[ playerid ] { 1 } = INVALID_PILOT_ROUTE ), 1; } return 1; @@ -199,7 +194,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid ) /* ** Functions ** */ stock getClosestPilotRoute( playerid, &Float: distance = FLOAT_INFINITY ) { - new + new iCurrent = INVALID_PLAYER_ID, Float:fTmp; for( new i = 0; i < sizeof( g_AirportLocations ); i++ ) @@ -229,7 +224,7 @@ stock StopPlayerPilotWork( playerid ) p_PilotCargo [ playerid ] = -1; p_PilotVehicle [ playerid ] = INVALID_VEHICLE_ID; - TextDrawHideForPlayer( playerid, p_TruckingTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_TruckingTD[ playerid ] ); } stock IsVehiclePlane ( vehicleid ) @@ -242,7 +237,7 @@ stock IsVehiclePlane ( vehicleid ) function OnPilotPositionUpdate( playerid, routeid ) { if ( !IsPlayerInAnyVehicle( playerid ) && !p_hasPilotJob{ playerid } && ( p_PilotRoute[ playerid ] { 0 } == 0 && p_PilotRoute[ playerid ] { 1 } == 0 ) ) { - TextDrawHideForPlayer( playerid, p_TruckingTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_TruckingTD[ playerid ] ); return ( p_PilotPositionTimer[ playerid ] = 0xFFFF ); } @@ -251,11 +246,11 @@ function OnPilotPositionUpdate( playerid, routeid ) if ( routeid == p_PilotRoute[ playerid ] { 0 }) { fDistance = GetPlayerDistanceFromPoint( playerid, g_AirportLocations[ routeid ] [ E_X ], g_AirportLocations[ routeid ] [ E_Y ], g_AirportLocations[ routeid ] [ E_Z ] ); - TextDrawSetString( p_TruckingTD[ playerid ], sprintf( "~b~Location:~w~ %s~n~~b~Distance:~w~ %0.2fm", g_AirportLocations[ routeid ] [ E_NAME ], fDistance ) ); + PlayerTextDrawSetString( playerid, p_TruckingTD[ playerid ], sprintf( "~b~Location:~w~ %s~n~~b~Distance:~w~ %0.2fm", g_AirportLocations[ routeid ] [ E_NAME ], fDistance ) ); } else if ( routeid == p_PilotRoute[ playerid ] { 1 }) { fDistance = GetPlayerDistanceFromPoint( playerid, g_DropOffLocations[ routeid ] [ E_X ], g_DropOffLocations[ routeid ] [ E_Y ], g_DropOffLocations[ routeid ] [ E_Z ] ); - TextDrawSetString( p_TruckingTD[ playerid ], sprintf( "~b~Location:~w~ %s~n~~b~Distance:~w~ %0.2fm", g_DropOffLocations[ routeid ] [ E_NAME ], fDistance ) ); + PlayerTextDrawSetString( playerid, p_TruckingTD[ playerid ], sprintf( "~b~Location:~w~ %s~n~~b~Distance:~w~ %0.2fm", g_DropOffLocations[ routeid ] [ E_NAME ], fDistance ) ); } return ( p_PilotPositionTimer[ playerid ] = SetTimerEx( "OnPilotPositionUpdate", 750, false, "dd", playerid, routeid ) ); @@ -266,7 +261,7 @@ function cancelPlayerPilotWork( playerid, vehicleid, ticks ) if ( p_PilotVehicle[ playerid ] == vehicleid && ticks ) return KillTimer( p_PilotCancelTimer[ playerid ] ), p_PilotCancelTimer[ playerid ] = 0xFFFF; - if ( ticks < 1 || !IsPlayerConnected( playerid ) || !IsPlayerSpawned( playerid ) ) + if ( ticks < 1 || !IsPlayerConnected( playerid ) || !IsPlayerSpawned( playerid ) || ! p_hasPilotJob{ playerid } ) { StopPlayerPilotWork( playerid ); return SendServerMessage( playerid, "Your pilot mission has been stopped." ); @@ -297,7 +292,7 @@ function OnPilotLoadCargo( playerid ) /* ** Commands ** */ CMD:pilot( playerid, params[ ] ) { - new + new szDifficulty[ 7 ], iVehicle = GetPlayerVehicleID( playerid ); @@ -328,7 +323,7 @@ CMD:pilot( playerid, params[ ] ) p_PilotDifficulty [ playerid ] = ( strmatch( szDifficulty, "harder" ) ? RISK_FACTOR_HARD : RISK_FACTOR_EASY ); p_PilotCargo [ playerid ] = random( sizeof( g_CargoName ) ); - p_PilotRoute [ playerid ] { 0 } = random ( sizeof ( g_AirportLocations ) ); + p_PilotRoute [ playerid ] { 0 } = random ( sizeof ( g_AirportLocations ) ); p_PilotRoute [ playerid ] { 1 } = random ( sizeof( g_DropOffLocations ) ); p_PilotTimeElapsed [ playerid ] = g_iTime; @@ -337,7 +332,7 @@ CMD:pilot( playerid, params[ ] ) p_PilotCheckPoint [ playerid ] = CreateDynamicRaceCP( 0, g_AirportLocations[ p_PilotRoute[ playerid ] { 0 } ] [ E_X ], g_AirportLocations[ p_PilotRoute[ playerid ] { 0 } ] [ E_Y ], g_AirportLocations[ p_PilotRoute[ playerid ] { 0 } ] [ E_Z ], 0.0, 0.0, 0.0, 10.0, -1, -1, playerid ); p_PilotPositionTimer[ playerid ] = SetTimerEx( "OnPilotPositionUpdate", 750, false, "dd", playerid, p_PilotRoute[ playerid ] { 0 } ); - TextDrawShowForPlayer( playerid, p_TruckingTD[ playerid ] ); + PlayerTextDrawShow( playerid, p_TruckingTD[ playerid ] ); ShowPlayerHelpDialog( playerid, 7500, "A ~g~~h~truck blip~w~~h~ has been shown on your radar. Go to where the truck blip is to pickup your cargo full of %s.", g_CargoName[ p_PilotCargo[ playerid ] ] ); } @@ -346,4 +341,4 @@ CMD:pilot( playerid, params[ ] ) else SendError( playerid, "There are currently no jobs for this particular vehicle." ); } return 1; -} \ No newline at end of file +} diff --git a/gamemodes/irresistible/cnr/features/minijobs/trucking.pwn b/gamemodes/irresistible/cnr/features/minijobs/trucking.pwn index 7f87cb7..8e4b1ad 100644 --- a/gamemodes/irresistible/cnr/features/minijobs/trucking.pwn +++ b/gamemodes/irresistible/cnr/features/minijobs/trucking.pwn @@ -150,7 +150,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid ) { static aPlayer[ 1 ]; aPlayer[ 0 ] = playerid; p_TruckingPositionTimer[ playerid ] = SetTimerEx( "OnTruckPositionUpdate", 750, false, "dd", playerid, p_TruckingRoute[ playerid ] { 1 } ); - TextDrawShowForPlayer( playerid, p_TruckingTD[ playerid ] ); + PlayerTextDrawShow( playerid, p_TruckingTD[ playerid ] ); ShowPlayerHelpDialog( playerid, 7500, "Your trailer has been loaded with %s. ~g~~h~Follow the truck blip on your radar to meet the destination.", g_aTrailerData[ p_TruckingTrailerModel{ playerid } ] [ p_TruckingTrailer{ playerid } ] [ E_NAME ] ); p_TruckingMapIcon [ playerid ] = CreateDynamicMapIconEx( g_aTruckingLocations[ p_TruckingRoute[ playerid ] { 1 } ] [ E_X ], g_aTruckingLocations[ p_TruckingRoute[ playerid ] { 1 } ] [ E_Y ], g_aTruckingLocations[ p_TruckingRoute[ playerid ] { 1 } ] [ E_Z ], 51, 0, MAPICON_GLOBAL, 6000.0, { -1 }, { -1 }, aPlayer ); @@ -176,7 +176,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid ) iCashEarned = floatround( p_TruckingDistance[ playerid ] * 2.0 + g_aTrailerData[ p_TruckingTrailerModel{ playerid } ] [ p_TruckingTrailer{ playerid } ] [ E_BONUS ] ); ach_HandleTruckingCouriers( playerid ); - TextDrawHideForPlayer( playerid, p_TruckingTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_TruckingTD[ playerid ] ); GivePlayerScore( playerid, 1 + floatround( p_TruckingDistance[ playerid ] / 1000.0 ) ); GivePlayerCash( playerid, iCashEarned ); @@ -297,7 +297,7 @@ CMD:work( playerid, params[ ] ) p_TruckingCheckPoint[ playerid ] = CreateDynamicRaceCP( 0, g_aTruckingLocations[ p_TruckingRoute[ playerid ] { 0 } ] [ E_X ], g_aTruckingLocations[ p_TruckingRoute[ playerid ] { 0 } ] [ E_Y ], g_aTruckingLocations[ p_TruckingRoute[ playerid ] { 0 } ] [ E_Z ], g_aTruckingLocations[ p_TruckingRoute[ playerid ] { 1 } ] [ E_X ], g_aTruckingLocations[ p_TruckingRoute[ playerid ] { 1 } ] [ E_Y ], g_aTruckingLocations[ p_TruckingRoute[ playerid ] { 1 } ] [ E_Z ], 10.0, -1, -1, playerid ); p_TruckingPositionTimer[ playerid ] = SetTimerEx( "OnTruckPositionUpdate", 750, false, "dd", playerid, p_TruckingRoute[ playerid ] { 0 } ); - TextDrawShowForPlayer( playerid, p_TruckingTD[ playerid ] ); + PlayerTextDrawShow( playerid, p_TruckingTD[ playerid ] ); ShowPlayerHelpDialog( playerid, 7500, "A ~g~~h~truck blip~w~~h~ has been shown on your radar. Go to where the truck blip is load your trailer with %s.", g_aTrailerData[ p_TruckingTrailerModel{ playerid } ] [ p_TruckingTrailer{ playerid } ] [ E_NAME ] ); } @@ -326,7 +326,7 @@ stock StopPlayerTruckingCourier( playerid ) p_TruckingRoute [ playerid ] { 0 } = INVALID_TRUCKING_ROUTE; p_TruckingRoute [ playerid ] { 1 } = INVALID_TRUCKING_ROUTE; - TextDrawHideForPlayer( playerid, p_TruckingTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_TruckingTD[ playerid ] ); } stock getRandomTrailerLoad( iModel, iRisk ) { @@ -359,14 +359,14 @@ stock getClosestTruckingRoute( playerid, &Float: distance = FLOAT_INFINITY ) { function OnTruckPositionUpdate( playerid, routeid ) { if ( !IsPlayerInAnyVehicle( playerid ) && !p_hasTruckingJob{ playerid } && ( p_TruckingRoute[ playerid ] { 0 } == 0 && p_TruckingRoute[ playerid ] { 1 } == 0 ) ) { - TextDrawHideForPlayer( playerid, p_TruckingTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_TruckingTD[ playerid ] ); return ( p_TruckingPositionTimer[ playerid ] = 0xFFFF ); } new Float: fDistance = GetPlayerDistanceFromPoint( playerid, g_aTruckingLocations[ routeid ] [ E_X ], g_aTruckingLocations[ routeid ] [ E_Y ], g_aTruckingLocations[ routeid ] [ E_Z ] ); - TextDrawSetString( p_TruckingTD[ playerid ], sprintf( "~b~Location:~w~ %s~n~~b~Distance:~w~ %0.2fm", g_aTruckingLocations[ routeid ] [ E_NAME ], fDistance ) ); + PlayerTextDrawSetString( playerid, p_TruckingTD[ playerid ], sprintf( "~b~Location:~w~ %s~n~~b~Distance:~w~ %0.2fm", g_aTruckingLocations[ routeid ] [ E_NAME ], fDistance ) ); return ( p_TruckingPositionTimer[ playerid ] = SetTimerEx( "OnTruckPositionUpdate", 750, false, "dd", playerid, routeid ) ); } diff --git a/gamemodes/irresistible/cnr/features/visage/blackjack.pwn b/gamemodes/irresistible/cnr/features/visage/blackjack.pwn index b749bd8..ce74d24 100644 --- a/gamemodes/irresistible/cnr/features/visage/blackjack.pwn +++ b/gamemodes/irresistible/cnr/features/visage/blackjack.pwn @@ -18,7 +18,7 @@ #endif*/ /* ** Definitions ** */ -#define MAX_BLACKJACK_TABLES ( 50 ) // 33 +#define MAX_BLACKJACK_TABLES ( 33 ) #define MAX_BLACKJACK_CARDS ( 5 ) #define MAX_BLACKJACK_PLAYERS ( 3 ) #define BLACKJACK_DEALER_WAIT ( 500 ) diff --git a/gamemodes/irresistible/cnr/textdraws.pwn b/gamemodes/irresistible/cnr/textdraws.pwn index e695019..89a4344 100644 --- a/gamemodes/irresistible/cnr/textdraws.pwn +++ b/gamemodes/irresistible/cnr/textdraws.pwn @@ -36,16 +36,9 @@ new Text: g_NotManyPlayersTD = Text: INVALID_TEXT_DRAW, // Server Player Textdraws (Needs Converting) - Text: p_TrackPlayerTD [ MAX_PLAYERS ] = { Text: INVALID_TEXT_DRAW, ... }, - Text: p_FireDistance1 [ MAX_PLAYERS ] = { Text: INVALID_TEXT_DRAW, ... }, - Text: p_FireDistance2 [ MAX_PLAYERS ] = { Text: INVALID_TEXT_DRAW, ... }, - Text: p_AchievementTD [ MAX_PLAYERS ] = { Text: INVALID_TEXT_DRAW, ... }, - Text: p_GPSInformation [ MAX_PLAYERS ] = { Text: INVALID_TEXT_DRAW, ... }, Text: p_ProgressBoxOutsideTD [ MAX_PLAYERS ] = { Text: INVALID_TEXT_DRAW, ... }, Text: p_ProgressBoxTD [ MAX_PLAYERS ] = { Text: INVALID_TEXT_DRAW, ... }, Text: p_ProgressTitleTD [ MAX_PLAYERS ] = { Text: INVALID_TEXT_DRAW, ... }, - Text: p_HelpBoxTD [ MAX_PLAYERS ] = { Text: INVALID_TEXT_DRAW, ... }, - Text: p_TruckingTD [ MAX_PLAYERS ] = { Text: INVALID_TEXT_DRAW, ... }, // Player Textdraws PlayerText: p_LocationTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, @@ -60,6 +53,13 @@ new 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, ... }, + PlayerText: p_TruckingTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, + PlayerText: p_TrackPlayerTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, + PlayerText: p_GPSInformation [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, + PlayerText: p_AchievementTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, + PlayerText: p_FireDistance1 [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, + PlayerText: p_FireDistance2 [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, PlayerText: p_VehiclePreviewTD [ 7 ] = { PlayerText: INVALID_TEXT_DRAW, ... } ; @@ -458,72 +458,6 @@ hook OnScriptInit( ) TextDrawColor(p_ProgressTitleTD[ playerid ], -1); TextDrawSetOutline(p_ProgressTitleTD[ playerid ], 1); TextDrawSetProportional(p_ProgressTitleTD[ playerid ], 1); - - p_AchievementTD[ playerid ] = TextDrawCreate(325.000000, 137.000000, "_"); - TextDrawAlignment(p_AchievementTD[ playerid ], 2); - TextDrawBackgroundColor(p_AchievementTD[ playerid ], 80); - TextDrawFont(p_AchievementTD[ playerid ], 1); - TextDrawLetterSize(p_AchievementTD[ playerid ], 0.209999, 1.000000); - TextDrawColor(p_AchievementTD[ playerid ], -1); - TextDrawSetOutline(p_AchievementTD[ playerid ], 1); - TextDrawSetProportional(p_AchievementTD[ playerid ], 1); - - p_FireDistance1[ playerid ] = TextDrawCreate(26.000000, 182.000000, "_"); - TextDrawBackgroundColor(p_FireDistance1[ playerid ], 255); - TextDrawFont(p_FireDistance1[ playerid ], 2); - TextDrawLetterSize(p_FireDistance1[ playerid ], 0.210000, 1.200000); - TextDrawColor(p_FireDistance1[ playerid ], -1); - TextDrawSetOutline(p_FireDistance1[ playerid ], 1); - TextDrawSetProportional(p_FireDistance1[ playerid ], 1); - - p_FireDistance2[ playerid ] = TextDrawCreate(26.000000, 236.000000, "_"); - TextDrawBackgroundColor(p_FireDistance2[ playerid ], 255); - TextDrawFont(p_FireDistance2[ playerid ], 2); - TextDrawLetterSize(p_FireDistance2[ playerid ], 0.209999, 1.200000); - TextDrawColor(p_FireDistance2[ playerid ], -1); - TextDrawSetOutline(p_FireDistance2[ playerid ], 1); - TextDrawSetProportional(p_FireDistance2[ playerid ], 1); - - p_GPSInformation[ playerid ] = TextDrawCreate(26.000000, 200.000000, "~g~Location:~w~ No-where~n~~g~Distance:~w~ 0.0m"); - TextDrawBackgroundColor(p_GPSInformation[ playerid ], 255); - TextDrawFont(p_GPSInformation[ playerid ], 2); - TextDrawLetterSize(p_GPSInformation[ playerid ], 0.209999, 1.099999); - TextDrawColor(p_GPSInformation[ playerid ], -1); - TextDrawSetOutline(p_GPSInformation[ playerid ], 1); - TextDrawSetProportional(p_GPSInformation[ playerid ], 1); - TextDrawSetSelectable(p_GPSInformation[ playerid ], 0); - - p_TruckingTD[ playerid ] = TextDrawCreate(26.000000, 220.000000, "~b~Location:~w~ No-where~n~~b~Distance:~w~ 0.0m"); - TextDrawBackgroundColor(p_TruckingTD[ playerid ], 255); - TextDrawFont(p_TruckingTD[ playerid ], 2); - TextDrawLetterSize(p_TruckingTD[ playerid ], 0.210000, 1.100000); - TextDrawColor(p_TruckingTD[ playerid ], -1); - TextDrawSetOutline(p_TruckingTD[ playerid ], 1); - TextDrawSetProportional(p_TruckingTD[ playerid ], 1); - TextDrawSetSelectable(p_TruckingTD[ playerid ], 0); - - p_TrackPlayerTD[ playerid ] = TextDrawCreate(571.000000, 258.000000, "Loading~n~~w~NaN.0m"); - TextDrawAlignment(p_TrackPlayerTD[ playerid ], 2); - TextDrawBackgroundColor(p_TrackPlayerTD[ playerid ], 80); - TextDrawFont(p_TrackPlayerTD[ playerid ], 1); - TextDrawLetterSize(p_TrackPlayerTD[ playerid ], 0.260000, 1.100000); - TextDrawColor(p_TrackPlayerTD[ playerid ], COLOR_RED); - TextDrawSetOutline(p_TrackPlayerTD[ playerid ], 1); - TextDrawSetProportional(p_TrackPlayerTD[ playerid ], 1); - TextDrawSetSelectable(p_TrackPlayerTD[ playerid ], 0); - - p_HelpBoxTD[ playerid ] = TextDrawCreate(30.000000, 161.000000, "... Loading Help ..."); - TextDrawBackgroundColor(p_HelpBoxTD[ playerid ], 255); - TextDrawFont(p_HelpBoxTD[ playerid ], 1); - TextDrawLetterSize(p_HelpBoxTD[ playerid ], 0.219999, 1.200000); - TextDrawColor(p_HelpBoxTD[ playerid ], -1); - TextDrawSetOutline(p_HelpBoxTD[ playerid ], 0); - TextDrawSetProportional(p_HelpBoxTD[ playerid ], 1); - TextDrawSetShadow(p_HelpBoxTD[ playerid ], 1); - TextDrawUseBox(p_HelpBoxTD[ playerid ], 1); - TextDrawBoxColor(p_HelpBoxTD[ playerid ], 117); - TextDrawTextSize(p_HelpBoxTD[ playerid ], 170.000000, 0.000000); - TextDrawSetSelectable(p_HelpBoxTD[ playerid ], 0); } return Y_HOOKS_CONTINUE_RETURN_1; } @@ -533,6 +467,52 @@ hook OnPlayerConnect( playerid ) if ( ! ( 0 <= playerid < MAX_PLAYERS ) ) return Y_HOOKS_CONTINUE_RETURN_1; + p_AchievementTD[ playerid ] = CreatePlayerTextDraw(playerid, 325.000000, 137.000000, "_"); + PlayerTextDrawAlignment(playerid, p_AchievementTD[ playerid ], 2); + PlayerTextDrawBackgroundColor(playerid, p_AchievementTD[ playerid ], 80); + PlayerTextDrawFont(playerid, p_AchievementTD[ playerid ], 1); + PlayerTextDrawLetterSize(playerid, p_AchievementTD[ playerid ], 0.209999, 1.000000); + PlayerTextDrawColor(playerid, p_AchievementTD[ playerid ], -1); + PlayerTextDrawSetOutline(playerid, p_AchievementTD[ playerid ], 1); + PlayerTextDrawSetProportional(playerid, p_AchievementTD[ playerid ], 1); + + p_GPSInformation[ playerid ] = CreatePlayerTextDraw(playerid, 26.000000, 200.000000, "~g~Location:~w~ No-where~n~~g~Distance:~w~ 0.0m"); + PlayerTextDrawBackgroundColor(playerid, p_GPSInformation[ playerid ], 255); + PlayerTextDrawFont(playerid, p_GPSInformation[ playerid ], 2); + PlayerTextDrawLetterSize(playerid, p_GPSInformation[ playerid ], 0.209999, 1.099999); + PlayerTextDrawColor(playerid, p_GPSInformation[ playerid ], -1); + PlayerTextDrawSetOutline(playerid, p_GPSInformation[ playerid ], 1); + PlayerTextDrawSetProportional(playerid, p_GPSInformation[ playerid ], 1); + + p_TrackPlayerTD[ playerid ] = CreatePlayerTextDraw(playerid, 571.000000, 258.000000, "Loading~n~~w~NaN.0m"); + PlayerTextDrawAlignment(playerid, p_TrackPlayerTD[ playerid ], 2); + PlayerTextDrawBackgroundColor(playerid, p_TrackPlayerTD[ playerid ], 80); + PlayerTextDrawFont(playerid, p_TrackPlayerTD[ playerid ], 1); + PlayerTextDrawLetterSize(playerid, p_TrackPlayerTD[ playerid ], 0.260000, 1.100000); + PlayerTextDrawColor(playerid, p_TrackPlayerTD[ playerid ], COLOR_RED); + PlayerTextDrawSetOutline(playerid, p_TrackPlayerTD[ playerid ], 1); + PlayerTextDrawSetProportional(playerid, p_TrackPlayerTD[ playerid ], 1); + + p_TruckingTD[ playerid ] = CreatePlayerTextDraw(playerid, 26.000000, 220.000000, "~b~Location:~w~ No-where~n~~b~Distance:~w~ 0.0m"); + PlayerTextDrawBackgroundColor(playerid, p_TruckingTD[ playerid ], 255); + PlayerTextDrawFont(playerid, p_TruckingTD[ playerid ], 2); + PlayerTextDrawLetterSize(playerid, p_TruckingTD[ playerid ], 0.210000, 1.100000); + PlayerTextDrawColor(playerid, p_TruckingTD[ playerid ], -1); + PlayerTextDrawSetOutline(playerid, p_TruckingTD[ playerid ], 1); + PlayerTextDrawSetProportional(playerid, p_TruckingTD[ playerid ], 1); + + p_HelpBoxTD[ playerid ] = CreatePlayerTextDraw(playerid, 30.000000, 161.000000, "... Loading Help ..."); + PlayerTextDrawBackgroundColor(playerid, p_HelpBoxTD[ playerid ], 255); + PlayerTextDrawFont(playerid, p_HelpBoxTD[ playerid ], 1); + PlayerTextDrawLetterSize(playerid, p_HelpBoxTD[ playerid ], 0.219999, 1.200000); + PlayerTextDrawColor(playerid, p_HelpBoxTD[ playerid ], -1); + PlayerTextDrawSetOutline(playerid, p_HelpBoxTD[ playerid ], 0); + PlayerTextDrawSetProportional(playerid, p_HelpBoxTD[ playerid ], 1); + PlayerTextDrawSetShadow(playerid, p_HelpBoxTD[ playerid ], 1); + PlayerTextDrawUseBox(playerid, p_HelpBoxTD[ playerid ], 1); + PlayerTextDrawBoxColor(playerid, p_HelpBoxTD[ playerid ], 117); + PlayerTextDrawTextSize(playerid, p_HelpBoxTD[ playerid ], 170.000000, 0.000000); + g_ZoneOwnerTD[ playerid ] = CreatePlayerTextDraw( playerid, 86.000000, 296.000000, "_" ); PlayerTextDrawAlignment( playerid, g_ZoneOwnerTD[ playerid ], 2 ); PlayerTextDrawBackgroundColor( playerid, g_ZoneOwnerTD[ playerid ], 255 ); @@ -644,5 +624,52 @@ hook OnPlayerConnect( playerid ) PlayerTextDrawSetOutline(playerid, p_RobberyAmountTD[ playerid ], 1); PlayerTextDrawSetProportional(playerid, p_RobberyAmountTD[ playerid ], 1); PlayerTextDrawSetSelectable(playerid, p_RobberyAmountTD[ playerid ], 0); + + p_FireDistance1[ playerid ] = CreatePlayerTextDraw(playerid, 26.000000, 182.000000, "_"); + PlayerTextDrawBackgroundColor(playerid, p_FireDistance1[ playerid ], 255); + PlayerTextDrawFont(playerid, p_FireDistance1[ playerid ], 2); + PlayerTextDrawLetterSize(playerid, p_FireDistance1[ playerid ], 0.210000, 1.200000); + PlayerTextDrawColor(playerid, p_FireDistance1[ playerid ], -1); + PlayerTextDrawSetOutline(playerid, p_FireDistance1[ playerid ], 1); + PlayerTextDrawSetProportional(playerid, p_FireDistance1[ playerid ], 1); + + p_FireDistance2[ playerid ] = CreatePlayerTextDraw(playerid, 26.000000, 236.000000, "_"); + PlayerTextDrawBackgroundColor(playerid, p_FireDistance2[ playerid ], 255); + PlayerTextDrawFont(playerid, p_FireDistance2[ playerid ], 2); + PlayerTextDrawLetterSize(playerid, p_FireDistance2[ playerid ], 0.209999, 1.200000); + PlayerTextDrawColor(playerid, p_FireDistance2[ playerid ], -1); + PlayerTextDrawSetOutline(playerid, p_FireDistance2[ playerid ], 1); + PlayerTextDrawSetProportional(playerid, p_FireDistance2[ playerid ], 1); return Y_HOOKS_CONTINUE_RETURN_1; } + +/* ** Hooked Functions ** */ +/*stock Text: TD_TextDrawCreate( Float: x, Float: y, text[ ] ) +{ + static count; + printf("%d", ++count); + return TextDrawCreate( x, y, text ); +} + +#if defined _ALS_TextDrawCreate + #undef TextDrawCreate +#else + #define _ALS_TextDrawCreate +#endif + +#define TextDrawCreate TD_TextDrawCreate*/ + +/*stock PlayerText: TD_CreatePlayerTextDraw( playerid, Float: x, Float: y, text[ ] ) +{ + static count; + printf("%d", ++count); + return CreatePlayerTextDraw( playerid, x, y, text ); +} + +#if defined _ALS_CreatePlayerTextDraw + #undef CreatePlayerTextDraw +#else + #define _ALS_CreatePlayerTextDraw +#endif + +#define CreatePlayerTextDraw TD_CreatePlayerTextDraw*/ diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 3b8b4e2..680a191 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -13,7 +13,7 @@ */ #pragma compat 1 -//#pragma option -d3 +#pragma option -d3 #pragma dynamic 7200000 #define DEBUG_MODE @@ -3725,9 +3725,9 @@ public OnServerUpdateTimer( ) if ( IsPlayerInRangeOfPoint( playerid, 10.0, g_gpsData[ id ] [ E_X ], g_gpsData[ id ] [ E_Y ], g_gpsData[ id ] [ E_Z ] ) ) { - TextDrawHideForPlayer ( playerid, p_GPSInformation[ playerid ] ); - DestroyDynamicObject ( p_GPSObject[ playerid ] ); - KillTimer ( p_GPSTimer[ playerid ] ); + PlayerTextDrawHide( playerid, p_GPSInformation[ playerid ] ); + DestroyDynamicObject( p_GPSObject[ playerid ] ); + KillTimer( p_GPSTimer[ playerid ] ); p_GPSLocation [ playerid ] = 0; p_GPSToggled { playerid } = false; @@ -4273,7 +4273,7 @@ public OnPlayerRequestClass( playerid, classid ) PlayerTextDrawHide( playerid, p_PlayerRankTextTD[ playerid ] ); KillTimer( p_TrackingTimer[ playerid ] ); p_TrackingTimer[ playerid ] = -1; - TextDrawHideForPlayer( playerid, p_TrackPlayerTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_TrackPlayerTD[ playerid ] ); PlayerTextDrawHide( playerid, p_ExperienceTD[ playerid ] ); HidePlayerTogglableTextdraws( playerid ); TextDrawHideForPlayer( playerid, g_CurrentRankTD ); @@ -4281,8 +4281,8 @@ public OnPlayerRequestClass( playerid, classid ) TextDrawHideForPlayer( playerid, g_DoubleXPTD ); KillTimer( p_FireDistanceTimer[ playerid ] ); p_FireDistanceTimer[ playerid ] = 0xFF; - TextDrawHideForPlayer( playerid, p_FireDistance1[ playerid ] ); - TextDrawHideForPlayer( playerid, p_FireDistance2[ playerid ] ); + PlayerTextDrawHide( playerid, p_FireDistance1[ playerid ] ); + PlayerTextDrawHide( playerid, p_FireDistance2[ playerid ] ); p_MoneyBag{ playerid } = false; RemovePlayerAttachedObject( playerid, 1 ); @@ -5841,14 +5841,14 @@ public OnPlayerDeath( playerid, killerid, reason ) p_TrackingTimer[ playerid ] = -1; p_GPSLocation [ playerid ] = 0; p_GPSToggled { playerid } = false; - TextDrawHideForPlayer( playerid, p_GPSInformation[ playerid ] ); + PlayerTextDrawHide( playerid, p_GPSInformation[ playerid ] ); DestroyDynamicObject( p_GPSObject[ playerid ] ); KillTimer( p_GPSTimer[ playerid ] ); DeletePVar( playerid, "AlcatrazWantedCD" ); DeletePVar( playerid, "ShotCopWantedCD" ); p_GPSTimer[ playerid ] = 0xFF; p_GPSObject[ playerid ] = INVALID_OBJECT_ID; - TextDrawHideForPlayer( playerid, p_TrackPlayerTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_TrackPlayerTD[ playerid ] ); PlayerTextDrawHide( playerid, p_ExperienceTD[ playerid ] ); TextDrawHideForPlayer( playerid, g_WebsiteTD ); PlayerTextDrawHide( playerid, p_WantedLevelTD[ playerid ] ); @@ -6483,10 +6483,10 @@ function OnPlayerFireDistanceUpdate( playerid ) else format( szFire2, sizeof( szFire2 ), "%s~r~FIRE %d:%s~w~ %0.0f m~n~", szFire2, i,i==1?("_"):(""), dis ); } } - TextDrawSetString( p_FireDistance1[ playerid ], szFire1 ); - TextDrawSetString( p_FireDistance2[ playerid ], szFire2 ); - TextDrawShowForPlayer( playerid, p_FireDistance1[ playerid ] ); - TextDrawShowForPlayer( playerid, p_FireDistance2[ playerid ] ); + PlayerTextDrawSetString( playerid, p_FireDistance1[ playerid ], szFire1 ); + PlayerTextDrawSetString( playerid, p_FireDistance2[ playerid ], szFire2 ); + PlayerTextDrawShow( playerid, p_FireDistance1[ playerid ] ); + PlayerTextDrawShow( playerid, p_FireDistance2[ playerid ] ); return 1; } @@ -9605,8 +9605,8 @@ CMD:rfiretracker( playerid, params[ ] ) { KillTimer( p_FireDistanceTimer[ playerid ] ); p_FireDistanceTimer[ playerid ] = 0xFF; - TextDrawHideForPlayer( playerid, p_FireDistance1[ playerid ] ); - TextDrawHideForPlayer( playerid, p_FireDistance2[ playerid ] ); + PlayerTextDrawHide( playerid, p_FireDistance1[ playerid ] ); + PlayerTextDrawHide( playerid, p_FireDistance2[ playerid ] ); SendServerMessage( playerid, "You have turned off your fire tracker." ); return 1; } @@ -9669,7 +9669,7 @@ CMD:gps( playerid, params[ ] ) KillTimer( p_GPSTimer[ playerid ] ); p_GPSTimer[ playerid ] = 0xFF; p_GPSObject[ playerid ] = INVALID_OBJECT_ID; - TextDrawHideForPlayer( playerid, p_GPSInformation[ playerid ] ); + PlayerTextDrawHide( playerid, p_GPSInformation[ playerid ] ); return SendServerMessage( playerid, "You have de-activated your GPS." ), 1; } else @@ -11173,7 +11173,7 @@ CMD:hidetracker( playerid, params[ ] ) SendServerMessage(playerid, "You have de-activated the tracker."); KillTimer( p_TrackingTimer[ playerid ] ); p_TrackingTimer[ playerid ] = -1; - TextDrawHideForPlayer( playerid, p_TrackPlayerTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_TrackPlayerTD[ playerid ] ); return 1; } @@ -11194,7 +11194,7 @@ CMD:track( playerid, params[ ] ) { KillTimer( p_TrackingTimer[ playerid ] ); p_TrackingTimer[ playerid ] = SetTimerEx( "TrackPlayer_timer", 1000, true, "dd", playerid, pID ); - TextDrawShowForPlayer( playerid, p_TrackPlayerTD[ playerid ] ); + PlayerTextDrawShow( playerid, p_TrackPlayerTD[ playerid ] ); SendServerMessage( playerid, "You have activated the tracker, you can hide it with /hidetracker." ); } return 1; @@ -11205,7 +11205,7 @@ function TrackPlayer_timer( playerid, victimid ) if ( !IsPlayerConnected( victimid ) || p_AdminOnDuty{ victimid } == true || GetPlayerState( victimid ) == PLAYER_STATE_SPECTATING || !JobEquals( playerid, JOB_HITMAN ) || p_Class[ playerid ] != CLASS_CIVILIAN ) { KillTimer( p_TrackingTimer[ playerid ] ), p_TrackingTimer[ playerid ] = -1; - TextDrawHideForPlayer( playerid, p_TrackPlayerTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_TrackPlayerTD[ playerid ] ); } else { @@ -11236,7 +11236,7 @@ function TrackPlayer_timer( playerid, victimid ) if ( !fDistance || fDistance > 9999.9 ) fDistance = 9999.9; - TextDrawSetString( p_TrackPlayerTD[ playerid ], fDistance != 9999.0 ? sprintf( "%s~n~~w~%0.1fm", ReturnPlayerName( victimid ), fDistance ) : sprintf( "%s~n~~w~unknown", ReturnPlayerName( victimid ) ) ); + PlayerTextDrawSetString( playerid, p_TrackPlayerTD[ playerid ], fDistance != 9999.0 ? sprintf( "%s~n~~w~%0.1fm", ReturnPlayerName( victimid ), fDistance ) : sprintf( "%s~n~~w~unknown", ReturnPlayerName( victimid ) ) ); } } @@ -16665,7 +16665,7 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) p_GPSToggled{ playerid } = true; SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GPS]"COL_WHITE" You have set your destination to %s. Follow the arrow to reach your destination.", g_gpsData[ i ] [ E_NAME ] ); - TextDrawShowForPlayer( playerid, p_GPSInformation[ playerid ] ); + PlayerTextDrawShow( playerid, p_GPSInformation[ playerid ] ); break; } x++; @@ -19937,7 +19937,7 @@ function gps_Update( playerid ) KillTimer( p_GPSTimer[ playerid ] ); p_GPSTimer[ playerid ] = 0xFF; p_GPSObject[ playerid ] = INVALID_OBJECT_ID; - TextDrawHideForPlayer( playerid, p_GPSInformation[ playerid ] ); + PlayerTextDrawHide( playerid, p_GPSInformation[ playerid ] ); SendServerMessage( playerid, "You have de-activated your GPS." ); return 0; } @@ -19948,7 +19948,7 @@ function gps_Update( playerid ) ; pos = GetPlayerDistanceFromPoint( playerid, g_gpsData[ p_GPSLocation[ playerid ] ] [ E_X ], g_gpsData[ p_GPSLocation[ playerid ] ] [ E_Y ], g_gpsData[ p_GPSLocation[ playerid ] ] [ E_Z ]); format( string, sizeof( string ), "~g~Location:~w~ %s~n~~g~Distance:~w~ %0.2fm", g_gpsData[ p_GPSLocation[ playerid ] ] [ E_NAME ], pos ); - TextDrawSetString( p_GPSInformation[ playerid ], string ); + PlayerTextDrawSetString( playerid, p_GPSInformation[ playerid ], string ); v = GetPlayerVehicleID( playerid ); GetVehiclePos( v, X, Y, Z ); GetVehicleZAngle( v, fAZ ); @@ -23174,8 +23174,8 @@ stock ShowAchievement( playerid, achievement[ ], score = -1 ) } KillTimer( p_AchievementTimer[ playerid ] ); p_AchievementTimer[ playerid ] = 0xFF; - TextDrawSetString( p_AchievementTD[ playerid ], achievement ); - TextDrawShowForPlayer( playerid, p_AchievementTD[ playerid ] ); + PlayerTextDrawSetString( playerid, p_AchievementTD[ playerid ], achievement ); + PlayerTextDrawShow( playerid, p_AchievementTD[ playerid ] ); TextDrawShowForPlayer( playerid, g_AchievementTD[ 0 ] ); TextDrawShowForPlayer( playerid, g_AchievementTD[ 1 ] ); TextDrawShowForPlayer( playerid, g_AchievementTD[ 2 ] ); @@ -23185,7 +23185,7 @@ stock ShowAchievement( playerid, achievement[ ], score = -1 ) } function Achievement_Hide( playerid ) { - TextDrawHideForPlayer( playerid, p_AchievementTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_AchievementTD[ playerid ] ); TextDrawHideForPlayer( playerid, g_AchievementTD[ 0 ] ); TextDrawHideForPlayer( playerid, g_AchievementTD[ 1 ] ); TextDrawHideForPlayer( playerid, g_AchievementTD[ 2 ] ); @@ -24108,8 +24108,8 @@ stock ShowPlayerHelpDialog( playerid, timeout, format[ ], va_args<> ) va_format( out, sizeof( out ), format, va_start<3> ); - TextDrawSetString( p_HelpBoxTD[ playerid ], out ); - TextDrawShowForPlayer( playerid, p_HelpBoxTD[ playerid ] ); + PlayerTextDrawSetString( playerid, p_HelpBoxTD[ playerid ], out ); + PlayerTextDrawShow( playerid, p_HelpBoxTD[ playerid ] ); KillTimer( p_HideHelpDialogTimer[ playerid ] ); @@ -24122,7 +24122,7 @@ stock ShowPlayerHelpDialog( playerid, timeout, format[ ], va_args<> ) function HidePlayerHelpDialog( playerid ) { p_HideHelpDialogTimer[ playerid ] = 0xFFFF; - TextDrawHideForPlayer( playerid, p_HelpBoxTD[ playerid ] ); + PlayerTextDrawHide( playerid, p_HelpBoxTD[ playerid ] ); } stock fix_NightThermalVisionHack( playerid ) // Created by wups diff --git a/scriptfiles/updates.txt b/scriptfiles/updates.txt index 1f76fd0..ec12c87 100644 --- a/scriptfiles/updates.txt +++ b/scriptfiles/updates.txt @@ -1,4 +1,5 @@ (+) Adds pool system minigame, like in singleplayer. +(+) Adds pilot minijob, accessible using pilot in specific plane models. (+) Adds "/p" to be able to chat inside the paintball lobby (+) Adds "/b production" to see what the status of your business production is. (+) Adds "/reconnectchuff" for level 5 administrators. \ No newline at end of file