Advertisement
soulshaker

VCMP 0.4 Automatic Gate

Feb 25th, 2015
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 1.25 KB | None | 0 0
  1. ///VCMP 0.4 Automatic gate system by SouLy^///
  2. Thanks to Gudio for helping me with onPlayerPart function :D
  3.  
  4. This function adds a automatic gate at mansion. Enjoy
  5.  
  6.  
  7. function onScriptLoad()
  8. {
  9.     gate <- CreateObject( 310, 1, -276.618, -495.992, 10.2778, 255 );
  10.     gate_timer <- NewTimer("gatesystem", 500, 0 );
  11.     gate_timer.Paused = true;
  12.     timer_status <- false;
  13. }
  14.  
  15. function onPlayerJoin( player )
  16. {
  17.     if(timer_status == false)
  18.     {
  19.         gate_timer.Paused = false;
  20.         timer_status = true;
  21.         print("Timer Resumed");
  22.     }
  23. }
  24.  
  25. function onPlayerPart( player, reason )
  26. {
  27.     if ( GetPlayers()-1 == 0 )
  28.     {
  29.         gate_timer.Paused = true;
  30.         timer_status = false;
  31.         print( "Timer Paused" );
  32.     }
  33. }
  34. function gatesystem()
  35. {
  36.     local gatestatus = 0;
  37.     for ( local i = 0; i < GetMaxPlayers(); i++ )  
  38.     {
  39.         local player = FindPlayer( i );
  40.         if ( player )
  41.         {
  42.             if ( player.IsSpawned )
  43.             {
  44.                 if ( InPoly( player.Pos.x, player.Pos.y, -276.2,-503.462,-268.675,-502.296,-268.887,-488.42,-276.471,-487.991 ) ) gatestatus = 1;          
  45.             }
  46.         }
  47.     }
  48.     if ( gatestatus == 1 ) gate.MoveTo( Vector( -268.576, -495.99, 10.2778 ), 2800 );
  49.     else gate.MoveTo( Vector( -276.618, -495.992, 10.2778 ), 2800 );      
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement