Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- //==============================================================================
- #include <a_samp>
- #include <MapAndreas>
- #include <zcmd>
- #include <foreach>
- //==============================================================================
- #define INTERVAL 100 // Define timer's interval time , lower tick rates make faster movimentation while on camera screen...
- #define CallBack::%0(%1) forward %0 ( %1 ) ; public %0 ( %1 )
- #define FRONT 0
- #define BACK 1
- #define LEFT 2
- #define RIGHT 3
- //==============================================================================
- new
- SentMortar [ MAX_PLAYERS ] = { -1 , ... } ,
- Float:Coords [ 7 ] [ MAX_PLAYERS ] ,
- MortarID [ MAX_OBJECTS ] [ 2 ] ,
- Iterator:Mortar<MAX_PLAYERS>,
- Shooting [ MAX_PLAYERS ] ,
- Float:oCoords [ 3 ] ,
- Text:Aim [ 11 ] ,
- leftright ,
- updown ,
- keys ,
- ii
- ;
- //==============================================================================
- public
- OnFilterScriptInit ( )
- {
- SetTimer ( "CheckControls" , INTERVAL , 1 ) ;
- CreateTextDraws ( ) ;
- return 1 ;
- }
- //==============================================================================
- public
- OnFilterScriptExit ( )
- {
- foreachex (Player , ii )
- {
- cmd_mortar ( ii , "\1" ) ;
- TextDrawsForPlayer ( ii , 0 ) ;
- }
- for ( ii = 0 ; ii < sizeof ( Aim ) ; ii++ )
- {
- TextDrawDestroy ( Aim [ ii ] ) ;
- }
- return 1 ;
- }
- //==============================================================================
- public
- OnPlayerDisconnect ( playerid , reason )
- {
- if ( Shooting [ playerid ] == 1 )
- {
- Iter_Remove (Mortar , playerid ) ;
- Shooting [ playerid ] = 0 ;
- }
- SentMortar [ playerid ] = -1 ;
- return 1 ;
- }
- //==============================================================================
- public
- OnPlayerCommandText ( playerid , cmdtext [ ] )
- {
- return 0 ;
- }
- //==============================================================================
- public
- OnPlayerKeyStateChange ( playerid , newkeys , oldkeys )
- {
- if ( newkeys & KEY_WALK )
- {
- if ( SentMortar [ playerid ] == -1 )
- {
- SentMortar [ playerid ] = CreateObject ( 1252 , Coords [ 0 ] [ playerid ] , Coords [ 1 ] [ playerid ] , ( Coords [ 2 ] [ playerid ] + 20 ) , 90 , 0 , 0 , 200 ) ;
- GetPointZPos ( Coords [ 0 ] [ playerid ] , Coords [ 1 ] [ playerid ] , Coords [ 6 ] [ playerid ] ) ;
- MoveObject ( SentMortar [ playerid ] , Coords [ 0 ] [ playerid ] , Coords [ 1 ] [ playerid ] , Coords [ 6 ] [ playerid ] , 12 , 90 , 0 , 0 ) ;
- MortarID [ SentMortar [ playerid ] ] [ 0 ] = 1 ;
- MortarID [ SentMortar [ playerid ] ] [ 1 ] = playerid ;
- SendClientMessage ( playerid , 0x0080FFFF , "> {FFFFFF}Fire in the hole !!!" ) ;
- }
- }
- return 1 ;
- }
- //==============================================================================
- public
- OnObjectMoved ( objectid )
- {
- if ( MortarID [ objectid ] [ 0 ] == 1 )
- {
- GetObjectPos ( objectid , oCoords [ 0 ] , oCoords [ 1 ] , oCoords [ 2 ] ) ;
- for ( ii = 0 ; ii < 2 ; ii++) // Making it absolutly deadly ( I think :D )
- {
- CreateExplosion ( oCoords [ 0 ] , oCoords [ 1 ] , oCoords [ 2 ] , 7 , 20 ) ;
- }
- SentMortar [ MortarID [ objectid ] [ 1 ] ] = -1 ;
- MortarID [ objectid ] [ 0 ] = 0 ;
- DestroyObject ( objectid ) ;
- }
- return 1 ;
- }
- //==============================================================================
- CallBack::CheckControls ( )
- {
- foreachex (Mortar , ii )
- {
- GetPlayerKeys ( ii , keys , updown , leftright ) ;
- if ( updown == KEY_UP )
- {
- GetXY ( FRONT , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , Coords [ 3 ] [ ii ] , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] ) ;
- SetPlayerCameraPos ( ii , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , ( Coords [ 2 ] [ ii ] + 20 ) ) ;
- SetPlayerCameraLookAt ( ii , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , Coords [ 2 ] [ ii ] ) ;
- continue ;
- }
- else if ( updown == KEY_DOWN )
- {
- GetXY ( BACK , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , Coords [ 3 ] [ ii ] , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] ) ;
- SetPlayerCameraPos ( ii , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , ( Coords [ 2 ] [ ii ] + 20 ) ) ;
- SetPlayerCameraLookAt ( ii , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , Coords [ 2 ] [ ii ] ) ;
- continue ;
- }
- //======================================================================
- if ( leftright == KEY_RIGHT )
- {
- GetXY ( RIGHT , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , Coords [ 3 ] [ ii ] , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] ) ;
- SetPlayerCameraPos ( ii , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , ( Coords [ 2 ] [ ii ] + 20 ) ) ;
- SetPlayerCameraLookAt ( ii , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , Coords [ 2 ] [ ii ] ) ;
- continue ;
- }
- else if ( leftright == KEY_LEFT )
- {
- GetXY ( LEFT , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , Coords [ 3 ] [ ii ] , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] ) ;
- SetPlayerCameraPos ( ii , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , ( Coords [ 2 ] [ ii ] + 20 ) ) ;
- SetPlayerCameraLookAt ( ii , Coords [ 0 ] [ ii ] , Coords [ 1 ] [ ii ] , Coords [ 2 ] [ ii ] ) ;
- continue ;
- }
- }
- }
- //==============================================================================
- cmd(mortar,playerid,params[])
- {
- if ( Shooting [ playerid ] == 0 )
- {
- Coords [ 3 ] [ playerid ] = 0 ;
- GetPlayerPos ( playerid , Coords [ 0 ] [ playerid ] , Coords [ 1 ] [ playerid ] , Coords [ 2 ] [ playerid ] ) ;
- TogglePlayerControllable ( playerid , 0 ) ;
- Iter_Add (Mortar , playerid ) ;
- Shooting [ playerid ] = 1 ;
- TextDrawsForPlayer ( playerid , 1 ) ;
- SendClientMessage ( playerid , 0x0080FFFF , "> {FFFFFF}You are now using mortar aim !" ) ;
- SetPlayerCameraPos ( playerid , Coords [ 0 ] [ playerid ] , Coords [ 1 ] [ playerid ] , ( Coords [ 2 ] [ playerid ] + 20 ) ) ;
- SetPlayerCameraLookAt ( playerid , Coords [ 0 ] [ playerid ] , Coords [ 1 ] [ playerid ] , Coords [ 2 ] [ playerid ] ) ;
- }
- else
- {
- TogglePlayerControllable ( playerid , 1 ) ;
- SetCameraBehindPlayer ( playerid ) ;
- Iter_Remove (Mortar , playerid ) ;
- Shooting [ playerid ] = 0 ;
- TextDrawsForPlayer ( playerid , 0 ) ;
- SendClientMessage ( playerid , 0x0080FFFF , "> {FFFFFF}You left mortar aim !" ) ;
- }
- return 1 ;
- }
- //==============================================================================
- stock
- GetXY ( mode , Float:X , Float:Y , Float:Angle , &Float:return_x , &Float:return_y )
- {
- if ( mode == FRONT )
- {
- return_x = X ;
- return_y = Y ;
- return_x += ( floatsin ( Angle , degrees ) * -0.5 ) ;
- return_y -= ( floatcos ( Angle , degrees ) * -0.5 ) ;
- }
- if ( mode == BACK )
- {
- return_x = X ;
- return_y = Y ;
- return_x += ( floatsin ( Angle , degrees ) * 0.5 ) ;
- return_y -= ( floatcos ( Angle , degrees ) * 0.5 ) ;
- }
- if ( mode == LEFT )
- {
- return_x = X ;
- return_y = Y ;
- return_x += ( floatsin ( ( Angle - 90 ) , degrees ) * 0.5 ) ;
- return_y -= ( floatcos ( ( Angle - 90 ) , degrees ) * 0.5 ) ;
- }
- if ( mode == RIGHT )
- {
- return_x = X ;
- return_y = Y ;
- return_x += ( floatsin ( ( Angle + 90 ) , degrees ) * 0.5 ) ;
- return_y -= ( floatcos ( ( Angle + 90 ) , degrees ) * 0.5 ) ;
- }
- }
- //==============================================================================
- stock
- CreateTextDraws ( )
- {
- Aim [ 0 ] = TextDrawCreate ( 590.000000 , 215.000000 , "_" ) ;
- TextDrawBackgroundColor ( Aim [ 0 ] , 255 ) ;
- TextDrawFont ( Aim [ 0 ] , 2 ) ;
- TextDrawLetterSize ( Aim [ 0 ] , 0.490000 , 0.000000 ) ;
- TextDrawColor ( Aim [ 0 ] , -1 ) ;
- TextDrawSetOutline ( Aim [ 0 ] , 0 ) ;
- TextDrawSetProportional ( Aim [ 0 ] , 1 ) ;
- TextDrawSetShadow ( Aim [ 0 ] , 1 ) ;
- TextDrawUseBox ( Aim [ 0 ] , 1 ) ;
- TextDrawBoxColor ( Aim [ 0 ] , 255 ) ;
- TextDrawTextSize ( Aim [ 0 ] , 420.000000 , -6.000000 ) ;
- Aim [ 1 ] = TextDrawCreate ( 50.000000 , 215.000000 , "_" ) ;
- TextDrawBackgroundColor ( Aim [ 1 ] , 255 ) ;
- TextDrawFont ( Aim [ 1 ] , 2 ) ;
- TextDrawLetterSize ( Aim [ 1 ] , 0.479999 , 0.000000 ) ;
- TextDrawColor ( Aim [ 1 ] , -1 ) ;
- TextDrawSetOutline ( Aim [ 1 ] , 0 ) ;
- TextDrawSetProportional ( Aim [ 1 ] , 1 ) ;
- TextDrawSetShadow ( Aim [ 1 ] , 1 ) ;
- TextDrawUseBox ( Aim [ 1 ] , 1 ) ;
- TextDrawBoxColor ( Aim [ 1 ] , 255 ) ;
- TextDrawTextSize ( Aim [ 1 ] , 210.000000 , -6.000000 ) ;
- Aim [ 2 ] = TextDrawCreate ( 248.500000 , 161.000000 , "_" ) ;
- TextDrawBackgroundColor ( Aim [ 2 ] , 255 ) ;
- TextDrawFont ( Aim [ 2 ] , 1 ) ;
- TextDrawLetterSize ( Aim [ 2 ] , 0.500000 , 0.199999 ) ;
- TextDrawColor ( Aim [ 2 ] , -1 ) ;
- TextDrawSetOutline ( Aim [ 2 ] , 0 ) ;
- TextDrawSetProportional ( Aim [ 2 ] , 1 ) ;
- TextDrawSetShadow ( Aim [ 2 ] , 1 ) ;
- TextDrawUseBox ( Aim [ 2 ] , 1 ) ;
- TextDrawBoxColor ( Aim [ 2 ] , 101 ) ;
- TextDrawTextSize ( Aim [ 2 ] , 381.000000 , 0.000000 ) ;
- Aim [ 3 ] = TextDrawCreate ( 315.000000 , 19.000000 , "'" ) ;
- TextDrawAlignment ( Aim [ 3 ] , 2 ) ;
- TextDrawBackgroundColor ( Aim [ 3 ] , 255 ) ;
- TextDrawFont ( Aim [ 3 ] , 0 ) ;
- TextDrawLetterSize ( Aim [ 3 ] , 0.500000 , 39.000000 ) ;
- TextDrawColor ( Aim [ 3 ] , -1 ) ;
- TextDrawSetOutline ( Aim [ 3 ] , 0 ) ;
- TextDrawSetProportional ( Aim [ 3 ] , 1 ) ;
- TextDrawSetShadow ( Aim [ 3 ] , 0 ) ;
- Aim [ 4 ] = TextDrawCreate ( 315.000000 , 275.000000 , "'" ) ;
- TextDrawAlignment ( Aim [ 4 ] , 2 ) ;
- TextDrawBackgroundColor ( Aim [ 4 ] , 255 ) ;
- TextDrawFont ( Aim [ 4 ] , 0 ) ;
- TextDrawLetterSize ( Aim [ 4 ] , 0.500000 , 39.000000 ) ;
- TextDrawColor ( Aim [ 4 ] , -1 ) ;
- TextDrawSetOutline ( Aim [ 4 ] , 0 ) ;
- TextDrawSetProportional ( Aim [ 4 ] , 1 ) ;
- TextDrawSetShadow ( Aim [ 4 ] , 0 ) ;
- Aim [ 5 ] = TextDrawCreate ( 302.000000 , 193.000000 , "o" ) ;
- TextDrawBackgroundColor ( Aim [ 5 ] , 255 ) ;
- TextDrawFont ( Aim [ 5 ] , 2 ) ;
- TextDrawLetterSize ( Aim [ 5 ] , 0.990000 , 4.000000 ) ;
- TextDrawColor ( Aim [ 5 ] , 255 ) ;
- TextDrawSetOutline ( Aim [ 5 ] , 0 ) ;
- TextDrawSetProportional ( Aim [ 5 ] , 1 ) ;
- TextDrawSetShadow ( Aim [ 5 ] , 0 ) ;
- Aim [ 6 ] = TextDrawCreate ( 283.000000 , 214.000000 , "_" ) ;
- TextDrawBackgroundColor ( Aim [ 6 ] , 255 ) ;
- TextDrawFont ( Aim [ 6 ] , 1 ) ;
- TextDrawLetterSize ( Aim [ 6 ] , 0.500000 , -0.000000 ) ;
- TextDrawColor ( Aim [ 6 ] , -16776961 ) ;
- TextDrawSetOutline ( Aim [ 6 ] , 0 ) ;
- TextDrawSetProportional ( Aim [ 6 ] , 1 ) ;
- TextDrawSetShadow ( Aim [ 6 ] , 1 ) ;
- TextDrawUseBox ( Aim [ 6 ] , 1 ) ;
- TextDrawBoxColor ( Aim [ 6 ] , -16777116 ) ;
- TextDrawTextSize ( Aim [ 6 ] , 300.000000 , 20.000000 ) ;
- Aim [ 7 ] = TextDrawCreate ( 373.000000 , 151.000000 , "_" ) ;
- TextDrawBackgroundColor ( Aim [ 7 ] , 255 ) ;
- TextDrawFont ( Aim [ 7 ] , 1 ) ;
- TextDrawLetterSize ( Aim [ 7 ] , 0.590000 , 12.799999 ) ;
- TextDrawColor ( Aim [ 7 ] , -1 ) ;
- TextDrawSetOutline ( Aim [ 7 ] , 0 ) ;
- TextDrawSetProportional ( Aim [ 7 ] , 1 ) ;
- TextDrawSetShadow ( Aim [ 7 ] , 1 ) ;
- TextDrawUseBox ( Aim [ 7 ] , 1 ) ;
- TextDrawBoxColor ( Aim [ 7 ] , 101 ) ;
- TextDrawTextSize ( Aim [ 7 ] , 367.000000 , -55.000000 ) ;
- Aim [ 8 ] = TextDrawCreate ( 248.500000 , 256.000000 , "_" ) ;
- TextDrawBackgroundColor ( Aim [ 8 ] , 255 ) ;
- TextDrawFont ( Aim [ 8 ] , 1 ) ;
- TextDrawLetterSize ( Aim [ 8 ] , 0.500000 , 0.199999 ) ;
- TextDrawColor ( Aim [ 8 ] , -1 ) ;
- TextDrawSetOutline ( Aim [ 8 ] , 0 ) ;
- TextDrawSetProportional ( Aim [ 8 ] , 1 ) ;
- TextDrawSetShadow ( Aim [ 8 ] , 1 ) ;
- TextDrawUseBox ( Aim [ 8 ] , 1 ) ;
- TextDrawBoxColor ( Aim [ 8 ] , 101 ) ;
- TextDrawTextSize ( Aim [ 8 ] , 381.000000 , 0.000000 ) ;
- Aim [ 9 ] = TextDrawCreate ( 262.000000 , 151.000000 , "_" ) ;
- TextDrawBackgroundColor ( Aim [ 9 ] , 255 ) ;
- TextDrawFont ( Aim [ 9 ] , 1 ) ;
- TextDrawLetterSize ( Aim [ 9 ] , 0.590000 , 12.799999 ) ;
- TextDrawColor ( Aim [ 9 ] , -1 ) ;
- TextDrawSetOutline ( Aim [ 9 ] , 0 ) ;
- TextDrawSetProportional ( Aim [ 9 ] , 1 ) ;
- TextDrawSetShadow ( Aim [ 9 ] , 1 ) ;
- TextDrawUseBox ( Aim [ 9 ] , 1 ) ;
- TextDrawBoxColor ( Aim [ 9 ] , 101 ) ;
- TextDrawTextSize ( Aim [ 9 ] , 256.000000 , -55.000000 ) ;
- Aim [ 10 ] = TextDrawCreate ( 331.000000 , 214.000000 , "_" ) ;
- TextDrawBackgroundColor ( Aim [ 10 ] , 255 ) ;
- TextDrawFont ( Aim [ 10 ] , 1 ) ;
- TextDrawLetterSize ( Aim [ 10 ] , 0.500000 , -0.000000 ) ;
- TextDrawColor ( Aim [ 10 ] , -16776961 ) ;
- TextDrawSetOutline ( Aim [ 10 ] , 0 ) ;
- TextDrawSetProportional ( Aim [ 10 ] , 1 ) ;
- TextDrawSetShadow ( Aim [ 10 ] , 1 ) ;
- TextDrawUseBox ( Aim [ 10 ] , 1 ) ;
- TextDrawBoxColor ( Aim [ 10 ] , -16777116 ) ;
- TextDrawTextSize ( Aim [ 10 ] , 349.000000 , 20.000000 ) ;
- }
- //==============================================================================
- stock
- TextDrawsForPlayer ( playerid , mode )
- {
- if ( mode == 1 )
- {
- for ( ii = 0 ; ii < sizeof ( Aim ) ; ii++ )
- {
- TextDrawShowForPlayer ( playerid , Aim [ ii ] ) ;
- }
- }
- else
- {
- for ( ii = 0 ; ii < sizeof ( Aim ) ; ii++ )
- {
- TextDrawHideForPlayer ( playerid , Aim [ ii ] ) ;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment