Advertisement
Guest User

pModShopChecker

a guest
Jun 20th, 2011
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.96 KB | None | 0 0
  1. /* *******************************************  */
  2. /* This filterscript checks if a player is in   */
  3. /* Modding garages or not. It doesn't allow     */
  4. /* Players to crash with each other when        */
  5. /* they enter at the same time.                 */
  6. /* Credits: iPLEOMAX.                           */
  7. /* *******************************************  */
  8.  
  9. #define FILTERSCRIPT
  10.  
  11. #include <a_samp>
  12.  
  13. /* Normal Defines */
  14. new ModShopChecker;
  15.  
  16. public OnFilterScriptInit()
  17. {
  18.     print("******************************************");
  19.     print(" Mod Shop Checker by iPLEOMAX has loaded.");
  20.     print("******************************************");
  21.    
  22.     ModShopChecker = SetTimer("pInModShop", 2000, true); // Timer checking for player status per 2 seconds.
  23.    
  24.     return true;
  25. }
  26.  
  27. public OnFilterScriptExit()
  28. {
  29.     print("pModShopChecker exited.");
  30.     return true;
  31. }
  32.  
  33. public OnPlayerDisconnect(playerid, reason)
  34. {
  35.     KillTimer(ModShopChecker);
  36.     return true;
  37. }
  38.  
  39. forward pInModShop(playerid);
  40. public pInModShop(playerid) //The Main function.
  41. {
  42.     for(new i=0; i<MAX_PLAYERS; i++) // Looping through all players
  43.     {
  44.         if(IsPlayerConnected(i) && !IsPlayerNPC(i)) //Doesn't check if a player is not connected or an NPC.
  45.         {
  46.             if(IsPlayerInRangeOfPoint(i,15,617.536,-1.990,1000.603) || IsPlayerInRangeOfPoint(i,15,615.283,-124.239,997.618) || IsPlayerInRangeOfPoint(i,15,616.790, -74.815, 997.888))
  47.             {
  48.                 if(GetPlayerVirtualWorld(i) != i+500)
  49.                 {
  50.                     new VID;
  51.                     VID = GetPlayerVehicleID(i);
  52.                     SetVehicleVirtualWorld(VID, i+500);
  53.                     SetPlayerVirtualWorld(i,i+500);
  54.                     new msg[15];
  55.                     format(msg,15,"ID%i-VW:%i",i,i+500);
  56.                     print(msg);
  57.                     if(IsPlayerInRangeOfPoint(i,15,617.536,-1.990,1000.603)) SetPVarInt(i,"gType", 1); //Sets the garage type.
  58.                     if(IsPlayerInRangeOfPoint(i,15,615.283,-124.239,997.618)) SetPVarInt(i,"gType", 2);
  59.                     if(IsPlayerInRangeOfPoint(i,15,616.790, -74.815, 997.888)) SetPVarInt(i,"gType", 3);
  60.                 }
  61.             }
  62.             if(!IsPlayerInRangeOfPoint(i,20,617.536,-1.990,1000.603) && GetPVarInt(i, "gType") == 1) //If player is not in garage.
  63.             {
  64.                 if(GetPlayerVirtualWorld(i) == i+500)
  65.                 {
  66.                     pResetVW(i);
  67.                 }
  68.             }
  69.             if(!IsPlayerInRangeOfPoint(i,15,615.283,-124.239,997.618) && GetPVarInt(i, "gType") == 2)
  70.             {
  71.                 if(GetPlayerVirtualWorld(i) == i+500)
  72.                 {
  73.                     pResetVW(i);
  74.                 }
  75.             }
  76.             if(!IsPlayerInRangeOfPoint(i,15,616.790, -74.815, 997.888) && GetPVarInt(i, "gType") == 3)
  77.             {
  78.                 if(GetPlayerVirtualWorld(i) == i+500)
  79.                 {
  80.                     pResetVW(i);
  81.                 }
  82.             }
  83.         }
  84.     }
  85.     return true;
  86. }
  87.  
  88. forward pResetVW(playerid);
  89. public pResetVW(playerid) //When the player is out of the garage, It resets the VirtualWorld.
  90. {
  91.     new VID, msg[15];
  92.     VID = GetPlayerVehicleID(playerid);
  93.     SetVehicleVirtualWorld(VID, 0);
  94.     SetPlayerVirtualWorld(playerid,0);
  95.     SetPVarInt(playerid,"gType", 0); // Gtype means, the garage type. "Transfender/WheelArch/LocoLowCo xD"
  96.     format(msg,15,"ID%i-VW:%i",playerid,0);
  97.     print(msg);
  98.     return true;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement