Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ******************************************* */
- /* This filterscript checks if a player is in */
- /* Modding garages or not. It doesn't allow */
- /* Players to crash with each other when */
- /* they enter at the same time. */
- /* Credits: iPLEOMAX. */
- /* ******************************************* */
- #define FILTERSCRIPT
- #include <a_samp>
- /* Normal Defines */
- new ModShopChecker;
- public OnFilterScriptInit()
- {
- print("******************************************");
- print(" Mod Shop Checker by iPLEOMAX has loaded.");
- print("******************************************");
- ModShopChecker = SetTimer("pInModShop", 2000, true); // Timer checking for player status per 2 seconds.
- return true;
- }
- public OnFilterScriptExit()
- {
- print("pModShopChecker exited.");
- return true;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- KillTimer(ModShopChecker);
- return true;
- }
- forward pInModShop(playerid);
- public pInModShop(playerid) //The Main function.
- {
- for(new i=0; i<MAX_PLAYERS; i++) // Looping through all players
- {
- if(IsPlayerConnected(i) && !IsPlayerNPC(i)) //Doesn't check if a player is not connected or an NPC.
- {
- 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))
- {
- if(GetPlayerVirtualWorld(i) != i+500)
- {
- new VID;
- VID = GetPlayerVehicleID(i);
- SetVehicleVirtualWorld(VID, i+500);
- SetPlayerVirtualWorld(i,i+500);
- new msg[15];
- format(msg,15,"ID%i-VW:%i",i,i+500);
- print(msg);
- if(IsPlayerInRangeOfPoint(i,15,617.536,-1.990,1000.603)) SetPVarInt(i,"gType", 1); //Sets the garage type.
- if(IsPlayerInRangeOfPoint(i,15,615.283,-124.239,997.618)) SetPVarInt(i,"gType", 2);
- if(IsPlayerInRangeOfPoint(i,15,616.790, -74.815, 997.888)) SetPVarInt(i,"gType", 3);
- }
- }
- if(!IsPlayerInRangeOfPoint(i,20,617.536,-1.990,1000.603) && GetPVarInt(i, "gType") == 1) //If player is not in garage.
- {
- if(GetPlayerVirtualWorld(i) == i+500)
- {
- pResetVW(i);
- }
- }
- if(!IsPlayerInRangeOfPoint(i,15,615.283,-124.239,997.618) && GetPVarInt(i, "gType") == 2)
- {
- if(GetPlayerVirtualWorld(i) == i+500)
- {
- pResetVW(i);
- }
- }
- if(!IsPlayerInRangeOfPoint(i,15,616.790, -74.815, 997.888) && GetPVarInt(i, "gType") == 3)
- {
- if(GetPlayerVirtualWorld(i) == i+500)
- {
- pResetVW(i);
- }
- }
- }
- }
- return true;
- }
- forward pResetVW(playerid);
- public pResetVW(playerid) //When the player is out of the garage, It resets the VirtualWorld.
- {
- new VID, msg[15];
- VID = GetPlayerVehicleID(playerid);
- SetVehicleVirtualWorld(VID, 0);
- SetPlayerVirtualWorld(playerid,0);
- SetPVarInt(playerid,"gType", 0); // Gtype means, the garage type. "Transfender/WheelArch/LocoLowCo xD"
- format(msg,15,"ID%i-VW:%i",playerid,0);
- print(msg);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement