addressed mmb for arresting issue

pilot missions are added into achievements and saves in sql
This commit is contained in:
Steven Howard 2018-10-09 09:53:55 +01:00
parent 7f4a463235
commit 590da61131
3 changed files with 38 additions and 5 deletions

View File

@ -5,6 +5,12 @@
* Purpose: pilot minijob - cargo pickup and transport to another airport. * Purpose: pilot minijob - cargo pickup and transport to another airport.
*/ */
/*
sql structure: ALTER TABLE `users` ADD `PILOT` INT NULL DEFAULT NULL AFTER `TRUCKED`;
*/
/* ** Includes ** */ /* ** Includes ** */
#include < YSI\y_hooks > #include < YSI\y_hooks >
@ -173,6 +179,8 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid )
GivePlayerWantedLevel( playerid, 6 ); GivePlayerWantedLevel( playerid, 6 );
} }
ach_HandlePilotMissions( playerid );
GivePlayerScore( playerid, 1 + floatround( p_PilotDistance[ playerid ] / 1000.0 ) ); GivePlayerScore( playerid, 1 + floatround( p_PilotDistance[ playerid ] / 1000.0 ) );
GivePlayerCash( playerid, cash_earned ); GivePlayerCash( playerid, cash_earned );

View File

@ -209,6 +209,7 @@ new
p_WorkCooldown [ MAX_PLAYERS ], p_WorkCooldown [ MAX_PLAYERS ],
p_AntiSpammyTS [ MAX_PLAYERS ], p_AntiSpammyTS [ MAX_PLAYERS ],
p_TruckedCargo [ MAX_PLAYERS ], p_TruckedCargo [ MAX_PLAYERS ],
p_PilotMissions [ MAX_PLAYERS ],
p_KidnapImmunity [ MAX_PLAYERS ], p_KidnapImmunity [ MAX_PLAYERS ],
p_GangSplitProfits [ MAX_PLAYERS ], p_GangSplitProfits [ MAX_PLAYERS ],
Float: p_IrresistiblePoints [ MAX_PLAYERS ], Float: p_IrresistiblePoints [ MAX_PLAYERS ],

View File

@ -2725,6 +2725,7 @@ public OnPlayerDisconnect( playerid, reason )
p_IrresistiblePoints[ playerid ] = 0.0; p_IrresistiblePoints[ playerid ] = 0.0;
p_AntiExportCarSpam[ playerid ] = 0; p_AntiExportCarSpam[ playerid ] = 0;
p_TruckedCargo[ playerid ] = 0; p_TruckedCargo[ playerid ] = 0;
p_PilotMissions[ playerid ] = 0;
p_HydrogenChloride{ playerid } = 0; p_HydrogenChloride{ playerid } = 0;
p_Methamphetamine{ playerid } = 0; p_Methamphetamine{ playerid } = 0;
p_IsCasinoHighRoller{ playerid } = false; p_IsCasinoHighRoller{ playerid } = false;
@ -11363,7 +11364,7 @@ public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
// taze mechanism // taze mechanism
else if ( PRESSED( KEY_LOOK_BEHIND ) ) else if ( PRESSED( KEY_LOOK_BEHIND ) )
{ {
if ( p_Class[ playerid ] == CLASS_POLICE && p_AntiSpawnKillEnabled{ playerid }) if ( p_Class[ playerid ] == CLASS_POLICE && p_AntiSpawnKillEnabled{ playerid } )
{ {
new new
closestid = GetClosestPlayer( playerid ); closestid = GetClosestPlayer( playerid );
@ -11644,6 +11645,7 @@ thread OnAttemptPlayerLogin( playerid, password[ ] )
p_PingImmunity{ playerid } = cache_get_field_content_int( 0, "PING_IMMUNE", dbHandle ); p_PingImmunity{ playerid } = cache_get_field_content_int( 0, "PING_IMMUNE", dbHandle );
p_HitsComplete[ playerid ] = cache_get_field_content_int( 0, "CONTRACTS", dbHandle ); p_HitsComplete[ playerid ] = cache_get_field_content_int( 0, "CONTRACTS", dbHandle );
p_TruckedCargo[ playerid ] = cache_get_field_content_int( 0, "TRUCKED", dbHandle ); p_TruckedCargo[ playerid ] = cache_get_field_content_int( 0, "TRUCKED", dbHandle );
p_PilotMissions[ playerid ] = cache_get_field_content_int( 0, "PILOT", dbHandle );
//p_CopTutorial{ playerid } = cache_get_field_content_int( 0, "COP_TUTORIAL", dbHandle ); //p_CopTutorial{ playerid } = cache_get_field_content_int( 0, "COP_TUTORIAL", dbHandle );
p_Job{ playerid } = cache_get_field_content_int( 0, "JOB", dbHandle ); p_Job{ playerid } = cache_get_field_content_int( 0, "JOB", dbHandle );
p_VIPJob{ playerid } = cache_get_field_content_int( 0, "VIP_JOB", dbHandle ); p_VIPJob{ playerid } = cache_get_field_content_int( 0, "VIP_JOB", dbHandle );
@ -13037,8 +13039,9 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
""COL_GREY"Total Bank Raids:{FFFFFF} %d\n"\ ""COL_GREY"Total Bank Raids:{FFFFFF} %d\n"\
""COL_GREY"Total Cars Jacked:{FFFFFF} %d\n"\ ""COL_GREY"Total Cars Jacked:{FFFFFF} %d\n"\
""COL_GREY"Total Trucked Cargo:{FFFFFF} %d\n"\ ""COL_GREY"Total Trucked Cargo:{FFFFFF} %d\n"\
""COL_GREY"Total Meth Yielded:{FFFFFF} %d", ""COL_GREY"Total Meth Yielded:{FFFFFF} %d\n"\
szLargeString, p_JailsBlown[ pID ], p_BankBlown[ pID ], p_CarsJacked[ pID ], p_TruckedCargo[ pID ], p_MethYielded[ pID ] ); ""COL_GREY"Total Pilot Missions:{FFFFFF} %d",
szLargeString, p_JailsBlown[ pID ], p_BankBlown[ pID ], p_CarsJacked[ pID ], p_TruckedCargo[ pID ], p_MethYielded[ pID ], p_PilotMissions[ pID ] );
ShowPlayerDialog( playerid, DIALOG_STATS_REDIRECT, DIALOG_STYLE_MSGBOX, "{FFFFFF}Main Statistics", szLargeString, "Okay", "Back" ); ShowPlayerDialog( playerid, DIALOG_STATS_REDIRECT, DIALOG_STYLE_MSGBOX, "{FFFFFF}Main Statistics", szLargeString, "Okay", "Back" );
} }
@ -14792,13 +14795,14 @@ stock SavePlayerData( playerid, bool: logout = false )
p_ContractedAmount[ playerid ], p_WeedGrams[ playerid ], logout ? ( bQuitToAvoid ? 1 : 0 ) : 0, p_ContractedAmount[ playerid ], p_WeedGrams[ playerid ], logout ? ( bQuitToAvoid ? 1 : 0 ) : 0,
p_drillStrength[ playerid ] ); p_drillStrength[ playerid ] );
format( Query, sizeof( Query ), "%s`BLEW_JAILS`=%d,`BLEW_VAULT`=%d,`VEHICLES_JACKED`=%d,`METH_YIELDED`=%d,`LAST_IP`='%s',`VIP_JOB`=%d,`TRUCKED`=%d,`COINS`=%f,`EXPLOSIVE_BULLETS`=%d,`RANK`=%f,`ONLINE`=%d,`HIT_SOUND`=%d,`EXTRA_SLOTS`=%d WHERE `ID`=%d", format( Query, sizeof( Query ), "%s`BLEW_JAILS`=%d,`BLEW_VAULT`=%d,`VEHICLES_JACKED`=%d,`METH_YIELDED`=%d,`LAST_IP`='%s',`VIP_JOB`=%d,`TRUCKED`=%d,`COINS`=%f,`EXPLOSIVE_BULLETS`=%d,`RANK`=%f,`ONLINE`=%d,`HIT_SOUND`=%d,`EXTRA_SLOTS`=%d,`PILOT`=%d WHERE `ID`=%d",
Query, Query,
p_JailsBlown[ playerid ], p_BankBlown[ playerid ], p_CarsJacked[ playerid ], p_JailsBlown[ playerid ], p_BankBlown[ playerid ], p_CarsJacked[ playerid ],
p_MethYielded[ playerid ], mysql_escape( ReturnPlayerIP( playerid ) ), p_MethYielded[ playerid ], mysql_escape( ReturnPlayerIP( playerid ) ),
p_VIPJob{ playerid }, p_TruckedCargo[ playerid ], p_IrresistibleCoins[ playerid ], p_VIPJob{ playerid }, p_TruckedCargo[ playerid ], p_IrresistibleCoins[ playerid ],
p_ExplosiveBullets[ playerid ], p_IrresistiblePoints[ playerid ], p_ExplosiveBullets[ playerid ], p_IrresistiblePoints[ playerid ],
!logout, p_HitmarkerSound{ playerid }, p_ExtraAssetSlots{ playerid }, !logout, p_HitmarkerSound{ playerid }, p_ExtraAssetSlots{ playerid },
p_PilotMissions[ playerid ],
p_AccountID[ playerid ] ); p_AccountID[ playerid ] );
mysql_single_query( Query ); mysql_single_query( Query );
@ -18109,6 +18113,20 @@ stock Achievement::HandleTruckingCouriers( playerid )
} }
} }
stock Achievement::HandlePilotMissions( playerid )
{
switch( ++p_PilotMissions[ playerid ])
{
case 5: ShowAchievement( playerid, "Completed ~r~5~w~~h~~h~ pilot missions!", 3 );
case 20: ShowAchievement( playerid, "Completed ~r~20~w~~h~~h~ pilot missions!", 6 );
case 50: ShowAchievement( playerid, "Completed ~r~50~w~~h~~h~ pilot missions!", 9 );
case 100: ShowAchievement( playerid, "Completed ~r~100~w~~h~~h~ pilot missions!", 12 );
case 200: ShowAchievement( playerid, "Completed ~r~200~w~~h~~h~ pilot missions!", 15 );
case 500: ShowAchievement( playerid, "Completed ~r~500~w~~h~~h~ pilot missions!", 18 );
case 1000: ShowAchievement( playerid, "Completed ~r~1000~w~~h~~h~ pilot missions!", 25 );
}
}
thread readplayernotes( playerid ) thread readplayernotes( playerid )
{ {
new new
@ -18338,7 +18356,7 @@ thread OnShowWeaponStats( playerid, dialogid, back_option, forid )
stock displayAchievements( playerid, dialogid = DIALOG_NULL, szSecondButton[ ] = "", forid = INVALID_PLAYER_ID ) stock displayAchievements( playerid, dialogid = DIALOG_NULL, szSecondButton[ ] = "", forid = INVALID_PLAYER_ID )
{ {
static static
szAchievements[ 1300 ]; szAchievements[ 1500 ];
format( szAchievements, sizeof( szAchievements ), format( szAchievements, sizeof( szAchievements ),
""COL_GREY"Played For\t\t\t%s10m\t%s1h\t%s5h\t%s10h\t%s15h\t%s20h\t%s1d\n", ""COL_GREY"Played For\t\t\t%s10m\t%s1h\t%s5h\t%s10h\t%s15h\t%s20h\t%s1d\n",
@ -18414,6 +18432,12 @@ stock displayAchievements( playerid, dialogid = DIALOG_NULL, szSecondButton[ ] =
Ach_Unlock( p_TruckedCargo[ playerid ], 100 ), Ach_Unlock( p_TruckedCargo[ playerid ], 200 ), Ach_Unlock( p_TruckedCargo[ playerid ], 500 ), Ach_Unlock( p_TruckedCargo[ playerid ], 100 ), Ach_Unlock( p_TruckedCargo[ playerid ], 200 ), Ach_Unlock( p_TruckedCargo[ playerid ], 500 ),
Ach_Unlock( p_TruckedCargo[ playerid ], 1000 ) Ach_Unlock( p_TruckedCargo[ playerid ], 1000 )
); );
format( szAchievements, sizeof( szAchievements ),
"%s"COL_GREY"Total Pilot Missions\t\t%s5\t%s20\t%s50\t%s100\t%s200\t%s500\t%s1000\n", szAchievements,
Ach_Unlock( p_PilotMissions[ playerid ], 5 ), Ach_Unlock( p_PilotMissions[ playerid ], 20 ), Ach_Unlock( p_PilotMissions[ playerid ], 50 ),
Ach_Unlock( p_PilotMissions[ playerid ], 100 ), Ach_Unlock( p_PilotMissions[ playerid ], 200 ), Ach_Unlock( p_PilotMissions[ playerid ], 500 ),
Ach_Unlock( p_PilotMissions[ playerid ], 1000 )
);
if ( !IsPlayerConnected( forid ) ) forid = playerid; if ( !IsPlayerConnected( forid ) ) forid = playerid;
ShowPlayerDialog( forid, dialogid, DIALOG_STYLE_MSGBOX, "{FFFFFF}Achievements", szAchievements, "Okay", szSecondButton ); ShowPlayerDialog( forid, dialogid, DIALOG_STYLE_MSGBOX, "{FFFFFF}Achievements", szAchievements, "Okay", szSecondButton );