19.01.2013, 07:29
(
Последний раз редактировалось Mr_Zlodei; 07.02.2014 в 03:53.
)
Hello, I want to show off your speedometer.
I do not know English and use a translator: D, I'm sorry for the mistakes ..
If there is no image, please click here
Download:Click Here
new script here https://sampforum.blast.hk/showthread.php?tid=493103
I do not know English and use a translator: D, I'm sorry for the mistakes ..
If there is no image, please click here
PHP код:
#include a_samp
#define L_MAX_COUNT 105
new
L_count[ ][ ] = {
"0", "20", "40", "60", "80", "100", "120",
"140", "160", "180", "200", "220"
},
Text: L_draw_speed[ 14 ],
Text: L_player_draw[ MAX_PLAYERS ],
Float: L_speed_update[ 4 ],
L_text_update[ 155 ] ;
public OnFilterScriptInit ( )
{
L_draw_speed[ 0 ] = TextDrawCreate ( 190, 400.0, L_count[ 0 ] ) ;
L_speed_update[ 0 ] = 210 ;
for ( new i ; i != 12 ; ++ i )
{
if ( i ) L_draw_speed[ i ] = TextDrawCreate ( L_speed_update[ 0 ], 400.0, L_count[ i ] ), L_speed_update[ 0 ] += 30.0 ;
TextDrawColor ( L_draw_speed[ i ], 0xDEDDDC55 ), TextDrawAlignment ( L_draw_speed[ i ], 0 ) ;
TextDrawBackgroundColor ( L_draw_speed[ i ],0x00000011 ), TextDrawSetOutline ( L_draw_speed[ i ], 1 ) ;
TextDrawSetProportional ( L_draw_speed[ i ], 1 ), TextDrawSetShadow ( L_draw_speed[ i ], 1 ) ;
TextDrawFont ( L_draw_speed[ i ], 2 ), TextDrawLetterSize ( L_draw_speed[ i ], 0.3, 1.1 ) ;
}
L_speed_update[ 0 ] = 408.0 ;
for ( new i = 12 ; i != 14; ++ i )
L_draw_speed[ i ] = TextDrawCreate ( 130.0, L_speed_update[ 0 ], "-" ),
TextDrawColor ( L_draw_speed[ i ], 0xDEDDDCFF ), TextDrawAlignment ( L_draw_speed[ i ], 0 ),
TextDrawBackgroundColor ( L_draw_speed[ i ], 0x00000022 ), TextDrawSetOutline ( L_draw_speed[ i ], 1 ),
TextDrawSetProportional ( L_draw_speed[ i ] , 1 ), TextDrawSetShadow ( L_draw_speed[ i ], 1 ),
TextDrawFont ( L_draw_speed[ i ], 1 ), TextDrawLetterSize ( L_draw_speed[ i ], 43.0, 0.8 ), L_speed_update[ 0 ] -= 13.0 ;
SetTimer ( "SpeedUpdate", 50, false ) ;
return 1;
}
public OnFilterScriptExit ( )
{
for ( new i ; i != sizeof L_draw_speed ; ++ i )
TextDrawDestroy ( L_draw_speed[ i ] ) ;
return 1 ;
}
public OnPlayerConnect ( playerid )
{
L_player_draw[ playerid ] = TextDrawCreate( 190.0, 377.0, "-" ), TextDrawAlignment ( L_player_draw[playerid], 0 ) ;
TextDrawBackgroundColor ( L_player_draw[ playerid ],0x00000022 ), TextDrawSetOutline ( L_player_draw[playerid], 1 ) ;
TextDrawSetProportional ( L_player_draw[ playerid ], 1 ), TextDrawSetShadow ( L_player_draw[ playerid ], 1 ) ;
TextDrawFont ( L_player_draw[ playerid ], 2 ), TextDrawLetterSize( L_player_draw[ playerid ], 0.3, 5.5 ) ;
return 1 ;
}
public OnPlayerDisconnect ( playerid, reason )
{
TextDrawDestroy( L_player_draw[playerid] ) ;
return 1 ;
}
public OnPlayerStateChange ( playerid, newstate, oldstate )
{
if ( newstate == 2 )
{
for ( new i ; i != 14; i ++ ) TextDrawShowForPlayer ( playerid, L_draw_speed[ i ] ) ;
TextDrawShowForPlayer ( playerid, L_player_draw[ playerid ] ) ;
}
else
{
for ( new i ; i != 14; ++ i ) TextDrawHideForPlayer ( playerid, L_draw_speed[ i ] ) ;
TextDrawHideForPlayer( playerid, L_player_draw[ playerid ] ) ;
}
return 1 ;
}
forward SpeedUpdate ( ) ;
public SpeedUpdate ( )
{
for ( new i = 0 ; i != MAX_PLAYERS ; i++ )
{
if ( !IsPlayerConnected( i ) ) continue;
if ( GetPlayerState( i ) != 2 ) continue;
GetVehicleVelocity ( GetPlayerVehicleID( i ),L_speed_update[ 0 ],L_speed_update[ 1 ],L_speed_update[ 2 ] ) ;
L_speed_update[ 3 ] = floatsqroot ( floatpower ( floatabs ( L_speed_update[ 0 ] ), 2.0 ) + floatpower ( floatabs ( L_speed_update[ 1 ] ), 2.0 ) + floatpower ( floatabs ( L_speed_update[ 2 ] ), 2.0 ) ) * 179.28625 ;
L_Update_Text( i, floatround ( L_speed_update[ 3 ] * 0.4 ) ) ;
}
SetTimer ( "SpeedUpdate", 50, false ) ;
return 1;
}
L_Update_Text ( i, count )
{
new L_index_count[ 150 ] = { ' ', ... } ;
if ( count < L_MAX_COUNT - 1 ) L_index_count[ count ] = '-' ;
else L_index_count[ L_MAX_COUNT - 1 ] = '-' ;
L_text_update[ 0 ] = EOS ;
format ( L_text_update, 155, "%s", L_index_count ) ;
TextDrawSetString ( L_player_draw[ i ], L_text_update ) ;
}
new script here https://sampforum.blast.hk/showthread.php?tid=493103