Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //American Dream Roleplay Selfie System
- #define FILTERSCRIPT
- #include < a_samp >
- #include < zcmd >
- //Defines
- #define PRESSED(%0) \
- (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
- //Variables
- new
- bool:variable_selfie[ MAX_PLAYERS ],
- bool:variable_movehead[ MAX_PLAYERS ],
- Float:variable_degree[ MAX_PLAYERS ],
- Float:variable_x[ MAX_PLAYERS ],
- Float:variable_y[ MAX_PLAYERS ],
- Float:variable_z[ MAX_PLAYERS ]
- ;
- const Float: constant_radius = 1.4,
- Float: constant_velocity = 1.25,
- Float: constant_height = 1.0
- ;
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_RED 0xFF0000AA
- public
- OnFilterScriptInit( )
- {
- print("\n--------------------------------------");
- for ( new i = 0; i < MAX_PLAYERS; i++ )
- {
- variable_selfie[i] = false;
- }
- return 1;
- }
- public
- OnFilterScriptExit( )
- {
- for ( new i = 0; i < MAX_PLAYERS; i++)
- {
- variable_selfie[ i ] = false;
- }
- return 1;
- }
- public
- OnPlayerConnect( playerid )
- {
- variable_selfie[ playerid ] = false;
- return 1;
- }
- public
- OnPlayerDisconnect( playerid, reason )
- {
- variable_selfie[ playerid ] = false;
- return 1;
- }
- COMMAND:selfie( playerid, params[ ] )
- {
- if ( variable_selfie[ playerid ] == false )
- {
- GetPlayerPos (playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ] );
- static
- Float: n1X,
- Float: n1Y
- ;
- if ( variable_degree[ playerid ] >= 360 ) variable_degree[ playerid ] = 0;
- variable_degree[ playerid ] += constant_velocity;
- n1X = variable_x[ playerid ] + constant_radius * floatcos ( variable_degree[ playerid ], degrees );
- n1Y = variable_y[ playerid ] + constant_radius * floatsin ( variable_degree[ playerid ], degrees );
- SetPlayerCameraPos ( playerid, n1X, n1Y, variable_z[ playerid ] + constant_height );
- SetPlayerCameraLookAt ( playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ] += 1 );
- SetPlayerFacingAngle ( playerid, variable_degree[ playerid ] - 90.0 );
- variable_selfie [ playerid ] = true;
- ApplyAnimation ( playerid, "PED", "gang_gunstand", 4.1, 1, 1, 1, 1, 1, 1 );
- SendClientMessage ( playerid, COLOR_WHITE, "<!> Use {ADC3E7}/selfie{FFFFFF} to return back to normal mode" );
- SendClientMessage ( playerid, COLOR_WHITE, "<!> Press keys {ADC3E7}YES / NO{FFFFFF} to control the camera's position" );
- SendClientMessage ( playerid, COLOR_WHITE, "<!> Use {ADC3E7}/stophead{FFFFFF} to stop your head from moving" );
- return 1;
- }
- if( variable_selfie[ playerid ] == true )
- {
- TogglePlayerControllable ( playerid, 1);
- SetCameraBehindPlayer ( playerid );
- variable_selfie[ playerid ] = false;
- ApplyAnimation ( playerid, "PED", "ATM", 4.1, 0, 1, 1, 0, 1, 1 );
- return 1;
- }
- return 1;
- }
- COMMAND:sf( playerid, params[ ] )
- {
- return cmd_selfie( playerid, params );
- }
- COMMAND:stophead( playerid, params[ ] )
- {
- if( variable_selfie[ playerid ] == true && variable_movehead[ playerid ] == false)
- {
- TogglePlayerControllable ( playerid, 0);
- variable_movehead[ playerid ] = true;
- }
- return 1;
- }
- COMMAND:sh( playerid, params[ ] )
- {
- return cmd_stophead( playerid, params );
- }
- public
- OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
- {
- if ( variable_selfie [ playerid ] == true )
- {
- if( PRESSED( KEY_YES ) )
- {
- GetPlayerPos ( playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ]);
- static Float: n1X, Float: n1Y;
- if ( variable_degree[ playerid ] >= 360 ) variable_degree[ playerid ] = 0;
- variable_degree[ playerid ] += constant_velocity;
- n1X = variable_x[ playerid ] + constant_radius * floatcos( variable_degree[ playerid ], degrees );
- n1Y = variable_y[ playerid ] + constant_radius * floatsin( variable_degree[ playerid ], degrees );
- SetPlayerCameraPos ( playerid, n1X, n1Y, variable_z[ playerid ] + constant_height );
- SetPlayerCameraLookAt ( playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ] += 1 );
- SetPlayerFacingAngle ( playerid, variable_degree[ playerid ] - 90.0 );
- }
- if ( PRESSED( KEY_NO ) )
- {
- GetPlayerPos ( playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ] );
- static Float: n1X, Float: n1Y;
- if ( variable_degree[ playerid ] >= 360 ) variable_degree[ playerid ] = 0;
- variable_degree[ playerid ] -= constant_velocity;
- n1X = variable_x[ playerid ] + constant_radius * floatcos ( variable_degree[ playerid ], degrees );
- n1Y = variable_y[ playerid ] + constant_radius * floatsin( variable_degree[ playerid ], degrees );
- SetPlayerCameraPos ( playerid, n1X, n1Y, variable_z[ playerid ] + constant_height );
- SetPlayerCameraLookAt ( playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ]+1 );
- SetPlayerFacingAngle ( playerid, variable_degree[ playerid ] - 90.0 );
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement