Advertisement
whiplk

[INCLUDE] - w!loops(beta)

Oct 13th, 2013
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.28 KB | None | 0 0
  1. /*
  2. *
  3. *   LOOPS v1 beta - Willian_Luigi
  4. *   Data de inicio: 08/10/2013
  5. *   CODE.ME, 2013.1 -
  6. *
  7. */
  8. #if defined _wloops_included
  9.     #endinput
  10. #endif
  11. #define _wloops_included
  12. #pragma library wloops
  13. #tryinclude <ibits>
  14. #tryinclude <whooks>
  15.  
  16. forward loadVehicles();
  17. forward getMaxPlayers();
  18. forward getMaxVehicles();
  19. forward iDestroyVehicle(vehicleid);
  20. forward startPutaria();
  21.  
  22. new gPlayersConnected, gCarsSpawned;
  23.  
  24. /*hook_f::OnGameModeInit()
  25. {
  26.     //startPutaria();
  27.  
  28.     call->OnGameModeInit();
  29.  
  30.     return nop;
  31. }*/
  32. hook_f::OnPlayerConnect(playerid)
  33. {
  34.     gPlayersConnected ++;
  35.  
  36.     call->OnPlayerConnect(playerid);
  37.  
  38.     return nop;
  39. }
  40. hook_f::OnPlayerDisconnect(playerid, reason)
  41. {
  42.     gPlayersConnected --;
  43.  
  44.     call->OnPlayerDisconnect(playerid, reason);
  45.  
  46.     return nop;
  47. }
  48.  
  49. public loadVehicles ()
  50. {
  51.     new gLoop, Float: gVehicle [ 0x03 ] , Float: gOld [ 0x03 ];
  52.     gVehicle [ 0x00 ] = EOS , gVehicle [ 0x01 ] = EOS , gVehicle [ 0x02 ] = EOS ;
  53.     gOld [ 0x00 ] = EOS , gOld [ 0x01 ] = EOS , gOld [ 0x02 ] = EOS ;
  54.     while ( ++gLoop < MAX_VEHICLES )
  55.     {
  56.         if ( gLoop )
  57.         {
  58.             GetVehiclePos ( gLoop , gVehicle [ 0x00 ] , gVehicle [ 0x01 ] , gVehicle [ 0x02 ] ) ;
  59.             GetVehiclePos ( ( gLoop - 0x01 ) , gOld [ 0x00 ] , gOld [ 0x01 ] , gOld [ 0x02 ] ) ;
  60.             if ( ( gVehicle [ 0x00 ] == gOld [ 0x00 ] ) && ( gVehicle [ 0x01 ] == gOld [ 0x01 ] ) && ( gVehicle [ 0x02 ] == gOld [ 0x02 ] ) )
  61.             {
  62.                 gCarsSpawned = (gLoop - 0x01);
  63.                 break ;
  64.             }
  65.         }
  66.     }
  67.     return 0x01 ;
  68. }
  69. public getMaxPlayers()
  70. {
  71.     return gPlayersConnected;
  72. }
  73. public getMaxVehicles()
  74. {
  75.     return gCarsSpawned;
  76. }
  77. public startPutaria()
  78. {
  79.     gCarsSpawned = 0;
  80.     gPlayersConnected = 0;
  81.     loadVehicles();
  82.     print("STARTED.");
  83. }
  84.  
  85. stock iCreateVehicle(modelid, Float:x, Float:y, Float:z, Float:a, c1, c2, time_spawn = 0x00)
  86. {
  87.     gCarsSpawned ++;
  88.  
  89.     return time_spawn ? (AddStaticVehicle(modelid, x, y, z, a, c1, c2)) : (AddStaticVehicleEx(modelid, x, y, z, a, c1, c2, time_spawn));
  90. }
  91.  
  92. public iDestroyVehicle(vehicleid)
  93. {
  94.     return DestroyVehicle(vehicleid), gCarsSpawned --;
  95. }
  96.  
  97. #define CreateVehicle iCreateVehicle
  98. #define AddStaticVehicleEx iCreateVehicle
  99. #define AddStaticVehicle(%0,%1,%2,%3,%4,%5,%6) iCreateVehicle(%0, %1, %2, %3, %4, %5, %6, 0)
  100. #define DestroyVehicle iDestroyVehicle
  101. #define GetMaxPlayers getMaxPlayers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement