store progress bar in progress.pwn and use progressbarv2
This commit is contained in:
parent
6b3cb411cf
commit
43525a52aa
@ -13,6 +13,7 @@
|
|||||||
#include "irresistible\cnr\classes.pwn"
|
#include "irresistible\cnr\classes.pwn"
|
||||||
#include "irresistible\cnr\jobs.pwn"
|
#include "irresistible\cnr\jobs.pwn"
|
||||||
#include "irresistible\cnr\textdraws.pwn"
|
#include "irresistible\cnr\textdraws.pwn"
|
||||||
|
#include "irresistible\cnr\progress.pwn"
|
||||||
#include "irresistible\cnr\spawn.pwn"
|
#include "irresistible\cnr\spawn.pwn"
|
||||||
#include "irresistible\cnr\dialog_ids.pwn"
|
#include "irresistible\cnr\dialog_ids.pwn"
|
||||||
#include "irresistible\cnr\entrances.pwn"
|
#include "irresistible\cnr\entrances.pwn"
|
||||||
|
@ -112,7 +112,7 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( GetGVarType( "meth_chef", vehicleid ) != GLOBAL_VARTYPE_NONE && IsPlayerConnected( GetGVarInt( "meth_chef", vehicleid ) ) && GetGVarType( "meth_cooktimer", vehicleid ) == GLOBAL_VARTYPE_NONE && !p_ProgressStarted{ playerid } )
|
if ( GetGVarType( "meth_chef", vehicleid ) != GLOBAL_VARTYPE_NONE && IsPlayerConnected( GetGVarInt( "meth_chef", vehicleid ) ) && GetGVarType( "meth_cooktimer", vehicleid ) == GLOBAL_VARTYPE_NONE && ! IsPlayerProgressBarStarted( playerid ) )
|
||||||
{
|
{
|
||||||
if ( IsPlayerAimingAt( playerid, 2083.489990, 1234.743041, 414.821014, fAimDistance ) )
|
if ( IsPlayerAimingAt( playerid, 2083.489990, 1234.743041, 414.821014, fAimDistance ) )
|
||||||
{
|
{
|
||||||
|
@ -164,8 +164,6 @@ new
|
|||||||
bool: p_AdminOnDuty [ MAX_PLAYERS char ],
|
bool: p_AdminOnDuty [ MAX_PLAYERS char ],
|
||||||
p_FurnitureCategory [ MAX_PLAYERS char ],
|
p_FurnitureCategory [ MAX_PLAYERS char ],
|
||||||
p_FurnitureRotAxis [ MAX_PLAYERS char ],
|
p_FurnitureRotAxis [ MAX_PLAYERS char ],
|
||||||
Float: p_ProgressStatus [ MAX_PLAYERS ],
|
|
||||||
bool: p_ProgressStarted [ MAX_PLAYERS char ],
|
|
||||||
p_HouseCrackingPW [ MAX_PLAYERS ],
|
p_HouseCrackingPW [ MAX_PLAYERS ],
|
||||||
p_PawnStoreExport [ MAX_PLAYERS ] = { 0xFFFF, ... },
|
p_PawnStoreExport [ MAX_PLAYERS ] = { 0xFFFF, ... },
|
||||||
p_Burglaries [ MAX_PLAYERS ],
|
p_Burglaries [ MAX_PLAYERS ],
|
||||||
@ -183,14 +181,12 @@ new
|
|||||||
//p_LastAnimIndex [ MAX_PLAYERS ],
|
//p_LastAnimIndex [ MAX_PLAYERS ],
|
||||||
p_SpawningCity [ MAX_PLAYERS char ],
|
p_SpawningCity [ MAX_PLAYERS char ],
|
||||||
p_UsingRobberySafe [ MAX_PLAYERS ] = { -1, ... },
|
p_UsingRobberySafe [ MAX_PLAYERS ] = { -1, ... },
|
||||||
bool: p_CancelProgress [ MAX_PLAYERS char ],
|
|
||||||
p_LumberjackMapIcon [ MAX_PLAYERS ] = { 0xFFFF, ... },
|
p_LumberjackMapIcon [ MAX_PLAYERS ] = { 0xFFFF, ... },
|
||||||
p_PawnStoreMapIcon [ MAX_PLAYERS ] = { 0xFFFF, ... },
|
p_PawnStoreMapIcon [ MAX_PLAYERS ] = { 0xFFFF, ... },
|
||||||
p_SpectateWeapons [ MAX_PLAYERS ] [ 13 ] [ 2 ],
|
p_SpectateWeapons [ MAX_PLAYERS ] [ 13 ] [ 2 ],
|
||||||
bool: p_LeftCuffed [ MAX_PLAYERS char ],
|
bool: p_LeftCuffed [ MAX_PLAYERS char ],
|
||||||
p_LabelColor [ MAX_PLAYERS ] = { COLOR_GREY, ... },
|
p_LabelColor [ MAX_PLAYERS ] = { COLOR_GREY, ... },
|
||||||
p_BulletInvulnerbility [ MAX_PLAYERS ],
|
p_BulletInvulnerbility [ MAX_PLAYERS ],
|
||||||
p_ProgressUpdateTimer [ MAX_PLAYERS ] = { 0xFFFF, ... },
|
|
||||||
p_DeathMessage [ MAX_PLAYERS ] [ 32 ],
|
p_DeathMessage [ MAX_PLAYERS ] [ 32 ],
|
||||||
p_ViewingInterior [ MAX_PLAYERS char ],
|
p_ViewingInterior [ MAX_PLAYERS char ],
|
||||||
p_MethYielded [ MAX_PLAYERS ],
|
p_MethYielded [ MAX_PLAYERS ],
|
||||||
|
156
gamemodes/irresistible/cnr/progress.pwn
Normal file
156
gamemodes/irresistible/cnr/progress.pwn
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
/*
|
||||||
|
* Irresistible Gaming (c) 2018
|
||||||
|
* Developed by Lorenc Pekaj
|
||||||
|
* Module: cnr\progress.pwn
|
||||||
|
* Purpose: dynamicly updating progress bar system
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ** Includes ** */
|
||||||
|
#include < YSI\y_hooks >
|
||||||
|
#include < progress2 >
|
||||||
|
|
||||||
|
/* ** Definitions ** */
|
||||||
|
#define PROGRESS_CRACKING 0
|
||||||
|
#define PROGRESS_MINING 3
|
||||||
|
#define PROGRESS_ROBBING 4
|
||||||
|
#define PROGRESS_SAFEPICK 5
|
||||||
|
#define PROGRESS_CRACKING_BIZ 8
|
||||||
|
|
||||||
|
/* ** Variables ** */
|
||||||
|
static stock
|
||||||
|
PlayerBar: p_ProgressBar [ MAX_PLAYERS ] = { PlayerBar: INVALID_PLAYER_BAR_ID, ... },
|
||||||
|
PlayerText: p_ProgressTitle [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
|
|
||||||
|
bool: p_ProgressStarted [ MAX_PLAYERS char ],
|
||||||
|
bool: p_CancelProgress [ MAX_PLAYERS char ],
|
||||||
|
p_ProgressUpdateTimer [ MAX_PLAYERS ] = { -1, ... }
|
||||||
|
;
|
||||||
|
|
||||||
|
/* ** Forwards ** */
|
||||||
|
forward OnPlayerProgressUpdate( playerid, progressid, bool: canceled, params );
|
||||||
|
forward OnProgressCompleted( playerid, progressid, params );
|
||||||
|
|
||||||
|
/* ** Hooks ** */
|
||||||
|
hook OnPlayerConnect( playerid )
|
||||||
|
{
|
||||||
|
p_ProgressBar[ playerid ] = CreatePlayerProgressBar( playerid, 251.000000, 222.000000, 142.0, 9.2 );
|
||||||
|
|
||||||
|
p_ProgressTitle[ playerid ] = CreatePlayerTextDraw( playerid, 320.000000, 205.000000, "_" );
|
||||||
|
PlayerTextDrawAlignment( playerid, p_ProgressTitle[ playerid ], 2 );
|
||||||
|
PlayerTextDrawBackgroundColor( playerid, p_ProgressTitle[ playerid ], 255 );
|
||||||
|
PlayerTextDrawFont( playerid, p_ProgressTitle[ playerid ], 0 );
|
||||||
|
PlayerTextDrawLetterSize( playerid, p_ProgressTitle[ playerid ], 0.559999, 1.700000 );
|
||||||
|
PlayerTextDrawColor( playerid, p_ProgressTitle[ playerid ], -1 );
|
||||||
|
PlayerTextDrawSetOutline( playerid, p_ProgressTitle[ playerid ], 1 );
|
||||||
|
PlayerTextDrawSetProportional( playerid, p_ProgressTitle[ playerid ], 1 );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerDisconnect( playerid, reason )
|
||||||
|
{
|
||||||
|
StopProgressBar( playerid );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
|
||||||
|
{
|
||||||
|
if ( PRESSED( KEY_CROUCH ) )
|
||||||
|
{
|
||||||
|
if ( p_ProgressStarted{ playerid } && !p_CancelProgress{ playerid } )
|
||||||
|
{
|
||||||
|
SendServerMessage( playerid, "You have canceled this operation." );
|
||||||
|
p_CancelProgress{ playerid } = true;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Functions ** */
|
||||||
|
stock ShowProgressBar( playerid, title[ ], progress_id, total_time = 1000, color, params = 0 )
|
||||||
|
{
|
||||||
|
if ( !IsPlayerConnected( playerid ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( p_ProgressStarted{ playerid } )
|
||||||
|
{
|
||||||
|
StopProgressBar( playerid );
|
||||||
|
p_CancelProgress{ playerid } = true; // Cancel.
|
||||||
|
CallLocalFunction( "OnPlayerProgressUpdate", "dddd", playerid, GetPVarInt( playerid, "progress_lastid" ), true, GetPVarInt( playerid, "progress_lastparams" ) );
|
||||||
|
return ShowProgressBar( playerid, title, progress_id, total_time, color, params ), 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
tickrate = floatround( float( total_time ) / 100.0 * 5.0 ); // increment by 5% each time
|
||||||
|
|
||||||
|
if ( p_ProgressUpdateTimer[ playerid ] != -1 ) {
|
||||||
|
KillTimer( p_ProgressUpdateTimer[ playerid ] );
|
||||||
|
p_ProgressUpdateTimer[ playerid ] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_ProgressStarted{ playerid } = true;
|
||||||
|
|
||||||
|
HidePlayerProgressBar( playerid, p_ProgressBar[ playerid ] );
|
||||||
|
|
||||||
|
PlayerTextDrawSetString( playerid, p_ProgressTitle[ playerid ], title );
|
||||||
|
SetPlayerProgressBarColour( playerid, p_ProgressBar[ playerid ], color );
|
||||||
|
SetPlayerProgressBarValue( playerid, p_ProgressBar[ playerid ], 0.0 );
|
||||||
|
|
||||||
|
// PlayerTextDrawColor( playerid, p_ProgressTitle[ playerid ], color );
|
||||||
|
PlayerTextDrawShow( playerid, p_ProgressTitle[ playerid ] );
|
||||||
|
|
||||||
|
SetPVarInt( playerid, "progress_lastparams", params );
|
||||||
|
SetPVarInt( playerid, "progress_lastid", progress_id );
|
||||||
|
|
||||||
|
KillTimer( p_ProgressUpdateTimer[ playerid ] );
|
||||||
|
p_ProgressUpdateTimer[ playerid ] = CallLocalFunction( "ProgressBar_Update", "dddd", playerid, progress_id, tickrate, params );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock StopProgressBar( playerid )
|
||||||
|
{
|
||||||
|
KillTimer( p_ProgressUpdateTimer[ playerid ] );
|
||||||
|
|
||||||
|
p_ProgressUpdateTimer [ playerid ] = -1;
|
||||||
|
p_ProgressStarted { playerid } = false;
|
||||||
|
p_CancelProgress { playerid } = false;
|
||||||
|
|
||||||
|
HidePlayerProgressBar( playerid, p_ProgressBar[ playerid ] );
|
||||||
|
PlayerTextDrawHide( playerid, p_ProgressTitle[ playerid ] );
|
||||||
|
|
||||||
|
return ClearAnimations( playerid ), 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ProgressBar_Update( playerid, progressid, tickrate, params )
|
||||||
|
{
|
||||||
|
if ( !IsPlayerConnected( playerid ) || !IsPlayerSpawned( playerid ) || p_ProgressStarted{ playerid } == false )
|
||||||
|
{
|
||||||
|
StopProgressBar( playerid );
|
||||||
|
CallLocalFunction( "OnPlayerProgressUpdate", "dddd", playerid, progressid, true, params );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
Float: current_progress = GetPlayerProgressBarValue( playerid, p_ProgressBar[ playerid ] );
|
||||||
|
|
||||||
|
CallLocalFunction( "OnPlayerProgressUpdate", "dddd", playerid, progressid, p_CancelProgress{ playerid }, params );
|
||||||
|
|
||||||
|
if ( current_progress + 5.0 >= 100.0 )
|
||||||
|
{
|
||||||
|
StopProgressBar( playerid );
|
||||||
|
CallLocalFunction( "OnProgressCompleted", "ddd", playerid, progressid, params );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetPlayerProgressBarValue( playerid, p_ProgressBar[ playerid ], current_progress + 5.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// restart timer
|
||||||
|
KillTimer( p_ProgressUpdateTimer[ playerid ] );
|
||||||
|
return ( p_ProgressUpdateTimer[ playerid ] = SetTimerEx( "ProgressBar_Update", tickrate, false, "dddd", playerid, progressid, tickrate, params ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock IsPlayerProgressBarStarted( playerid ) {
|
||||||
|
return p_ProgressStarted{ playerid };
|
||||||
|
}
|
@ -22,7 +22,6 @@ new
|
|||||||
Text: g_WorldDayTD = Text: INVALID_TEXT_DRAW,
|
Text: g_WorldDayTD = Text: INVALID_TEXT_DRAW,
|
||||||
Text: g_AchievementTD [ 4 ] = { Text: INVALID_TEXT_DRAW, ... },
|
Text: g_AchievementTD [ 4 ] = { Text: INVALID_TEXT_DRAW, ... },
|
||||||
Text: g_AdminLogTD = Text: INVALID_TEXT_DRAW,
|
Text: g_AdminLogTD = Text: INVALID_TEXT_DRAW,
|
||||||
Text: g_ProgressBoxTD = Text: INVALID_TEXT_DRAW,
|
|
||||||
Text: g_AdminOnDutyTD = Text: INVALID_TEXT_DRAW,
|
Text: g_AdminOnDutyTD = Text: INVALID_TEXT_DRAW,
|
||||||
Text: g_PassiveModeTD = Text: INVALID_TEXT_DRAW,
|
Text: g_PassiveModeTD = Text: INVALID_TEXT_DRAW,
|
||||||
Text: g_VehiclePreviewBoxTD = Text: INVALID_TEXT_DRAW,
|
Text: g_VehiclePreviewBoxTD = Text: INVALID_TEXT_DRAW,
|
||||||
@ -35,11 +34,6 @@ new
|
|||||||
Text: g_TopDonorTD = Text: INVALID_TEXT_DRAW,
|
Text: g_TopDonorTD = Text: INVALID_TEXT_DRAW,
|
||||||
Text: g_NotManyPlayersTD = Text: INVALID_TEXT_DRAW,
|
Text: g_NotManyPlayersTD = Text: INVALID_TEXT_DRAW,
|
||||||
|
|
||||||
// Server Player Textdraws (Needs Converting)
|
|
||||||
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, ... },
|
|
||||||
|
|
||||||
// Player Textdraws
|
// Player Textdraws
|
||||||
PlayerText: p_LocationTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_LocationTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
PlayerText: p_ExperienceTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
PlayerText: p_ExperienceTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... },
|
||||||
@ -241,18 +235,6 @@ hook OnScriptInit( )
|
|||||||
TextDrawSetProportional(g_VehiclePreviewTxtTD, 1);
|
TextDrawSetProportional(g_VehiclePreviewTxtTD, 1);
|
||||||
TextDrawSetSelectable(g_VehiclePreviewTxtTD, 0);
|
TextDrawSetSelectable(g_VehiclePreviewTxtTD, 0);
|
||||||
|
|
||||||
g_ProgressBoxTD = TextDrawCreate(250.000000, 220.000000, "_");
|
|
||||||
TextDrawBackgroundColor(g_ProgressBoxTD, 255);
|
|
||||||
TextDrawFont(g_ProgressBoxTD, 1);
|
|
||||||
TextDrawLetterSize(g_ProgressBoxTD, 0.500000, 1.000000);
|
|
||||||
TextDrawColor(g_ProgressBoxTD, -1);
|
|
||||||
TextDrawSetOutline(g_ProgressBoxTD, 0);
|
|
||||||
TextDrawSetProportional(g_ProgressBoxTD, 1);
|
|
||||||
TextDrawSetShadow(g_ProgressBoxTD, 1);
|
|
||||||
TextDrawUseBox(g_ProgressBoxTD, 1);
|
|
||||||
TextDrawBoxColor(g_ProgressBoxTD, 255);
|
|
||||||
TextDrawTextSize(g_ProgressBoxTD, 390.000000, 10.000000);
|
|
||||||
|
|
||||||
g_AdminLogTD = TextDrawCreate(150.000000, 360.000000, "_");
|
g_AdminLogTD = TextDrawCreate(150.000000, 360.000000, "_");
|
||||||
TextDrawBackgroundColor(g_AdminLogTD, 255);
|
TextDrawBackgroundColor(g_AdminLogTD, 255);
|
||||||
TextDrawFont(g_AdminLogTD, 1);
|
TextDrawFont(g_AdminLogTD, 1);
|
||||||
@ -418,43 +400,6 @@ hook OnScriptInit( )
|
|||||||
TextDrawColor(g_PassiveModeTD, COLOR_GREEN);
|
TextDrawColor(g_PassiveModeTD, COLOR_GREEN);
|
||||||
TextDrawSetOutline(g_PassiveModeTD, 1);
|
TextDrawSetOutline(g_PassiveModeTD, 1);
|
||||||
TextDrawSetProportional(g_PassiveModeTD, 1);
|
TextDrawSetProportional(g_PassiveModeTD, 1);
|
||||||
|
|
||||||
/* ** Player TextDraws ** */
|
|
||||||
for(new playerid; playerid != MAX_PLAYERS; playerid ++)
|
|
||||||
{
|
|
||||||
p_ProgressBoxOutsideTD[ playerid ] = TextDrawCreate(252.000000, 222.000000, "_");
|
|
||||||
TextDrawBackgroundColor(p_ProgressBoxOutsideTD[ playerid ], 255);
|
|
||||||
TextDrawFont(p_ProgressBoxOutsideTD[ playerid ], 1);
|
|
||||||
TextDrawLetterSize(p_ProgressBoxOutsideTD[ playerid ], 0.359999, 0.599999);
|
|
||||||
TextDrawColor(p_ProgressBoxOutsideTD[ playerid ], -1);
|
|
||||||
TextDrawSetOutline(p_ProgressBoxOutsideTD[ playerid ], 0);
|
|
||||||
TextDrawSetProportional(p_ProgressBoxOutsideTD[ playerid ], 1);
|
|
||||||
TextDrawSetShadow(p_ProgressBoxOutsideTD[ playerid ], 1);
|
|
||||||
TextDrawUseBox(p_ProgressBoxOutsideTD[ playerid ], 1);
|
|
||||||
TextDrawBoxColor(p_ProgressBoxOutsideTD[ playerid ], -154);
|
|
||||||
TextDrawTextSize(p_ProgressBoxOutsideTD[ playerid ], 388.000000, 14.000000);
|
|
||||||
|
|
||||||
p_ProgressBoxTD[ playerid ] = TextDrawCreate(252.000000, 222.000000, "_");
|
|
||||||
TextDrawBackgroundColor(p_ProgressBoxTD[ playerid ], 255);
|
|
||||||
TextDrawFont(p_ProgressBoxTD[ playerid ], 1);
|
|
||||||
TextDrawLetterSize(p_ProgressBoxTD[ playerid ], 0.559999, 0.599999);
|
|
||||||
TextDrawColor(p_ProgressBoxTD[ playerid ], -1);
|
|
||||||
TextDrawSetOutline(p_ProgressBoxTD[ playerid ], 0);
|
|
||||||
TextDrawSetProportional(p_ProgressBoxTD[ playerid ], 1);
|
|
||||||
TextDrawSetShadow(p_ProgressBoxTD[ playerid ], 1);
|
|
||||||
TextDrawUseBox(p_ProgressBoxTD[ playerid ], 1);
|
|
||||||
TextDrawBoxColor(p_ProgressBoxTD[ playerid ], -1);
|
|
||||||
TextDrawTextSize(p_ProgressBoxTD[ playerid ], 378.000000, 14.000000);
|
|
||||||
|
|
||||||
p_ProgressTitleTD[ playerid ] = TextDrawCreate(320.000000, 205.000000, "____");
|
|
||||||
TextDrawAlignment(p_ProgressTitleTD[ playerid ], 2);
|
|
||||||
TextDrawBackgroundColor(p_ProgressTitleTD[ playerid ], 255);
|
|
||||||
TextDrawFont(p_ProgressTitleTD[ playerid ], 0);
|
|
||||||
TextDrawLetterSize(p_ProgressTitleTD[ playerid ], 0.559999, 1.700000);
|
|
||||||
TextDrawColor(p_ProgressTitleTD[ playerid ], -1);
|
|
||||||
TextDrawSetOutline(p_ProgressTitleTD[ playerid ], 1);
|
|
||||||
TextDrawSetProportional(p_ProgressTitleTD[ playerid ], 1);
|
|
||||||
}
|
|
||||||
return Y_HOOKS_CONTINUE_RETURN_1;
|
return Y_HOOKS_CONTINUE_RETURN_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
#include < MathParser >
|
#include < MathParser >
|
||||||
#include < mapandreas >
|
#include < mapandreas >
|
||||||
#include < md-sort >
|
#include < md-sort >
|
||||||
#include < progress2 >
|
|
||||||
native WP_Hash ( buffer[ ], len, const str[ ] );
|
native WP_Hash ( buffer[ ], len, const str[ ] );
|
||||||
native IsValidVehicle ( vehicleid );
|
native IsValidVehicle ( vehicleid );
|
||||||
native gpci ( playerid, serial[ ], len );
|
native gpci ( playerid, serial[ ], len );
|
||||||
@ -104,13 +103,6 @@ enum E_DONATION_DATA
|
|||||||
E_DATE
|
E_DATE
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ** Progress Bars ** */
|
|
||||||
#define PROGRESS_CRACKING 0
|
|
||||||
#define PROGRESS_MINING 3
|
|
||||||
#define PROGRESS_ROBBING 4
|
|
||||||
#define PROGRESS_SAFEPICK 5
|
|
||||||
#define PROGRESS_CRACKING_BIZ 8
|
|
||||||
|
|
||||||
/* ** Discord ** */
|
/* ** Discord ** */
|
||||||
//#include <discord-connector>
|
//#include <discord-connector>
|
||||||
#define ENABLE_DISCORD false
|
#define ENABLE_DISCORD false
|
||||||
@ -638,8 +630,6 @@ public OnRulesHTTPResponse( index, response_code, data[ ] );
|
|||||||
public OnTwitterHTTPResponse( index, response_code, data[ ] );
|
public OnTwitterHTTPResponse( index, response_code, data[ ] );
|
||||||
public OnDonationRedemptionResponse( index, response_code, data[ ] );
|
public OnDonationRedemptionResponse( index, response_code, data[ ] );
|
||||||
public OnPlayerArrested( playerid, victimid, totalarrests, totalpeople );
|
public OnPlayerArrested( playerid, victimid, totalarrests, totalpeople );
|
||||||
public OnPlayerProgressUpdate( playerid, progressid, params );
|
|
||||||
public OnProgressCompleted( playerid, progressid, params );
|
|
||||||
public OnPlayerUnjailed( playerid, reasonid );
|
public OnPlayerUnjailed( playerid, reasonid );
|
||||||
public OnPlayerAccessEntrance( playerid, entranceid );
|
public OnPlayerAccessEntrance( playerid, entranceid );
|
||||||
|
|
||||||
@ -2831,8 +2821,6 @@ public OnPlayerDisconnect( playerid, reason )
|
|||||||
DestroyAllPlayerC4s( playerid, true );
|
DestroyAllPlayerC4s( playerid, true );
|
||||||
KillTimer( p_JailTimer[ playerid ] );
|
KillTimer( p_JailTimer[ playerid ] );
|
||||||
KillTimer( p_CuffAbuseTimer[ playerid ] );
|
KillTimer( p_CuffAbuseTimer[ playerid ] );
|
||||||
p_ProgressStarted{ playerid } = false;
|
|
||||||
p_CancelProgress{ playerid } = false;
|
|
||||||
ResetPlayerCash( playerid );
|
ResetPlayerCash( playerid );
|
||||||
if ( !GetPVarInt( playerid, "banned_connection" ) ) SendDeathMessage( INVALID_PLAYER_ID, playerid, 201 );
|
if ( !GetPVarInt( playerid, "banned_connection" ) ) SendDeathMessage( INVALID_PLAYER_ID, playerid, 201 );
|
||||||
DestroyDynamicMapIcon( p_PawnStoreMapIcon[ playerid ] );
|
DestroyDynamicMapIcon( p_PawnStoreMapIcon[ playerid ] );
|
||||||
@ -4368,13 +4356,10 @@ public OnPlayerLeaveGang( playerid, gangid, reason )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnPlayerProgressUpdate( playerid, progressid, params )
|
public OnPlayerProgressUpdate( playerid, progressid, bool: canceled, params )
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
Float: X, Float: Y, Float: Z, bool: canceled;
|
Float: X, Float: Y, Float: Z;
|
||||||
|
|
||||||
canceled = p_CancelProgress{ playerid };
|
|
||||||
p_CancelProgress{ playerid } = false;
|
|
||||||
|
|
||||||
if ( progressid == PROGRESS_CRACKING || progressid == PROGRESS_BRUTEFORCE ) {
|
if ( progressid == PROGRESS_CRACKING || progressid == PROGRESS_BRUTEFORCE ) {
|
||||||
if ( !IsPlayerSpawned( playerid ) || !IsPlayerInDynamicCP( playerid, g_houseData[ p_HouseCrackingPW[ playerid ] ] [ E_CHECKPOINT ] [ 0 ] ) || !IsPlayerConnected( playerid ) || IsPlayerInAnyVehicle( playerid ) || canceled )
|
if ( !IsPlayerSpawned( playerid ) || !IsPlayerInDynamicCP( playerid, g_houseData[ p_HouseCrackingPW[ playerid ] ] [ E_CHECKPOINT ] [ 0 ] ) || !IsPlayerConnected( playerid ) || IsPlayerInAnyVehicle( playerid ) || canceled )
|
||||||
@ -11290,16 +11275,6 @@ public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
|
|||||||
DetachTrailerFromVehicle( iVehicle );
|
DetachTrailerFromVehicle( iVehicle );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( PRESSED( KEY_CROUCH ) )
|
|
||||||
{
|
|
||||||
if ( p_ProgressStarted{ playerid } && !p_CancelProgress{ playerid } )
|
|
||||||
{
|
|
||||||
SendServerMessage( playerid, "You have canceled this operation." );
|
|
||||||
p_CancelProgress{ playerid } = true;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ( PRESSED( KEY_ACTION ) )
|
else if ( PRESSED( KEY_ACTION ) )
|
||||||
{
|
{
|
||||||
if ( IsPlayerInAnyVehicle( playerid ) && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER && GetVehicleModel( iVehicle ) == 525 ) {
|
if ( IsPlayerInAnyVehicle( playerid ) && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER && GetVehicleModel( iVehicle ) == 525 ) {
|
||||||
@ -17100,98 +17075,6 @@ stock IsVehicleUpsideDown(vehicleid)
|
|||||||
return (120.0 < atan2(2.0 * ((q_Y * q_Z) + (q_X * q_W)), (-(q_X * q_X) - (q_Y * q_Y) + (q_Z * q_Z) + (q_W * q_W))) > -120.0);
|
return (120.0 < atan2(2.0 * ((q_Y * q_Z) + (q_X * q_W)), (-(q_X * q_X) - (q_Y * q_Y) + (q_Z * q_Z) + (q_W * q_W))) > -120.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
stock ShowProgressBar( playerid, title[ ], pID, update = 1000, color, params = 0 )
|
|
||||||
{
|
|
||||||
if ( !IsPlayerConnected( playerid ) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
new time_interval = floatround( float( update ) / ( ( 388.0 - 249.0 ) / 13.0 ) );
|
|
||||||
|
|
||||||
if ( p_ProgressStarted{ playerid } )
|
|
||||||
{
|
|
||||||
StopProgressBar( playerid );
|
|
||||||
p_CancelProgress{ playerid } = true; // Cancel.
|
|
||||||
//SendClientMessageFormatted( playerid, COLOR_PINK, "RESTARTING PROGRESS %d (params [OLD:%d,NEW:%d]", pID, GetPVarInt( playerid, "progress_lastparams" ), params );
|
|
||||||
CallLocalFunction( "OnPlayerProgressUpdate", "ddd", playerid, GetPVarInt( playerid, "progress_lastid" ), GetPVarInt( playerid, "progress_lastparams" ) );
|
|
||||||
return ShowProgressBar( playerid, title, pID, time_interval, color, params ), 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( p_ProgressUpdateTimer[ playerid ] != 0xFFFF ) {
|
|
||||||
KillTimer( p_ProgressUpdateTimer[ playerid ] );
|
|
||||||
p_ProgressUpdateTimer[ playerid ] = 0xFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
p_ProgressStarted{ playerid } = true;
|
|
||||||
p_ProgressStatus[ playerid ] = 249.0;
|
|
||||||
|
|
||||||
TextDrawHideForPlayer( playerid, g_ProgressBoxTD );
|
|
||||||
TextDrawHideForPlayer( playerid, p_ProgressBoxOutsideTD[ playerid ] );
|
|
||||||
TextDrawHideForPlayer( playerid, p_ProgressBoxTD[ playerid ] );
|
|
||||||
TextDrawHideForPlayer( playerid, p_ProgressTitleTD[ playerid ] );
|
|
||||||
|
|
||||||
TextDrawTextSize( p_ProgressBoxTD[ playerid ], p_ProgressStatus[ playerid ], 14.000000 );
|
|
||||||
TextDrawSetString( p_ProgressTitleTD[ playerid ], title );
|
|
||||||
TextDrawBoxColor( p_ProgressBoxTD[ playerid ], color );
|
|
||||||
TextDrawBoxColor( p_ProgressBoxOutsideTD[ playerid ], ( color & 0xFFFFFF00 ) | ( 0x66 & ( ( color & 0x000000FF ) / 2 ) ) );
|
|
||||||
|
|
||||||
TextDrawShowForPlayer( playerid, g_ProgressBoxTD );
|
|
||||||
TextDrawShowForPlayer( playerid, p_ProgressBoxOutsideTD[ playerid ] );
|
|
||||||
TextDrawShowForPlayer( playerid, p_ProgressBoxTD[ playerid ] );
|
|
||||||
TextDrawShowForPlayer( playerid, p_ProgressTitleTD[ playerid ] );
|
|
||||||
|
|
||||||
SetPVarInt( playerid, "progress_lastparams", params );
|
|
||||||
SetPVarInt( playerid, "progress_lastid", pID );
|
|
||||||
|
|
||||||
KillTimer( p_ProgressUpdateTimer[ playerid ] );
|
|
||||||
p_ProgressUpdateTimer[ playerid ] = SetTimerEx( "ProgressBar_Update", time_interval, false, "dddd", playerid, pID, time_interval, params );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
stock StopProgressBar( playerid )
|
|
||||||
{
|
|
||||||
KillTimer( p_ProgressUpdateTimer[ playerid ] );
|
|
||||||
|
|
||||||
p_ProgressUpdateTimer [ playerid ] = 0xFFFF;
|
|
||||||
p_ProgressStarted { playerid } = false;
|
|
||||||
p_ProgressStatus [ playerid ] = 249.0;
|
|
||||||
|
|
||||||
TextDrawHideForPlayer( playerid, g_ProgressBoxTD );
|
|
||||||
TextDrawHideForPlayer( playerid, p_ProgressBoxOutsideTD[ playerid ] );
|
|
||||||
TextDrawHideForPlayer( playerid, p_ProgressBoxTD[ playerid ] );
|
|
||||||
TextDrawHideForPlayer( playerid, p_ProgressTitleTD[ playerid ] );
|
|
||||||
|
|
||||||
return ClearAnimations( playerid ), 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ProgressBar_Update( playerid, progressid, tickrate, params )
|
|
||||||
{
|
|
||||||
if ( !IsPlayerConnected( playerid ) || !IsPlayerSpawned( playerid ) || p_ProgressStarted{ playerid } == false )
|
|
||||||
{
|
|
||||||
StopProgressBar( playerid );
|
|
||||||
p_CancelProgress{ playerid } = true; // Cancel.
|
|
||||||
//SendClientMessageFormatted( playerid, COLOR_ORANGE, "STOPPING PROGRESS %d", progressid );
|
|
||||||
CallLocalFunction( "OnPlayerProgressUpdate", "ddd", playerid, progressid, params );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
p_ProgressStatus[ playerid ] += 13.0;
|
|
||||||
if ( p_ProgressStatus[ playerid ] >= 388 ) p_ProgressStatus[ playerid ] = 388;
|
|
||||||
|
|
||||||
TextDrawTextSize( p_ProgressBoxTD[ playerid ], p_ProgressStatus[ playerid ], 14.000000 );
|
|
||||||
TextDrawShowForPlayer( playerid, p_ProgressBoxTD[ playerid ] );
|
|
||||||
|
|
||||||
CallLocalFunction( "OnPlayerProgressUpdate", "ddd", playerid, progressid, params );
|
|
||||||
|
|
||||||
if ( p_ProgressStatus[ playerid ] >= 388 )
|
|
||||||
{
|
|
||||||
StopProgressBar( playerid );
|
|
||||||
CallLocalFunction( "OnProgressCompleted", "ddd", playerid, progressid, params );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
KillTimer( p_ProgressUpdateTimer[ playerid ] ); // Just incase.
|
|
||||||
return ( p_ProgressUpdateTimer[ playerid ] = SetTimerEx( "ProgressBar_Update", tickrate, false, "dddd", playerid, progressid, tickrate, params ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ResetVehicleBurglaryData( vehicleid )
|
stock ResetVehicleBurglaryData( vehicleid )
|
||||||
{
|
{
|
||||||
if ( GetVehicleModel( vehicleid ) != 498 )
|
if ( GetVehicleModel( vehicleid ) != 498 )
|
||||||
|
Loading…
Reference in New Issue
Block a user