View difference between Paste ID: NzCh5mNZ and nmmRYbn1
SHOW: | | - or go back to the newest paste.
1
#include    <a_samp>
2
#include    <zcmd>
3
#include    <sscanf2>
4
5-
native IsValidVehicle(vehicleid);
5+
6
new
7
    pViaturaCamera[ MAX_PLAYERS ],
8
    pInt[ MAX_PLAYERS ],
9
    pVW[ MAX_PLAYERS ],
10
    Float:pPos[ MAX_PLAYERS ][ 4 ]
11
;
12
13
new
14
    PlayerText:dashcamdatahora,
15
    PlayerText:dashcamcamera
16
;
17
18
public OnFilterScriptInit()
19
{
20
	print( "\n\n\n" );
21
    print( "*****************************************************" );
22
    print( "*                                                   *" );
23
	print( "* FS de dashcam nas viaturas. Por: Rodney Francalim *" );
24
    print( "*                                                   *" );
25
    print( "*     [[[ Não remova os créditos, obrigado. ]]]     *" );
26
    print( "*                                                   *" );
27
	print( "*****************************************************" );
28
    print( "\n\n\n" );
29
30
    SetTimer( "TempoServidor", 1000, true );
31
32
    return 1;
33
}
34
35
public OnFilterScriptExit()
36
{
37
	return 1;
38
}
39
40
public OnPlayerRequestClass( playerid, classid )
41
{
42
	return 1;
43
}
44
45
public OnPlayerConnect( playerid )
46
{
47
    pViaturaCamera[ playerid ] = 0;
48
49
	dashcamdatahora = CreatePlayerTextDraw( playerid, 40.000000, 350.000000, "" );
50
    PlayerTextDrawBackgroundColor( playerid, dashcamdatahora, 255 );
51
    PlayerTextDrawFont( playerid, dashcamdatahora, 2 );
52
    PlayerTextDrawLetterSize( playerid,dashcamdatahora, 1.000000, 4.000000 );
53
    PlayerTextDrawColor( playerid, dashcamdatahora, -86 );
54
    PlayerTextDrawSetOutline( playerid, dashcamdatahora, 1 );
55
    PlayerTextDrawSetProportional( playerid, dashcamdatahora, 1 );
56
    PlayerTextDrawSetSelectable( playerid, dashcamdatahora, 0 );
57
58
    dashcamcamera = CreatePlayerTextDraw( playerid, 600.000000, 350.000000, "" );
59
    PlayerTextDrawAlignment( playerid, dashcamcamera, 3 );
60
    PlayerTextDrawBackgroundColor( playerid, dashcamcamera, 255 );
61
    PlayerTextDrawFont( playerid, dashcamcamera, 2 );
62
    PlayerTextDrawLetterSize( playerid, dashcamcamera, 1.000000, 4.000000 );
63
    PlayerTextDrawColor( playerid, dashcamcamera, -86 );
64
    PlayerTextDrawSetOutline( playerid, dashcamcamera, 1 );
65
    PlayerTextDrawSetProportional( playerid, dashcamcamera, 1 );
66
    PlayerTextDrawSetSelectable( playerid, dashcamcamera, 0 );
67
68
    PlayerTextDrawHide( playerid, dashcamdatahora );
69
    PlayerTextDrawHide( playerid, dashcamcamera );
70
71
    return 1;
72
}
73
74
public OnPlayerDisconnect( playerid, reason )
75
{
76
    if( pViaturaCamera[ playerid ] > 0 )
77
        DestroyObject( pViaturaCamera[ playerid ]);
78
79
	return 1;
80
}
81
82
public OnPlayerSpawn( playerid )
83
{
84
    SendClientMessage( playerid, -1, "Este servidor usa o {FF0000}FS {000000}'{FFFFFF}viaturas com dashcam{000000}' {FF8040}v0.1b{FFFFFF}. Por: {0000FF}Rodney Francalim" );
85
	return 1;
86
}
87
88
CMD:sv( playerid, params[]) return cmd_specviatura( playerid, params );
89
CMD:specviatura( playerid, params[])
90
{
91
    if( sscanf( params, "d", params[ 0 ])) return SendClientMessage( playerid, 0xFFFF00AA, "USE: /specviatura [CAMERA]" );
92
    if( !EUmaViatura( params[ 0 ]) && params[ 0 ] != 0 ) return SendClientMessage( playerid, 0xFF0000AA, "Este veículo não existe, ou não é uma viatura!" );
93
    if( params[ 0 ] != 0 )
94
    {
95
        new
96
            str[ 64 ],
97
            Float:vAng,
98
            vVW
99
        ;
100
101
        if( pViaturaCamera[ playerid ] != 0 )
102
            DestroyObject( pViaturaCamera[ playerid ]);
103
        else
104
        {
105
            SendClientMessage( playerid, -1, "CENTRAL: Logando no sistema, aguarde..." );
106
            TogglePlayerSpectating( playerid, true );
107
            GetPlayerPos( playerid, pPos[ playerid ][ 0 ], pPos[ playerid ][ 1 ], pPos[ playerid ][ 2 ]);
108
            GetPlayerFacingAngle( playerid, pPos[ playerid ][ 3 ]);
109
            pInt[ playerid ] = GetPlayerInterior( playerid );
110
            pVW[ playerid ] = GetPlayerVirtualWorld( playerid );
111
        }
112
113
        GetVehicleZAngle( params[ 0 ], vAng );
114
        vVW = GetVehicleVirtualWorld( params[ 0 ]);
115
        SetPlayerFacingAngle( playerid, vAng );
116
        SetPlayerVirtualWorld( playerid, vVW );
117
        SetCameraBehindPlayer( playerid );
118
119
        PlayerSpectateVehicle( playerid, params[ 0 ]);
120
        pViaturaCamera[ playerid ] = CreateObject( 19300, 0, 0, 0, 0, 0, 0 );
121
        AttachObjectToVehicle( pViaturaCamera[ playerid ], params[ 0 ], 0, 1, 0.5, 0, 0, 0 );
122
        AttachCameraToObject( playerid, pViaturaCamera[ playerid ]);
123
124
        format( str, sizeof( str ), "CAM %d", params[ 0 ]);
125
        PlayerTextDrawSetString( playerid, dashcamcamera, str );
126
        PlayerTextDrawShow( playerid, dashcamcamera );
127
    }
128
    else
129
    {
130
        if( pViaturaCamera[ playerid ] != 0 )
131
        {
132
            DestroyObject( pViaturaCamera[ playerid ]);
133
            pViaturaCamera[ playerid ] = 0;
134
135
            TogglePlayerSpectating( playerid, false );
136
            SetPlayerPos( playerid, pPos[ playerid ][ 0 ], pPos[ playerid ][ 1 ], pPos[ playerid ][ 2 ]);
137
            SetPlayerFacingAngle( playerid, pPos[ playerid ][ 3 ]);
138
            SetPlayerInterior( playerid, pInt[ playerid ]);
139
            SetPlayerVirtualWorld( playerid, pVW[ playerid ]);
140
            SetCameraBehindPlayer( playerid );
141
142
            PlayerTextDrawHide( playerid, dashcamdatahora );
143
            PlayerTextDrawHide( playerid, dashcamcamera );
144
145
            SendClientMessage( playerid, -1, "CENTRAL: Você deslogou do sistema de câmeras." );
146
        }
147
        else return SendClientMessage( playerid, 0xFF0000AA, "CENTRAL: Você não estava logado no sistema de câmeras." );
148
    }
149
150
    return 1;
151
}
152
153
stock EUmaViatura( vehicleid )
154
{
155
    if( GetVehicleModel( vehicleid ) == 596 || GetVehicleModel( vehicleid ) == 597 || GetVehicleModel( vehicleid ) == 598 )
156-
    if( !IsValidVehicle( vehicleid )) return false;
156+
157
158
    return false;
159
}
160
161
forward TempoServidor();
162
public TempoServidor()
163
{
164
    new
165
        t[ 6 ],
166
        str[ 32 ]
167
    ;
168
169
    gettime( t[ 3 ], t[ 4 ], t[ 5 ]);
170
    getdate( t[ 2 ], t[ 1 ], t[ 0 ]);
171
172
    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" ));
173
    for( new p = 0; p < MAX_PLAYERS; ++p )
174
    {
175
        if( pViaturaCamera[ p ] != 0 )
176
        {
177
            PlayerTextDrawSetString( p, dashcamdatahora, str );
178
            PlayerTextDrawShow( p, dashcamdatahora );
179
        }
180
    }
181
182
    return 1;
183
}