solve issue with saved biz vehicles showing unpurchased

This commit is contained in:
Lorenc Pekaj 2018-10-01 14:39:08 +10:00
parent 65cc786fa0
commit 0f4aee7915

View File

@ -369,7 +369,7 @@ CMD:business( playerid, params[ ] )
p_OwnedBusinesses[ playerid ] --; p_OwnedBusinesses[ playerid ] --;
g_businessData[ iBusiness ] [ E_OWNER_ID ] = 0; g_businessData[ iBusiness ] [ E_OWNER_ID ] = 0;
ResetBusiness( iBusiness ); ResetBusiness( iBusiness, .hard_reset = true );
StopBusinessExportMission( iBusiness ); StopBusinessExportMission( iBusiness );
UpdateBusinessData( iBusiness ); UpdateBusinessData( iBusiness );
UpdateBusinessTitle( iBusiness ); // No point querying (add on resale) UpdateBusinessTitle( iBusiness ); // No point querying (add on resale)
@ -1357,11 +1357,11 @@ stock DestroyBusiness( businessid )
DestroyDynamic3DTextLabel( g_businessData[ businessid ] [ E_ENTER_LABEL ] ); DestroyDynamic3DTextLabel( g_businessData[ businessid ] [ E_ENTER_LABEL ] );
DestroyDynamic3DTextLabel( g_businessData[ businessid ] [ E_EXIT_LABEL ] ); DestroyDynamic3DTextLabel( g_businessData[ businessid ] [ E_EXIT_LABEL ] );
StopBusinessExportMission( businessid ); StopBusinessExportMission( businessid );
ResetBusiness( businessid ); ResetBusiness( businessid, .hard_reset = true );
return 1; return 1;
} }
stock ResetBusiness( iBusiness ) stock ResetBusiness( iBusiness, bool: hard_reset = false )
{ {
// data // data
g_businessData[ iBusiness ] [ E_PRODUCT ] = 0; g_businessData[ iBusiness ] [ E_PRODUCT ] = 0;
@ -1388,9 +1388,12 @@ stock ResetBusiness( iBusiness )
DestroyActor( g_businessActors[ iBusiness ] [ i ] ), g_businessActors[ iBusiness ] [ i ] = -1; DestroyActor( g_businessActors[ iBusiness ] [ i ] ), g_businessActors[ iBusiness ] [ i ] = -1;
// queries // queries
if ( hard_reset )
{
mysql_single_query( sprintf( "DELETE FROM `BUSINESS_VEHICLES` WHERE `BUSINESS_ID`=%d", iBusiness ) ); mysql_single_query( sprintf( "DELETE FROM `BUSINESS_VEHICLES` WHERE `BUSINESS_ID`=%d", iBusiness ) );
mysql_single_query( sprintf( "UPDATE `USERS` SET `SPAWN`=NULL WHERE `SPAWN`='BIZ %d'", iBusiness ) ); mysql_single_query( sprintf( "UPDATE `USERS` SET `SPAWN`=NULL WHERE `SPAWN`='BIZ %d'", iBusiness ) );
} }
}
stock GetBusinessAssociates( businessid ) { stock GetBusinessAssociates( businessid ) {
new new