remove help dialog when a player spawns ... fix issue with supa not hiding help dialog

This commit is contained in:
Lorenc Pekaj 2018-10-22 18:33:10 +11:00
parent a0016cd039
commit 9800b8f007
3 changed files with 60 additions and 35 deletions

View File

@ -364,3 +364,14 @@ stock GetEntrancePos( entranceid, &Float: X, &Float: Y, &Float: Z ) {
Y = g_entranceData[ entranceid ] [ E_EY ]; Y = g_entranceData[ entranceid ] [ E_EY ];
Z = g_entranceData[ entranceid ] [ E_EZ ]; Z = g_entranceData[ entranceid ] [ E_EZ ];
} }
stock GetEntranceInsidePos( entranceid, &Float: X, &Float: Y, &Float: Z ) {
X = g_entranceData[ entranceid ] [ E_LX ];
Y = g_entranceData[ entranceid ] [ E_LY ];
Z = g_entranceData[ entranceid ] [ E_LZ ];
return 1;
}
stock GetEntranceWorld( entranceid ) {
return g_entranceData[ entranceid ] [ E_WORLD ];
}

View File

@ -334,6 +334,31 @@ stock getClosestRobberySafe( playerid, &Float: dis = 99999.99 )
return object; return object;
} }
stock GetEntranceClosestRobberySafe( entranceid, &Float: distance = FLOAT_INFINITY )
{
new iCurrent = INVALID_PLAYER_ID, Float: fTmp;
new world = GetEntranceWorld( entranceid );
foreach ( new robberyid : RobberyCount )
{
if ( world != 0 && g_robberyData[ robberyid ] [ E_WORLD ] != -1 && g_robberyData[ robberyid ] [ E_WORLD ] != world )
continue;
static
Float: X, Float: Y, Float: Z;
if ( GetEntranceInsidePos( entranceid, X, Y, Z ) )
{
if ( 0.0 < ( fTmp = GetDistanceBetweenPoints( g_robberyData[ robberyid ] [ E_DOOR_X ], g_robberyData[ robberyid ] [ E_DOOR_Y ], g_robberyData[ robberyid ] [ E_DOOR_Z ], X, Y, Z ) ) < distance ) // Y_Less mentioned there's no need to sqroot
{
distance = fTmp;
iCurrent = robberyid;
}
}
}
return iCurrent;
}
stock GetXYInFrontOfSafe( robberyid, &Float: X, &Float: Y, &Float: Z, Float: distance = 1.1 ) // old 1.25 stock GetXYInFrontOfSafe( robberyid, &Float: X, &Float: Y, &Float: Z, Float: distance = 1.1 ) // old 1.25
{ {
static static

View File

@ -1731,6 +1731,7 @@ public OnPlayerSpawn( playerid )
p_InGarage[ playerid ] = -1; p_InGarage[ playerid ] = -1;
StopSound( playerid ); StopSound( playerid );
CancelEdit( playerid ); CancelEdit( playerid );
HidePlayerHelpDialog( playerid );
// Money Bags // Money Bags
if ( p_MoneyBag{ playerid } && p_Class[ playerid ] != CLASS_POLICE ) // SetPlayerAttachedObject( playerid, 1, 1550, 1, 0.131999, -0.140999, 0.053999, 11.299997, 65.599906, 173.900054, 0.652000, 0.573000, 0.594000 ); if ( p_MoneyBag{ playerid } && p_Class[ playerid ] != CLASS_POLICE ) // SetPlayerAttachedObject( playerid, 1, 1550, 1, 0.131999, -0.140999, 0.053999, 11.299997, 65.599906, 173.900054, 0.652000, 0.573000, 0.594000 );
@ -7390,6 +7391,25 @@ public OnPlayerAccessEntrance( playerid, entranceid )
if ( g_entranceData[ entranceid ] [ E_VIP ] && p_VIPLevel[ playerid ] < VIP_REGULAR ) { if ( g_entranceData[ entranceid ] [ E_VIP ] && p_VIPLevel[ playerid ] < VIP_REGULAR ) {
return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" ), 0; return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" ), 0;
} }
// robbery helper
if ( p_Class[ playerid ] != CLASS_POLICE )
{
if ( ! IsPlayerInBank( playerid ) ) p_SafeHelperTimer[ playerid ] = SetTimerEx( "OnSafeHelperUpdate", 500, false, "dd", playerid, GetEntranceClosestRobberySafe( entranceid ) );
else
{
new iCity, iWorld = GetPlayerVirtualWorld( playerid );
for( iCity = 0; iCity < sizeof( g_bankvaultData ); iCity++ )
if ( iWorld != 0 && iWorld == g_bankvaultData[ iCity ] [ E_WORLD ] )
break;
if ( g_bankvaultData[ iCity ] [ E_TIMESTAMP ] < g_iTime && !g_bankvaultData[ iCity ] [ E_DISABLED ] )
ShowPlayerHelpDialog( playerid, 5000, "This ~g~~h~bank~w~~h~ is available for a heist." );
else
ShowPlayerHelpDialog( playerid, 5000, "This bank is ~r~~h~unavailable for a heist." );
}
}
return 1; return 1;
} }
@ -7503,42 +7523,14 @@ public OnPlayerExitedMenu( playerid )
public OnPlayerInteriorChange( playerid, newinteriorid, oldinteriorid ) public OnPlayerInteriorChange( playerid, newinteriorid, oldinteriorid )
{ {
if ( p_InHouse[ playerid ] == -1 && p_LastEnteredEntrance[ playerid ] != -1 && newinteriorid != 0 && oldinteriorid == 0 && p_Class[ playerid ] != CLASS_POLICE ) {
if ( !IsPlayerInBank( playerid ) ) p_SafeHelperTimer[ playerid ] = SetTimerEx( "OnSafeHelperUpdate", 500, false, "dd", playerid, -1 );
else
{
new
iCity,
iWorld = GetPlayerVirtualWorld( playerid )
;
for( iCity = 0; iCity < sizeof( g_bankvaultData ); iCity++ )
if ( iWorld != 0 && iWorld == g_bankvaultData[ iCity ] [ E_WORLD ] )
break;
if ( g_bankvaultData[ iCity ] [ E_TIMESTAMP ] < g_iTime && !g_bankvaultData[ iCity ] [ E_DISABLED ] )
ShowPlayerHelpDialog( playerid, 5000, "This ~g~~h~bank~w~~h~ is available for a heist." );
else
ShowPlayerHelpDialog( playerid, 5000, "This bank is ~r~~h~unavailable for a heist." );
}
}
SyncSpectation( playerid ); SyncSpectation( playerid );
return 1; return 1;
} }
function OnSafeHelperUpdate( playerid, robberyid ) function OnSafeHelperUpdate( playerid, robberyid )
{ {
if ( robberyid == -1 )
{
p_SafeHelperTimer[ playerid ] = SetTimerEx( "OnSafeHelperUpdate", 500, false, "dd", playerid, getClosestRobberySafe( playerid ) );
return 1;
}
new new
Float: distance = distanceFromSafe( playerid, robberyid ) Float: distance = distanceFromSafe( playerid, robberyid );
;
if ( robberyid == INVALID_OBJECT_ID || distance > 100.0 || ! IsPlayerConnected( playerid ) || ! IsPlayerSpawned( playerid ) || IsPlayerInCasino( playerid ) || IsPlayerPlayingPool( playerid ) ) if ( robberyid == INVALID_OBJECT_ID || distance > 100.0 || ! IsPlayerConnected( playerid ) || ! IsPlayerSpawned( playerid ) || IsPlayerInCasino( playerid ) || IsPlayerPlayingPool( playerid ) )
{ {
@ -7554,7 +7546,7 @@ function OnSafeHelperUpdate( playerid, robberyid )
return 0; return 0;
} }
if ( distance < 2.0 ) if ( 0.0 < distance < 2.0 )
{ {
p_SafeHelperTimer[ playerid ] = -1; p_SafeHelperTimer[ playerid ] = -1;
ShowPlayerHelpDialog( playerid, 7500, "Great, you've ~g~~h~found the safe.~w~~h~~n~~n~To rob the safe, hit ~r~~h~Left Alt~w~~h~ key." ); ShowPlayerHelpDialog( playerid, 7500, "Great, you've ~g~~h~found the safe.~w~~h~~n~~n~To rob the safe, hit ~r~~h~Left Alt~w~~h~ key." );
@ -12032,11 +12024,8 @@ stock ShowPlayerHelpDialog( playerid, timeout, format[ ], va_args<> )
function HidePlayerHelpDialog( playerid ) function HidePlayerHelpDialog( playerid )
{ {
if ( p_HideHelpDialogTimer[ playerid ] != -1 )
{
p_HideHelpDialogTimer[ playerid ] = -1; p_HideHelpDialogTimer[ playerid ] = -1;
PlayerTextDrawHide( playerid, p_HelpBoxTD[ playerid ] ); PlayerTextDrawHide( playerid, p_HelpBoxTD[ playerid ] );
}
} }
stock fix_NightThermalVisionHack( playerid ) // Created by wups stock fix_NightThermalVisionHack( playerid ) // Created by wups