Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //______________________________________________________________________________
- #if defined Digital_Clock_v_1_0
- // o.OOOo. ooOoOOo .oOOOo. ooOoOOo oOoOOoOOo Oo o
- O `o O .O o O o o O O
- // o O o o o o O o o
- O o O O O O oOooOoOo o
- // o O o O .oOOo o o o O O
- O o O o. O O O O o O
- // o .O' O O. oO O O o O o .
- OooOO' ooOOoOo `OooO' ooOOoOo o' O. O OOoOooO
- // Made by DarkyTheAngel aka Darky!
- // .oOOOo. o .oOOOo. .oOOOo. `o O
- .O o O .O o. .O o o O
- // o o O o o O O
- o o o O o oOo
- // o O O o o o o
- O O o O O O O
- // `o .o o . `o O' `o .o o o
- `OoooO' OOoOooO `OoooO' `OoooO' O O
- #endif
- //______________________________________________________________________________
- #include " a_samp "
- #include " zcmd "
- //______________________________________________________________________________
- #define W "{FFFFFF}"
- #define R "{A10000}"
- #define G "{3EA100}"
- //______________________________________________________________________________
- new
- Text:ClockTextdraw [ 8 ] ,
- StartClock [ MAX_PLAYERS ] ,
- StopClock [ MAX_PLAYERS ] ,
- bool:IsActive [ MAX_PLAYERS ]
- ;
- //______________________________________________________________________________
- public OnFilterScriptInit ( )
- {
- ClockTextdraw [ 0 ] = TextDrawCreate ( 489.375000 , 385.583404 , "_" ) ;
- TextDrawLetterSize ( ClockTextdraw [ 0 ] , 0.536248 , 4.434998 ) ;
- TextDrawTextSize ( ClockTextdraw [ 0 ] , 581.875000 , 1.749999 ) ;
- TextDrawUseBox ( ClockTextdraw [ 0 ] , true ) ;
- TextDrawBoxColor ( ClockTextdraw [ 0 ] , 255 ) ;
- TextDrawSetOutline ( ClockTextdraw [ 0 ] , -1 ) ;
- //______________________________________________________________________________
- ClockTextdraw [ 1 ] = TextDrawCreate ( 580.625000 , 371.000030 , ")" ) ;
- TextDrawLetterSize ( ClockTextdraw [ 1 ] , 0.474375 , 6.126666 ) ;
- TextDrawFont ( ClockTextdraw [ 1 ] , 1 ) ;
- TextDrawColor ( ClockTextdraw [ 1 ] , 255 ) ;
- TextDrawSetOutline ( ClockTextdraw [ 1 ] , 1 ) ;
- TextDrawFont ( ClockTextdraw [ 1 ] , 1 ) ;
- TextDrawAlignment ( ClockTextdraw [ 1 ] , 1 ) ;
- TextDrawSetShadow ( ClockTextdraw [ 1 ] , 0 ) ;
- //______________________________________________________________________________
- ClockTextdraw [ 2 ] = TextDrawCreate ( 484.125000 , 372.000030 , "(" ) ;
- TextDrawLetterSize ( ClockTextdraw [ 2 ] , 0.474375 , 6.126666 ) ;
- TextDrawFont ( ClockTextdraw [ 2 ] , 1 ) ;
- TextDrawColor ( ClockTextdraw [ 2 ] , 255 ) ;
- TextDrawSetOutline ( ClockTextdraw [ 2 ] , 1 ) ;
- TextDrawFont ( ClockTextdraw [ 2 ] , 1 ) ;
- TextDrawAlignment ( ClockTextdraw [ 2 ] , 1 ) ;
- TextDrawSetShadow ( ClockTextdraw [ 2 ] , 0 ) ;
- //______________________________________________________________________________
- ClockTextdraw [ 3 ] = TextDrawCreate ( 491.250000 , 387.916748 , "_" ) ;
- TextDrawLetterSize ( ClockTextdraw [ 3 ] , 0.365624 , -0.266665 ) ;
- TextDrawTextSize ( ClockTextdraw [ 3 ] , 579.375000 , -6.416666 ) ;
- TextDrawColor ( ClockTextdraw [ 3 ] , 1296911648 ) ;
- TextDrawUseBox ( ClockTextdraw [ 3 ] , true ) ;
- TextDrawBoxColor ( ClockTextdraw [ 3 ] , 1296911648 ) ;
- //______________________________________________________________________________
- ClockTextdraw [ 4 ] = TextDrawCreate ( 493.500000 , 424.833221 , "_" ) ;
- TextDrawLetterSize ( ClockTextdraw [ 4 ] , 0.365624 , -0.266665 ) ;
- TextDrawTextSize ( ClockTextdraw [ 4 ] , 579.375000 , -6.416666 ) ;
- TextDrawColor ( ClockTextdraw [ 4 ] , 1296911648 ) ;
- TextDrawUseBox ( ClockTextdraw [ 4 ] , true ) ;
- TextDrawBoxColor ( ClockTextdraw [ 4 ] , 1296911648 ) ;
- //______________________________________________________________________________
- ClockTextdraw [ 5 ] = TextDrawCreate ( 490.000000 , 385.000061 , "99:99" ) ;
- TextDrawLetterSize ( ClockTextdraw [ 5 ] , 0.721875 , 3.682500 ) ;
- TextDrawColor ( ClockTextdraw [ 5 ] , 1296911664 ) ;
- TextDrawFont ( ClockTextdraw [ 5 ] , 2 ) ;
- //______________________________________________________________________________
- ClockTextdraw [ 6 ] = TextDrawCreate ( 529.375000 , 388.500061 , ":" ) ;
- TextDrawLetterSize ( ClockTextdraw [ 6 ] , 0.679375 , 3.017501 ) ;
- TextDrawColor ( ClockTextdraw [ 6 ] , 7709695 ) ;
- TextDrawSetOutline ( ClockTextdraw [ 6 ] , 1 ) ;
- TextDrawFont ( ClockTextdraw [ 6 ] , 2 ) ;
- //______________________________________________________________________________
- ClockTextdraw [ 7 ] = TextDrawCreate ( 490.625000 , 387.916656 , "00 00" ) ;
- TextDrawLetterSize ( ClockTextdraw [ 7 ] , 0.705000 , 3.332500 ) ;
- TextDrawColor ( ClockTextdraw [ 7 ] , 7709695 ) ;
- TextDrawSetOutline ( ClockTextdraw [ 7 ] , 1 ) ;
- TextDrawFont ( ClockTextdraw [ 7 ] , 2 ) ;
- //______________________________________________________________________________
- SetTimer ( "GetPlayerTimeEx" , 1000 , true ) ;
- return ( 1 ) ;
- }
- //______________________________________________________________________________
- public OnPlayerDisconnect ( playerid , reason )
- {
- KillTimer ( StartClock [ playerid ] ) ;
- KillTimer ( StopClock [ playerid ] ) ;
- IsActive [ playerid ] = false ;
- return ( 1 ) ;
- }
- //______________________________________________________________________________
- public OnPlayerSpawn ( playerid )
- {
- StartClock [ playerid ] = SetTimerEx ( "ActiveClock" , 350 , 0 , "i" , playerid ) ;
- TextDrawShowForPlayer ( playerid , ClockTextdraw [ 0 ] ) ;
- TextDrawShowForPlayer ( playerid , ClockTextdraw [ 1 ] ) ;
- TextDrawShowForPlayer ( playerid , ClockTextdraw [ 2 ] ) ;
- TextDrawShowForPlayer ( playerid , ClockTextdraw [ 3 ] ) ;
- TextDrawShowForPlayer ( playerid , ClockTextdraw [ 4 ] ) ;
- TextDrawShowForPlayer ( playerid , ClockTextdraw [ 5 ] ) ;
- TextDrawShowForPlayer ( playerid , ClockTextdraw [ 6 ] ) ;
- TextDrawShowForPlayer ( playerid , ClockTextdraw [ 7 ] ) ;
- IsActive [ playerid ] = true ;
- return ( 1 ) ;
- }
- //______________________________________________________________________________
- public OnPlayerRequestClass ( playerid , classid )
- {
- TextDrawHideForPlayer ( playerid , ClockTextdraw [ 0 ] ) ;
- TextDrawHideForPlayer ( playerid , ClockTextdraw [ 1 ] ) ;
- TextDrawHideForPlayer ( playerid , ClockTextdraw [ 2 ] ) ;
- TextDrawHideForPlayer ( playerid , ClockTextdraw [ 3 ] ) ;
- TextDrawHideForPlayer ( playerid , ClockTextdraw [ 4 ] ) ;
- TextDrawHideForPlayer ( playerid , ClockTextdraw [ 5 ] ) ;
- TextDrawHideForPlayer ( playerid , ClockTextdraw [ 6 ] ) ;
- TextDrawHideForPlayer ( playerid , ClockTextdraw [ 7 ] ) ;
- IsActive [ playerid ] = false ;
- return ( 1 ) ;
- }
- //______________________________________________________________________________
- forward ActiveClock ( playerid ) ;
- public ActiveClock ( playerid )
- {
- TextDrawHideForPlayer ( playerid , ClockTextdraw [ 6 ] ) ;
- KillTimer ( StartClock [ playerid ] ) ;
- StopClock [ playerid ] = SetTimerEx ( "DisableClock" , 350 , 0 , "i" , playerid ) ;
- }
- //______________________________________________________________________________
- forward DisableClock ( playerid ) ;
- public DisableClock ( playerid )
- {
- TextDrawShowForPlayer ( playerid , ClockTextdraw [ 6 ] ) ;
- KillTimer ( StopClock [ playerid ] ) ;
- StartClock [ playerid ] = SetTimerEx ( "ActiveClock" , 350 , 0 , "i" , playerid ) ;
- }
- //______________________________________________________________________________
- forward GetPlayerTimeEx ( playerid ) ;
- public GetPlayerTimeEx ( playerid )
- {
- new
- string [ 28 ] ,
- hour ,
- minute
- ;
- gettime ( hour , minute ) ;
- format ( string , sizeof string , "%s%d %s%d" , ( hour < 10 ) ? ( "0" ) : ( "" ) , hour , ( minute < 10 ) ? ( "0" ) : ( "" ) , minute ) ;
- TextDrawSetString ( ClockTextdraw [ 7 ] , string ) ;
- if ( hour == 12 || hour == 13 || hour == 14 || hour == 15 || hour == 16 || hour == 17 || hour == 18 || hour == 19 || hour == 21 )
- {
- format ( string , sizeof string , " %s%d %s%d" , ( hour < 10 ) ? ( "0" ) : ( "" ) , hour , ( minute < 10 ) ? ( "0" ) : ( "" ) , minute ) ;
- TextDrawSetString ( ClockTextdraw [ 7 ] , string ) ;
- }
- }
- //______________________________________________________________________________
- CMD:clock( playerid , params [ ] )
- {
- #define SPD ShowPlayerDialog
- SPD ( playerid , 0 , DIALOG_STYLE_LIST , ""W"Clock" , " "W"Clock \t \t \t ["G"ON"W"/"R"OFF"W"] \n "W"Change your time \t ["R"NOT AVAILABLE"W"]" , "O.K" , "Cancel" ) ;
- return ( 1 ) ;
- }
- //______________________________________________________________________________
- public OnDialogResponse ( playerid , dialogid , response , listitem , inputtext [ ] )
- {
- if ( dialogid == 0 )
- {
- if ( response )
- {
- if ( listitem == 0 )
- {
- SPD ( playerid , 1 , DIALOG_STYLE_MSGBOX , " " , " " , "ON" , "OFF" ) ;
- }
- }
- return ( 1 ) ;
- }
- if ( dialogid == 1 )
- {
- if ( response )
- {
- if ( IsActive [ playerid ] == false )
- {
- IsActive [ playerid ] = true ;
- TextDrawShowForPlayer ( playerid , ClockTextdraw [ 7 ] ) ;
- TextDrawShowForPlayer ( playerid , ClockTextdraw [ 6 ] ) ;
- StartClock [ playerid ] = SetTimerEx ( "ActiveClock" , 350 , 0 , "i" , playerid ) ;
- }
- }
- else
- {
- if ( IsActive [ playerid ] == true )
- {
- IsActive [ playerid ] = false ;
- KillTimer ( StartClock [ playerid ] ) ;
- KillTimer ( StopClock [ playerid ] ) ;
- TextDrawHideForPlayer ( playerid , ClockTextdraw [ 7 ] ) ;
- TextDrawHideForPlayer ( playerid , ClockTextdraw [ 6 ] ) ;
- }
- }
- return ( 1 ) ;
- }
- return ( 0 ) ;
- }
- //______________________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment