Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- new
- pCopVehCam[ MAX_PLAYERS ],
- pInt[ MAX_PLAYERS ],
- pVW[ MAX_PLAYERS ],
- Float:pPos[ MAX_PLAYERS ][ 4 ]
- ;
- new
- PlayerText:dashcamdatetime,
- PlayerText:dashcamcam
- ;
- public OnFilterScriptInit()
- {
- print( "\n\n\n" );
- print( "*****************************************************" );
- print( "* *" );
- print( "* Dashcam's cop vehicle FS. By: Rodney Francalim *" );
- print( "* *" );
- print( "* [[[ Don't remove the credits, thanks. ]]] *" );
- print( "* *" );
- print( "*****************************************************" );
- print( "\n\n\n" );
- SetTimer( "ServerTime", 1000, true );
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerRequestClass( playerid, classid )
- {
- return 1;
- }
- public OnPlayerConnect( playerid )
- {
- pCopVehCam[ playerid ] = 0;
- dashcamdatetime = CreatePlayerTextDraw( playerid, 40.000000, 350.000000, "" );
- PlayerTextDrawBackgroundColor( playerid, dashcamdatetime, 255 );
- PlayerTextDrawFont( playerid, dashcamdatetime, 2 );
- PlayerTextDrawLetterSize( playerid, dashcamdatetime, 1.000000, 4.000000 );
- PlayerTextDrawColor( playerid, dashcamdatetime, -86 );
- PlayerTextDrawSetOutline( playerid, dashcamdatetime, 1 );
- PlayerTextDrawSetProportional( playerid, dashcamdatetime, 1 );
- PlayerTextDrawSetSelectable( playerid, dashcamdatetime, 0 );
- dashcamcam = CreatePlayerTextDraw( playerid, 600.000000, 350.000000, "" );
- PlayerTextDrawAlignment( playerid, dashcamcam, 3 );
- PlayerTextDrawBackgroundColor( playerid, dashcamcam, 255 );
- PlayerTextDrawFont( playerid, dashcamcam, 2 );
- PlayerTextDrawLetterSize( playerid, dashcamcam, 1.000000, 4.000000 );
- PlayerTextDrawColor( playerid, dashcamcam, -86 );
- PlayerTextDrawSetOutline( playerid, dashcamcam, 1 );
- PlayerTextDrawSetProportional( playerid, dashcamcam, 1 );
- PlayerTextDrawSetSelectable( playerid, dashcamcam, 0 );
- PlayerTextDrawHide( playerid, dashcamdatetime );
- PlayerTextDrawHide( playerid, dashcamcam );
- return 1;
- }
- public OnPlayerDisconnect( playerid, reason )
- {
- if( pCopVehCam[ playerid ] > 0 )
- DestroyObject( pCopVehCam[ playerid ]);
- return 1;
- }
- public OnPlayerSpawn( playerid )
- {
- SendClientMessage( playerid, -1, "This server uses the {000000}'{FFFFFF}Dashcam's cop vehicle{000000}' {FF0000}FS {FF8040}v0.1b{FFFFFF}. By: {0000FF}Rodney Francalim" );
- return 1;
- }
- CMD:scv( playerid, params[]) return cmd_speccopveh( playerid, params );
- CMD:speccopveh( playerid, params[])
- {
- if( sscanf( params, "d", params[ 0 ])) return SendClientMessage( playerid, 0xFFFF00AA, "USE: /speccopveh [CAMERA]" );
- if( !IsACopVeh( params[ 0 ]) && params[ 0 ] != 0 ) return SendClientMessage( playerid, 0xFF0000AA, "This vehicle doesn't exist, or isn't a cop vehicle!" );
- if( params[ 0 ] != 0 )
- {
- new
- str[ 64 ],
- Float:vAng,
- vVW
- ;
- if( pCopVehCam[ playerid ] != 0 )
- DestroyObject( pCopVehCam[ playerid ]);
- else
- {
- SendClientMessage( playerid, -1, "CENTRAL: Logging on system, wait..." );
- TogglePlayerSpectating( playerid, true );
- GetPlayerPos( playerid, pPos[ playerid ][ 0 ], pPos[ playerid ][ 1 ], pPos[ playerid ][ 2 ]);
- GetPlayerFacingAngle( playerid, pPos[ playerid ][ 3 ]);
- pInt[ playerid ] = GetPlayerInterior( playerid );
- pVW[ playerid ] = GetPlayerVirtualWorld( playerid );
- }
- GetVehicleZAngle( params[ 0 ], vAng );
- vVW = GetVehicleVirtualWorld( params[ 0 ]);
- SetPlayerFacingAngle( playerid, vAng );
- SetPlayerVirtualWorld( playerid, vVW );
- SetCameraBehindPlayer( playerid );
- PlayerSpectateVehicle( playerid, params[ 0 ]);
- pCopVehCam[ playerid ] = CreateObject( 19300, 0, 0, 0, 0, 0, 0 );
- AttachObjectToVehicle( pCopVehCam[ playerid ], params[ 0 ], 0, 1, 0.5, 0, 0, 0 );
- AttachCameraToObject( playerid, pCopVehCam[ playerid ]);
- format( str, sizeof( str ), "CAM %d", params[ 0 ]);
- PlayerTextDrawSetString( playerid, dashcamcam, str );
- PlayerTextDrawShow( playerid, dashcamcam );
- }
- else
- {
- if( pCopVehCam[ playerid ] != 0 )
- {
- DestroyObject( pCopVehCam[ playerid ]);
- pCopVehCam[ playerid ] = 0;
- TogglePlayerSpectating( playerid, false );
- SetPlayerPos( playerid, pPos[ playerid ][ 0 ], pPos[ playerid ][ 1 ], pPos[ playerid ][ 2 ]);
- SetPlayerFacingAngle( playerid, pPos[ playerid ][ 3 ]);
- SetPlayerInterior( playerid, pInt[ playerid ]);
- SetPlayerVirtualWorld( playerid, pVW[ playerid ]);
- SetCameraBehindPlayer( playerid );
- PlayerTextDrawHide( playerid, dashcamdatetime );
- PlayerTextDrawHide( playerid, dashcamcam );
- SendClientMessage( playerid, -1, "CENTRAL: You shutted down the system." );
- }
- else return SendClientMessage( playerid, 0xFF0000AA, "CENTRAL: You weren't logged on cam's system." );
- }
- return 1;
- }
- stock IsACopVeh( vehicleid )
- {
- if( GetVehicleModel( vehicleid ) == 596 || GetVehicleModel( vehicleid ) == 597 || GetVehicleModel( vehicleid ) == 598 )
- return true;
- return false;
- }
- forward ServerTime();
- public ServerTime()
- {
- new
- t[ 6 ],
- str[ 32 ]
- ;
- gettime( t[ 3 ], t[ 4 ], t[ 5 ]);
- getdate( t[ 2 ], t[ 1 ], t[ 0 ]);
- format( str, sizeof( str ), "%02d/%02d/%d~n~%02d:%02d %s", t[ 1 ], t[ 0 ], t[ 2 ], t[ 3 ], t[ 4 ], t[ 3 ] >= 12 ? ( "PM" ) : ( "AM" ));
- for( new p = 0; p < MAX_PLAYERS; ++p )
- {
- if( pCopVehCam[ p ] != 0 )
- {
- PlayerTextDrawSetString( p, dashcamdatetime, str );
- PlayerTextDrawShow( p, dashcamdatetime );
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement