moviemode in its own module

This commit is contained in:
Lorenc Pekaj 2018-12-23 11:14:28 +11:00
parent 4b79a5eba3
commit 50bd48b688
7 changed files with 144 additions and 111 deletions

View File

@ -24,6 +24,7 @@
// #include "irresistible\cnr\features\eastereggs.pwn" // #include "irresistible\cnr\features\eastereggs.pwn"
// other // other
#include "irresistible\cnr\features\movie_mode.pwn"
#include "irresistible\cnr\features\passive_mode.pwn" #include "irresistible\cnr\features\passive_mode.pwn"
#include "irresistible\cnr\features\server_rules.pwn" #include "irresistible\cnr\features\server_rules.pwn"
#include "irresistible\cnr\features\toys.pwn" #include "irresistible\cnr\features\toys.pwn"

View File

@ -375,7 +375,7 @@ stock CreateLoopingAnimation( playerid, animlib[ ], animname[ ], Float:Speed, lo
if ( looping ) // Animations that must be played once. if ( looping ) // Animations that must be played once.
{ {
p_InAnimation{ playerid } = true; p_InAnimation{ playerid } = true;
if ( !p_inMovieMode{ playerid } ) TextDrawShowForPlayer( playerid, g_AnimationTD ); if ( ! IsPlayerMovieMode( playerid ) ) TextDrawShowForPlayer( playerid, g_AnimationTD );
} }
} }
return 1; return 1;

View File

@ -0,0 +1,111 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc
* Module: cnr\features\movie_mode.pwn
* Purpose: movie mode feature that hides textdraws for the purpose of a movie
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Variables ** */
static stock Text: g_MovieModeTD [ 6 ] = { Text: INVALID_TEXT_DRAW, ... };
static stock bool: p_inMovieMode [ MAX_PLAYERS char ];
/* ** Hooks ** */
hook OnScriptInit( )
{
g_MovieModeTD[ 0 ] = TextDrawCreate(507.000000, 386.000000, "_");
TextDrawBackgroundColor(g_MovieModeTD[ 0 ], 255);
TextDrawFont(g_MovieModeTD[ 0 ], 1);
TextDrawLetterSize(g_MovieModeTD[ 0 ], 0.500000, 4.799999);
TextDrawColor(g_MovieModeTD[ 0 ], -1);
TextDrawSetOutline(g_MovieModeTD[ 0 ], 0);
TextDrawSetProportional(g_MovieModeTD[ 0 ], 1);
TextDrawSetShadow(g_MovieModeTD[ 0 ], 1);
TextDrawUseBox(g_MovieModeTD[ 0 ], 1);
TextDrawBoxColor(g_MovieModeTD[ 0 ], 80);
TextDrawTextSize(g_MovieModeTD[ 0 ], 620.000000, 0.000000);
g_MovieModeTD[ 1 ] = TextDrawCreate(516.000000, 398.000000, "San Fierro");
TextDrawBackgroundColor(g_MovieModeTD[ 1 ], 255);
TextDrawFont(g_MovieModeTD[ 1 ], 3);
TextDrawLetterSize(g_MovieModeTD[ 1 ], 0.529999, 2.299999);
TextDrawColor(g_MovieModeTD[ 1 ], -2347265);
TextDrawSetOutline(g_MovieModeTD[ 1 ], 1);
TextDrawSetProportional(g_MovieModeTD[ 1 ], 1);
g_MovieModeTD[ 2 ] = TextDrawCreate(530.000000, 414.000000, "Cops and Robbers");
TextDrawBackgroundColor(g_MovieModeTD[ 2 ], 255);
TextDrawFont(g_MovieModeTD[ 2 ], 0);
TextDrawLetterSize(g_MovieModeTD[ 2 ], 0.310000, 1.100000);
TextDrawColor(g_MovieModeTD[ 2 ], -1);
TextDrawSetOutline(g_MovieModeTD[ 2 ], 1);
TextDrawSetProportional(g_MovieModeTD[ 2 ], 1);
g_MovieModeTD[ 3 ] = TextDrawCreate(507.000000, 398.000000, "_");
TextDrawBackgroundColor(g_MovieModeTD[ 3 ], 255);
TextDrawFont(g_MovieModeTD[ 3 ], 1);
TextDrawLetterSize(g_MovieModeTD[ 3 ], 0.500000, -0.400000);
TextDrawColor(g_MovieModeTD[ 3 ], -1);
TextDrawSetOutline(g_MovieModeTD[ 3 ], 0);
TextDrawSetProportional(g_MovieModeTD[ 3 ], 1);
TextDrawSetShadow(g_MovieModeTD[ 3 ], 1);
TextDrawUseBox(g_MovieModeTD[ 3 ], 1);
TextDrawBoxColor(g_MovieModeTD[ 3 ], 255);
TextDrawTextSize(g_MovieModeTD[ 3 ], 620.000000, 0.000000);
g_MovieModeTD[ 4 ] = TextDrawCreate(530.000000, 385.000000, "www.SFCNR.com");
TextDrawBackgroundColor(g_MovieModeTD[ 4 ], 255);
TextDrawFont(g_MovieModeTD[ 4 ], 1);
TextDrawLetterSize(g_MovieModeTD[ 4 ], 0.200000, 1.000000);
TextDrawColor(g_MovieModeTD[ 4 ], 0xfa4d4cff);
TextDrawSetOutline(g_MovieModeTD[ 4 ], 1);
TextDrawSetProportional(g_MovieModeTD[ 4 ], 1);
g_MovieModeTD[ 5 ] = TextDrawCreate(507.000000, 386.000000, "_");
TextDrawBackgroundColor(g_MovieModeTD[ 5 ], 255);
TextDrawFont(g_MovieModeTD[ 5 ], 1);
TextDrawLetterSize(g_MovieModeTD[ 5 ], 0.500000, 0.799999);
TextDrawColor(g_MovieModeTD[ 5 ], -1);
TextDrawSetOutline(g_MovieModeTD[ 5 ], 0);
TextDrawSetProportional(g_MovieModeTD[ 5 ], 1);
TextDrawSetShadow(g_MovieModeTD[ 5 ], 1);
TextDrawUseBox(g_MovieModeTD[ 5 ], 1);
TextDrawBoxColor(g_MovieModeTD[ 5 ], 128);
TextDrawTextSize(g_MovieModeTD[ 5 ], 620.000000, 0.000000);
return 1;
}
hook OnPlayerDisconnect( playerid, reason ) {
p_inMovieMode{ playerid } = false;
return 1;
}
/* ** Commands ** */
CMD:moviemode( playerid, params[ ] )
{
switch ( p_inMovieMode{ playerid } )
{
case true:
{
p_inMovieMode{ playerid } = false;
SendServerMessage( playerid, "Movie mode has been un-toggled." );
CallLocalFunction( "OnPlayerLoadTextdraws", "d", playerid );
for ( new i = 0; i < sizeof( g_MovieModeTD ); i ++ ) TextDrawHideForPlayer( playerid, g_MovieModeTD[ i ] );
}
case false:
{
p_inMovieMode{ playerid } = true;
SendServerMessage( playerid, "Movie mode has been toggled." );
CallLocalFunction( "OnPlayerUnloadTextdraws", "d", playerid );
for ( new i = 0; i < sizeof( g_MovieModeTD ); i ++ ) TextDrawShowForPlayer( playerid, g_MovieModeTD[ i ] );
}
}
CallLocalFunction( "OnPlayerMovieMode", "dd", playerid, p_inMovieMode{ playerid } );
return 1;
}
/* ** Functions ** */
stock IsPlayerMovieMode( playerid ) {
return p_inMovieMode{ playerid };
}

View File

@ -160,9 +160,7 @@ stock ShowPlayerModelPreview( playerid, handleid, title[ ], model, bgcolor = 0x0
PlayerTextDrawShow( playerid, p_ModelPreviewTD[ playerid ] [ i ] ); PlayerTextDrawShow( playerid, p_ModelPreviewTD[ playerid ] [ i ] );
} }
p_inMovieMode{ playerid } = false; CallLocalFunction( "OnPlayerUnloadTextdraws", "d", playerid );
cmd_moviemode( playerid, "" ); // Hide textdraws
SetPVarInt( playerid, "preview_model_handle", handleid ); SetPVarInt( playerid, "preview_model_handle", handleid );
SelectTextDraw( playerid, COLOR_RED ); SelectTextDraw( playerid, COLOR_RED );
return 1; return 1;
@ -181,8 +179,7 @@ stock HidePlayerModelPreview( playerid, cancel = 1 )
PlayerTextDrawHide( playerid, p_ModelPreviewTD[ playerid ] [ i ] ); PlayerTextDrawHide( playerid, p_ModelPreviewTD[ playerid ] [ i ] );
} }
cmd_moviemode( playerid, "" ); // Show textdraws CallLocalFunction( "OnPlayerLoadTextdraws", "d", playerid );
CallLocalFunction( "OnPlayerEndModelPreview", "dd", playerid, GetPVarInt( playerid, "preview_model_handle" ) ); CallLocalFunction( "OnPlayerEndModelPreview", "dd", playerid, GetPVarInt( playerid, "preview_model_handle" ) );
SetPVarInt( playerid, "preview_model_delay", GetTickCount( ) + 100 ); SetPVarInt( playerid, "preview_model_delay", GetTickCount( ) + 100 );

View File

@ -70,7 +70,6 @@ new
p_BailOfferer [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... }, p_BailOfferer [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
Text3D: p_InfoLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID, ... }, Text3D: p_InfoLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID, ... },
p_InfoLabelString [ MAX_PLAYERS ] [ 32 ], p_InfoLabelString [ MAX_PLAYERS ] [ 32 ],
bool: p_inMovieMode [ MAX_PLAYERS char ],
bool: p_inCIA [ MAX_PLAYERS char ], bool: p_inCIA [ MAX_PLAYERS char ],
p_AntiEmpSpam [ MAX_PLAYERS ], p_AntiEmpSpam [ MAX_PLAYERS ],
bool: p_inPaintBall [ MAX_PLAYERS char ], bool: p_inPaintBall [ MAX_PLAYERS char ],
@ -228,8 +227,6 @@ stock GetPlayerVIPLevel( playerid ) return p_VIPLevel[ playerid ];
stock IsPlayerInPaintBall( playerid ) return p_inPaintBall{ playerid }; stock IsPlayerInPaintBall( playerid ) return p_inPaintBall{ playerid };
stock IsPlayerMovieMode( playerid ) return p_inMovieMode{ playerid };
stock GetPlayerAdminLevel( playerid ) return p_AdminLevel[ playerid ]; stock GetPlayerAdminLevel( playerid ) return p_AdminLevel[ playerid ];
stock IsPlayerSpawned( playerid ) return p_Spawned{ playerid }; stock IsPlayerSpawned( playerid ) return p_Spawned{ playerid };

View File

@ -13,7 +13,6 @@ new
Text: g_ObjectLoadTD = Text: INVALID_TEXT_DRAW, Text: g_ObjectLoadTD = Text: INVALID_TEXT_DRAW,
Text: g_WebsiteTD = Text: INVALID_TEXT_DRAW, Text: g_WebsiteTD = Text: INVALID_TEXT_DRAW,
Text: g_MotdTD = Text: INVALID_TEXT_DRAW, Text: g_MotdTD = Text: INVALID_TEXT_DRAW,
Text: g_MovieModeTD [ 6 ] = { Text: INVALID_TEXT_DRAW, ... },
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,
@ -177,66 +176,6 @@ hook OnScriptInit( )
TextDrawSetOutline(g_WebsiteTD, 1); TextDrawSetOutline(g_WebsiteTD, 1);
TextDrawSetProportional(g_WebsiteTD, 1); TextDrawSetProportional(g_WebsiteTD, 1);
g_MovieModeTD[ 0 ] = TextDrawCreate(507.000000, 386.000000, "_");
TextDrawBackgroundColor(g_MovieModeTD[ 0 ], 255);
TextDrawFont(g_MovieModeTD[ 0 ], 1);
TextDrawLetterSize(g_MovieModeTD[ 0 ], 0.500000, 4.799999);
TextDrawColor(g_MovieModeTD[ 0 ], -1);
TextDrawSetOutline(g_MovieModeTD[ 0 ], 0);
TextDrawSetProportional(g_MovieModeTD[ 0 ], 1);
TextDrawSetShadow(g_MovieModeTD[ 0 ], 1);
TextDrawUseBox(g_MovieModeTD[ 0 ], 1);
TextDrawBoxColor(g_MovieModeTD[ 0 ], 80);
TextDrawTextSize(g_MovieModeTD[ 0 ], 620.000000, 0.000000);
g_MovieModeTD[ 1 ] = TextDrawCreate(516.000000, 398.000000, "San Fierro");
TextDrawBackgroundColor(g_MovieModeTD[ 1 ], 255);
TextDrawFont(g_MovieModeTD[ 1 ], 3);
TextDrawLetterSize(g_MovieModeTD[ 1 ], 0.529999, 2.299999);
TextDrawColor(g_MovieModeTD[ 1 ], -2347265);
TextDrawSetOutline(g_MovieModeTD[ 1 ], 1);
TextDrawSetProportional(g_MovieModeTD[ 1 ], 1);
g_MovieModeTD[ 2 ] = TextDrawCreate(530.000000, 414.000000, "Cops and Robbers");
TextDrawBackgroundColor(g_MovieModeTD[ 2 ], 255);
TextDrawFont(g_MovieModeTD[ 2 ], 0);
TextDrawLetterSize(g_MovieModeTD[ 2 ], 0.310000, 1.100000);
TextDrawColor(g_MovieModeTD[ 2 ], -1);
TextDrawSetOutline(g_MovieModeTD[ 2 ], 1);
TextDrawSetProportional(g_MovieModeTD[ 2 ], 1);
g_MovieModeTD[ 3 ] = TextDrawCreate(507.000000, 398.000000, "_");
TextDrawBackgroundColor(g_MovieModeTD[ 3 ], 255);
TextDrawFont(g_MovieModeTD[ 3 ], 1);
TextDrawLetterSize(g_MovieModeTD[ 3 ], 0.500000, -0.400000);
TextDrawColor(g_MovieModeTD[ 3 ], -1);
TextDrawSetOutline(g_MovieModeTD[ 3 ], 0);
TextDrawSetProportional(g_MovieModeTD[ 3 ], 1);
TextDrawSetShadow(g_MovieModeTD[ 3 ], 1);
TextDrawUseBox(g_MovieModeTD[ 3 ], 1);
TextDrawBoxColor(g_MovieModeTD[ 3 ], 255);
TextDrawTextSize(g_MovieModeTD[ 3 ], 620.000000, 0.000000);
g_MovieModeTD[ 4 ] = TextDrawCreate(530.000000, 385.000000, "www.SFCNR.com");
TextDrawBackgroundColor(g_MovieModeTD[ 4 ], 255);
TextDrawFont(g_MovieModeTD[ 4 ], 1);
TextDrawLetterSize(g_MovieModeTD[ 4 ], 0.200000, 1.000000);
TextDrawColor(g_MovieModeTD[ 4 ], 0xfa4d4cff);
TextDrawSetOutline(g_MovieModeTD[ 4 ], 1);
TextDrawSetProportional(g_MovieModeTD[ 4 ], 1);
g_MovieModeTD[ 5 ] = TextDrawCreate(507.000000, 386.000000, "_");
TextDrawBackgroundColor(g_MovieModeTD[ 5 ], 255);
TextDrawFont(g_MovieModeTD[ 5 ], 1);
TextDrawLetterSize(g_MovieModeTD[ 5 ], 0.500000, 0.799999);
TextDrawColor(g_MovieModeTD[ 5 ], -1);
TextDrawSetOutline(g_MovieModeTD[ 5 ], 0);
TextDrawSetProportional(g_MovieModeTD[ 5 ], 1);
TextDrawSetShadow(g_MovieModeTD[ 5 ], 1);
TextDrawUseBox(g_MovieModeTD[ 5 ], 1);
TextDrawBoxColor(g_MovieModeTD[ 5 ], 128);
TextDrawTextSize(g_MovieModeTD[ 5 ], 620.000000, 0.000000);
g_AdminOnDutyTD = TextDrawCreate(552.000000, 66.500000, "ADMIN ON DUTY"); g_AdminOnDutyTD = TextDrawCreate(552.000000, 66.500000, "ADMIN ON DUTY");
TextDrawBackgroundColor(g_AdminOnDutyTD, 255); TextDrawBackgroundColor(g_AdminOnDutyTD, 255);
TextDrawFont(g_AdminOnDutyTD, 1); TextDrawFont(g_AdminOnDutyTD, 1);

View File

@ -88,6 +88,8 @@ public OnServerUpdateTimer( );
public OnServerSecondTick( ); public OnServerSecondTick( );
public OnHelpHTTPResponse( index, response_code, data[ ] ); public OnHelpHTTPResponse( index, response_code, data[ ] );
public OnPlayerAccessEntrance( playerid, entranceid, worldid, interiorid ); public OnPlayerAccessEntrance( playerid, entranceid, worldid, interiorid );
public OnPlayerLoadTextdraws( playerid );
public OnPlayerUnloadTextdraws( playerid );
main() main()
{ {
@ -879,7 +881,6 @@ public OnPlayerDisconnect( playerid, reason )
// p_XP [ playerid ] = 0; // p_XP [ playerid ] = 0;
p_InHouse [ playerid ] = -1; p_InHouse [ playerid ] = -1;
p_InGarage [ playerid ] = -1; p_InGarage [ playerid ] = -1;
p_inMovieMode { playerid } = false;
p_CantUseAsk { playerid } = false; p_CantUseAsk { playerid } = false;
p_LastSkin [ playerid ] = 0; p_LastSkin [ playerid ] = 0;
p_SecureWallet { playerid } = false; p_SecureWallet { playerid } = false;
@ -990,7 +991,7 @@ public OnPlayerSpawn( playerid )
TextDrawHideForPlayer( playerid, g_CurrentRankTD ); TextDrawHideForPlayer( playerid, g_CurrentRankTD );
TextDrawHideForPlayer( playerid, g_currentXPTD ); TextDrawHideForPlayer( playerid, g_currentXPTD );
if ( p_inMovieMode{ playerid } == false ) if ( ! IsPlayerMovieMode( playerid ) )
{ {
ShowPlayerTogglableTextdraws( playerid ); ShowPlayerTogglableTextdraws( playerid );
ShowPlayerIrresistibleRank( playerid ); ShowPlayerIrresistibleRank( playerid );
@ -3241,12 +3242,8 @@ CMD:emp( playerid, params[ ] )
return 1; return 1;
} }
CMD:moviemode( playerid, params[ ] ) public OnPlayerLoadTextdraws( playerid )
{ {
switch( p_inMovieMode{ playerid } )
{
case true:
{
ShowPlayerTogglableTextdraws( playerid ); ShowPlayerTogglableTextdraws( playerid );
PlayerTextDrawShow( playerid, p_LocationTD[ playerid ] ); PlayerTextDrawShow( playerid, p_LocationTD[ playerid ] );
if ( IsDoubleXP( ) ) TextDrawShowForPlayer( playerid, g_DoubleXPTD ); if ( IsDoubleXP( ) ) TextDrawShowForPlayer( playerid, g_DoubleXPTD );
@ -3257,13 +3254,11 @@ CMD:moviemode( playerid, params[ ] )
if ( p_AdminOnDuty{ playerid } ) TextDrawShowForPlayer( playerid, g_AdminOnDutyTD ); if ( p_AdminOnDuty{ playerid } ) TextDrawShowForPlayer( playerid, g_AdminOnDutyTD );
TextDrawShowForPlayer( playerid, g_WorldDayTD ); TextDrawShowForPlayer( playerid, g_WorldDayTD );
PlayerTextDrawShow( playerid, g_ZoneOwnerTD[ playerid ] ); PlayerTextDrawShow( playerid, g_ZoneOwnerTD[ playerid ] );
for( new i; i < sizeof( g_MovieModeTD ); i ++ ) TextDrawHideForPlayer( playerid, g_MovieModeTD[ i ] ); return 1;
p_inMovieMode{ playerid } = false; }
SendServerMessage( playerid, "Movie mode has been un-toggled." );
CallLocalFunction( "OnPlayerLoadTextdraws", "d", playerid ); public OnPlayerUnloadTextdraws( playerid )
} {
case false:
{
PlayerTextDrawHide( playerid, g_ZoneOwnerTD[ playerid ] ); PlayerTextDrawHide( playerid, g_ZoneOwnerTD[ playerid ] );
HidePlayerTogglableTextdraws( playerid ); HidePlayerTogglableTextdraws( playerid );
PlayerTextDrawHide( playerid, p_LocationTD[ playerid ] ); PlayerTextDrawHide( playerid, p_LocationTD[ playerid ] );
@ -3274,13 +3269,6 @@ CMD:moviemode( playerid, params[ ] )
TextDrawHideForPlayer( playerid, g_MotdTD ); TextDrawHideForPlayer( playerid, g_MotdTD );
TextDrawHideForPlayer( playerid, g_WorldDayTD ); TextDrawHideForPlayer( playerid, g_WorldDayTD );
TextDrawHideForPlayer( playerid, p_FPSCounterTD[ playerid ] ); TextDrawHideForPlayer( playerid, p_FPSCounterTD[ playerid ] );
for( new i; i < sizeof( g_MovieModeTD ); i ++ ) TextDrawShowForPlayer( playerid, g_MovieModeTD[ i ] );
p_inMovieMode{ playerid } = true;
SendServerMessage( playerid, "Movie mode has been toggled." );
CallLocalFunction( "OnPlayerUnloadTextdraws", "d", playerid );
}
}
CallLocalFunction( "OnPlayerMovieMode", "dd", playerid, p_inMovieMode{ playerid } );
return 1; return 1;
} }