Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Filterscript by TonyII, do not remove this.
- //You are allowed to edit the entire FS except the comment above.
- //Includes
- #include <a_samp>
- #include <zcmd>
- //Variables
- new Bomb[MAX_PLAYERS];
- new FBTimer;
- new CountTime;
- new Counting;
- new BagTime;
- new BagCounting;
- new VanMoved;
- new SMoney;
- new DetonateBomb[MAX_PLAYERS];
- new SecurityVanID[MAX_PLAYERS];
- new SVBeingRobbed[MAX_VEHICLES];
- new FullBag[MAX_PLAYERS];
- new MoneyLeft[MAX_VEHICLES];
- new Float:VanX,Float:VanY,Float:VanZ;
- //Forwards
- forward VanMovedTimer(playerid,Float:X,Float:Y,Float:Z);
- forward FillingBags(playerid);
- forward SecureMoney(playerid);
- //Publics
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print("Security Van rob system. [By TonyII]");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(FullBag[playerid] == 1)
- {
- GivePlayerMoney(playerid, -100000);
- KillTimer(SMoney);
- FullBag[playerid] = 0;
- SendClientMessage(playerid, -1,"You failed the robbery, you died.");
- }
- return 1;
- }
- public VanMovedTimer(playerid)
- {
- new Float:X,Float:Y,Float:Z;
- if(!Counting)
- {
- KillTimer(VanMoved);
- Bomb[playerid] = 0;
- DetonateBomb[playerid] = 1;
- SendClientMessage(playerid, -1,"Alright, the bomb is planted.[/detonatebomb]");
- //ClearAnimations
- }
- else
- {
- new SVID = SecurityVanID[playerid];
- GetVehiclePos(SVID, X,Y,Z);
- if(X == VanX && Y == VanY && Z == VanZ)
- {
- new string[128];
- format(string,sizeof(string),"%i",CountTime);
- GameTextForPlayer(playerid,string,1000,5);
- CountTime --;
- if(CountTime == 0)
- {
- Counting = 0;
- }
- }
- else
- {
- KillTimer(VanMoved);
- SendClientMessage(playerid, -1,"The van moved while planting the bomb!");
- }
- }
- return 1;
- }
- public SecureMoney(playerid)
- {
- SendClientMessage(playerid, -1,"The money is secure now.");
- FullBag[playerid] = 0;
- KillTimer(SMoney);
- return 1;
- }
- public FillingBags(playerid)
- {
- if(!BagCounting)
- {
- KillTimer(FBTimer);
- FullBag[playerid] = 1;
- GivePlayerMoney(playerid, 100000);
- SendClientMessage(playerid, -1,"Your bag is full, your bag contains $100,000");
- SendClientMessage(playerid, -1,"Leave the area, if you die you lose the money![10 minutes untill the money is secure]");
- //ClearAnimations
- SMoney = SetTimerEx("SecureMoney",600000,false,"i",playerid);
- }
- else
- {
- new string[128];
- format(string,sizeof(string),"%i",BagTime);
- GameTextForPlayer(playerid,string,1000,5);
- BagTime --;
- if(BagTime == 0)
- {
- BagCounting = 0;
- }
- }
- return 1;
- }
- //Stocks
- stock SecurityVan(vehicleid)
- {
- switch(GetVehicleModel(vehicleid))
- {
- case 428: return 1;
- }
- return 0;
- }
- stock GetDistanceToCar(playerid, veh, Float: posX = 0.0, Float: posY = 0.0, Float: posZ = 0.0)
- {
- new Float: Floats[2][3];
- if(posX == 0.0 && posY == 0.0 && posZ == 0.0)
- {
- if(!IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playerid, Floats[0][0], Floats[0][1], Floats[0][2]);
- else GetVehiclePos(GetPlayerVehicleID(playerid), Floats[0][0], Floats[0][1], Floats[0][2]);
- }
- else
- {
- Floats[0][0] = posX;
- Floats[0][1] = posY;
- Floats[0][2] = posZ;
- }
- GetVehiclePos(veh, Floats[1][0], Floats[1][1], Floats[1][2]);
- return floatround(floatsqroot((Floats[1][0] - Floats[0][0]) * (Floats[1][0] - Floats[0][0]) + (Floats[1][1] - Floats[0][1]) * (Floats[1][1] - Floats[0][1]) + (Floats[1][2] - Floats[0][2]) * (Floats[1][2] - Floats[0][2])));
- }
- stock GetClosestCar(playerid, exception = INVALID_VEHICLE_ID)
- {
- new Float: Distance,target = -1,Float: vPos[3];
- if(!IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playerid, vPos[0], vPos[1], vPos[2]);
- else GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);
- for(new v; v < MAX_VEHICLES; v++) if(GetVehicleModel(v) >= 400)
- {
- if(v != exception && (target < 0 || Distance > GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2])))
- {
- target = v;
- Distance = GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2]);
- }
- }
- return target;
- }
- //Commands
- CMD:buybomb(playerid, params[])
- {
- if(GetPlayerMoney(playerid) <= 10000) return SendClientMessage(playerid, -1,"Insufficient funds.");
- if(Bomb[playerid] == 1) return SendClientMessage(playerid, -1,"You already got a bomb.");
- Bomb[playerid] = 1;
- SendClientMessage(playerid, -1,"You've successfully bought a bomb.");
- SendClientMessage(playerid, -1,"Get close to a Security Van and plant it on the rear doors.[/plantbomb]");
- GivePlayerMoney(playerid, -10000);
- return 1;
- }
- CMD:plantbomb(playerid, params[])
- {
- new ClosestCar = GetClosestCar(playerid);
- GetVehiclePos(ClosestCar, VanX,VanY,VanZ);
- if(Bomb[playerid] == 0) return SendClientMessage(playerid, -1,"You don't have a bomb.");
- if(IsPlayerInRangeOfPoint(playerid, 7.0, VanX,VanY,VanZ))
- {
- if(SecurityVan(ClosestCar))
- {
- SecurityVanID[playerid] = ClosestCar;
- VanMoved = SetTimerEx("VanMovedTimer",1000,true,"i",playerid);
- CountTime = 5;
- Counting = 1;
- SendClientMessage(playerid, -1,"You're planting the bomb!");
- //ApplyAnimation
- }
- else return SendClientMessage(playerid, -1,"This vehicle isn't a Security Van.");
- }
- else return SendClientMessage(playerid, -1,"There aren't any Security Vans near.");
- return 1;
- }
- CMD:detonatebomb(playerid, params[])
- {
- new Float:X,Float:Y,Float:Z;
- if(DetonateBomb[playerid] == 1)
- {
- new SVID = SecurityVanID[playerid];
- GetVehiclePos(SVID, X,Y,Z);
- CreateExplosion(X, Y, Z, 7, 10);
- SetVehicleHealth(SVID, 350);
- SVBeingRobbed[SVID] = 1;
- DetonateBomb[playerid] = 0;
- MoneyLeft[SVID] = 5;
- SendClientMessage(playerid, -1,"The bomb went off, fill the bags and get out of here![/fillbags]");
- }
- else return SendClientMessage(playerid, -1,"You don't have a bomb planted anywhere.");
- return 1;
- }
- CMD:fillbags(playerid, params[])
- {
- new ClosestCar = GetClosestCar(playerid);
- if(BagCounting == 1) return SendClientMessage(playerid, -1,"You're filling your bags already!");
- if(MoneyLeft[ClosestCar] == 0) return SendClientMessage(playerid, -1,"This van is empty!");
- if(FullBag[playerid] == 1) return SendClientMessage(playerid, -1,"Your bags are full!");
- if(SVBeingRobbed[ClosestCar] == 1)
- {
- SendClientMessage(playerid, -1,"You're filling your bags with money.");
- FBTimer = SetTimerEx("FillingBags",1000,true,"i",playerid);
- BagTime = 5;
- BagCounting = 1;
- MoneyLeft[ClosestCar] -= 1;
- //ApplyAnimation
- }
- else return SendClientMessage(playerid, -1,"This van isn't being robbed.");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment