Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #define DIALOG_DASHCAMS (9999) // Mude o número em caso de conflito
- new
- pViaturaCamera[ MAX_PLAYERS ],
- pInt[ MAX_PLAYERS ],
- pVW[ MAX_PLAYERS ],
- pListaDashcams[ MAX_PLAYERS ][ 11 ],
- Float:pPos[ MAX_PLAYERS ][ 4 ]
- ;
- new
- PlayerText:dashcamdatahora,
- PlayerText:dashcamcamera
- ;
- public OnFilterScriptInit()
- {
- print( "\n\n\n" );
- print( "*****************************************************" );
- print( "* *" );
- print( "* FS de dashcam nas viaturas. Por: Rodney Francalim *" );
- print( "* *" );
- print( "* [[[ Não remova os créditos, obrigado. ]]] *" );
- print( "* *" );
- print( "*****************************************************" );
- print( "\n\n\n" );
- SetTimer( "TempoServidor", 1000, true );
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerRequestClass( playerid, classid )
- {
- return 1;
- }
- public OnPlayerConnect( playerid )
- {
- pViaturaCamera[ playerid ] = 0;
- pListaDashcams[ playerid ][ 10 ] = 1;
- dashcamdatahora = CreatePlayerTextDraw( playerid, 40.000000, 350.000000, "" );
- PlayerTextDrawBackgroundColor( playerid, dashcamdatahora, 255 );
- PlayerTextDrawFont( playerid, dashcamdatahora, 2 );
- PlayerTextDrawLetterSize( playerid,dashcamdatahora, 1.000000, 4.000000 );
- PlayerTextDrawColor( playerid, dashcamdatahora, -86 );
- PlayerTextDrawSetOutline( playerid, dashcamdatahora, 1 );
- PlayerTextDrawSetProportional( playerid, dashcamdatahora, 1 );
- PlayerTextDrawSetSelectable( playerid, dashcamdatahora, 0 );
- dashcamcamera = CreatePlayerTextDraw( playerid, 600.000000, 350.000000, "" );
- PlayerTextDrawAlignment( playerid, dashcamcamera, 3 );
- PlayerTextDrawBackgroundColor( playerid, dashcamcamera, 255 );
- PlayerTextDrawFont( playerid, dashcamcamera, 2 );
- PlayerTextDrawLetterSize( playerid, dashcamcamera, 1.000000, 4.000000 );
- PlayerTextDrawColor( playerid, dashcamcamera, -86 );
- PlayerTextDrawSetOutline( playerid, dashcamcamera, 1 );
- PlayerTextDrawSetProportional( playerid, dashcamcamera, 1 );
- PlayerTextDrawSetSelectable( playerid, dashcamcamera, 0 );
- PlayerTextDrawHide( playerid, dashcamdatahora );
- PlayerTextDrawHide( playerid, dashcamcamera );
- return 1;
- }
- public OnPlayerDisconnect( playerid, reason )
- {
- if( pViaturaCamera[ playerid ] > 0 )
- DestroyObject( pViaturaCamera[ playerid ]);
- return 1;
- }
- public OnPlayerSpawn( playerid )
- {
- SendClientMessage( playerid, -1, "Este servidor usa o {FF0000}FS {000000}'{FFFFFF}viaturas com dashcam{000000}' {FF8040}v0.2b{FFFFFF}. Por: {0000FF}Rodney Francalim" );
- return 1;
- }
- CMD:sv( playerid ) return cmd_specviatura( playerid );
- CMD:specviatura( playerid )
- {
- new
- str[ 150 ],
- strd[ 12 ],
- celula = -1
- ;
- for( new i = pListaDashcams[ playerid ][ 10 ]; i <= MAX_VEHICLES; ++i )
- {
- if( EUmaViatura( i ))
- {
- pListaDashcams[ playerid ][ ++celula ] = i;
- if( celula >= 10 )
- {
- strcat( str, "Próxima >>" );
- break;
- }
- else
- {
- format( strd, sizeof( strd ), "CAM %d\n", i );
- strcat( str, strd );
- }
- }
- }
- ShowPlayerDialog( playerid, DIALOG_DASHCAMS, DIALOG_STYLE_LIST, "Sistema de dashcams", str, "Escolher", "Deslogar" );
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch( dialogid )
- {
- case DIALOG_DASHCAMS:
- {
- if( response )
- {
- switch( listitem )
- {
- case 0 .. 9:
- {
- new
- str[ 64 ],
- Float:vAng,
- vVW,
- vehicleid = pListaDashcams[ playerid ][ listitem ]
- ;
- pListaDashcams[ playerid ][ 10 ] = pListaDashcams[ playerid ][ 0 ];
- if( pViaturaCamera[ playerid ] != 0 )
- DestroyObject( pViaturaCamera[ playerid ]);
- else
- {
- SendClientMessage( playerid, -1, "CENTRAL: Logando no sistema, aguarde..." );
- 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( vehicleid, vAng );
- vVW = GetVehicleVirtualWorld( vehicleid );
- SetPlayerFacingAngle( playerid, vAng );
- SetPlayerVirtualWorld( playerid, vVW );
- SetCameraBehindPlayer( playerid );
- PlayerSpectateVehicle( playerid, vehicleid );
- pViaturaCamera[ playerid ] = CreateObject( 19300, 0, 0, 0, 0, 0, 0 );
- DashCamPos( pViaturaCamera[ playerid ], vehicleid );
- AttachCameraToObject( playerid, pViaturaCamera[ playerid ]);
- format( str, sizeof( str ), "CAM %d", vehicleid );
- PlayerTextDrawSetString( playerid, dashcamcamera, str );
- PlayerTextDrawShow( playerid, dashcamcamera );
- }
- case 10:
- {
- cmd_sv( playerid );
- }
- }
- }
- else
- {
- pListaDashcams[ playerid ][ 10 ] = 1;
- if( pViaturaCamera[ playerid ] != 0 )
- {
- TogglePlayerSpectating( playerid, false );
- DestroyObject( pViaturaCamera[ playerid ]);
- pViaturaCamera[ playerid ] = 0;
- 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, dashcamdatahora );
- PlayerTextDrawHide( playerid, dashcamcamera );
- SendClientMessage( playerid, -1, "CENTRAL: Você deslogou do sistema de câmeras." );
- }
- else
- SendClientMessage( playerid, 0xFF0000AA, "CENTRAL: Você não estava logado no sistema de câmeras." );
- }
- }
- }
- }
- stock DashCamPos( objectid, vehicleid )
- {
- if( GetVehicleModel( vehicleid ) == 427 )
- return AttachObjectToVehicle( objectid, vehicleid, 0, 1.65, 0.9, 0, 0, 0 );
- else if( GetVehicleModel( vehicleid ) == 490 )
- return AttachObjectToVehicle( objectid, vehicleid, 0, 1.3, 0.7, 0, 0, 0 );
- else if( GetVehicleModel( vehicleid ) == 596 || GetVehicleModel( vehicleid ) == 597 || GetVehicleModel( vehicleid ) == 598 )
- return AttachObjectToVehicle( objectid, vehicleid, 0, 1, 0.5, 0, 0, 0 );
- else if( GetVehicleModel( vehicleid ) == 599 )
- return AttachObjectToVehicle( objectid, vehicleid, 0, 0.85, 0.75, 0, 0, 0 );
- else
- return AttachObjectToVehicle( objectid, vehicleid, 0, 0, 0, 0, 0, 0 );
- }
- stock EUmaViatura( vehicleid )
- {
- if( GetVehicleModel( vehicleid ) == 427 || GetVehicleModel( vehicleid ) == 490 || GetVehicleModel( vehicleid ) == 596 ||
- GetVehicleModel( vehicleid ) == 597 || GetVehicleModel( vehicleid ) == 598 || GetVehicleModel( vehicleid ) == 599 )
- return true;
- return false;
- }
- forward TempoServidor();
- public TempoServidor()
- {
- 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( pViaturaCamera[ p ] != 0 )
- {
- PlayerTextDrawSetString( p, dashcamdatahora, str );
- PlayerTextDrawShow( p, dashcamdatahora );
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement