Advertisement
Guest User

Untitled

a guest
Aug 7th, 2011
608
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.33 KB | None | 0 0
  1. #include < a_samp >
  2.  
  3. new
  4.     sfb[ MAX_PLAYERS ],
  5.     gUsesBoard[ MAX_PLAYERS ],
  6.     btimer[ MAX_PLAYERS ]
  7. ;
  8.  
  9. public OnPlayerCommandText( playerid, cmdtext[ ] ) {
  10.     if( !strcmp( cmdtext, "/board", true ) ) {
  11.         if( gUsesBoard[ playerid ] == 0 ) {
  12.             new
  13.                 Float:x
  14.                 ,Float:y
  15.                 ,Float:oz
  16.             ;
  17.             GetPlayerPos( playerid, x, y, oz );
  18.             new Float:a;
  19.             GetPlayerFacingAngle( playerid, a );
  20.             oz = oz + -1.01;
  21.             sfb[ playerid ] = CreateObject(2404, x, y + 0.12, oz,   -90.00, 0.00, a);
  22.             btimer[ playerid ] = SetTimerEx( "board", 20, 1, "if", playerid, oz );
  23.             gUsesBoard[ playerid ] = 1;
  24.         }
  25.         else {
  26.             KillTimer( btimer[ playerid ] );
  27.             gUsesBoard[ playerid ] = 0;
  28.             DestroyObject( sfb[ playerid ] );
  29.         }
  30.         return 1;
  31.     }
  32.     return 0;
  33. }
  34.  
  35. forward board( playerid, Float:oz );
  36. public board( playerid, Float:oz ) {
  37.     new
  38.         Float:x
  39.         ,Float:y
  40.         ,Float:z2
  41.         ,Float:a
  42.     ;
  43.     GetPlayerPos( playerid, x, y, z2 );
  44.     #pragma unused z2
  45.     SetObjectPos( sfb[ playerid ], x, y + 0.12, oz );
  46.     GetPlayerFacingAngle( playerid, a );
  47.     SetObjectRot( sfb[ playerid ], -90.00, 0.00, a );
  48.     return 1;
  49. }
  50.  
  51. public OnPlayerDisconnect( playerid, reason ) {
  52.     if( gUsesBoard[ playerid ] == 1 ) {
  53.         KillTimer( btimer[ playerid ] );
  54.         gUsesBoard[ playerid ] = 0;
  55.         DestroyObject( sfb[ playerid ] );
  56.     }
  57.     return 1;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement