Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- At line number 27 you will find #define BOMBPRICE with the number 300 as default. Change the number 300 to the ammount of cash you want the
- Player to pay to place a booby trap in hes current vehicle. Changing the number to 0 will result in the bomb is free!
- Note when changing the price you will need to compile every time!
- Vehicle Booby Trap system made by Desert 2010. Contact me on www.forum.sa-mp.com with the username Desert.
- Do not remove my credits or edit the text above
- Regards and enjoy
- Desert
- */
- #include <a_samp>
- #include <dutils>
- #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- #pragma unused ret_memcpy
- #pragma tabsize 4
- #define COLOUR_RED 0xFF3333AA
- #define COLOUR_YELLOW 0xFFFF00AA
- #define BOMBPRICE 300
- #define FILTERSCRIPT
- new booby[MAX_VEHICLES];
- public OnFilterScriptInit()
- {
- print("\n------------------------------------------------------------");
- print("Vehicle Booby Trap Filterscript has been succesfully loaded!");
- print("------------------------------------------------------------\n");
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(boobytrap,9,cmdtext);
- return 0;
- }
- dcmd_boobytrap(playerid,params[])
- {
- #pragma unused params
- new vehicle;
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOUR_RED,"You need to be in a vehicle to booby trap it!");
- else
- {
- vehicle = GetPlayerVehicleID(playerid);
- if(booby[vehicle] == 1) return SendClientMessage(playerid,COLOUR_RED,"This vehicle has already been booby trapped!");
- {
- new cash = BOMBPRICE;
- if(cash > 0)
- {
- if(GetPlayerMoney(playerid) < BOMBPRICE) return SendClientMessage(playerid,COLOUR_RED,"You do not have money enough for a booby trap!");
- else
- {
- SendClientMessage(playerid,COLOUR_YELLOW,"Planted booby trap inside the car!");
- PlayerPlaySound(playerid,1057,0,0,0);
- GivePlayerMoney(playerid,-BOMBPRICE);
- booby[vehicle] = 1;
- RemovePlayerFromVehicle(playerid);
- GameTextForPlayer(playerid,"~r~Booby trapped",10000,4);
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid,COLOUR_YELLOW,"Planted booby trap inside the car!");
- PlayerPlaySound(playerid,1057,0,0,0);
- booby[vehicle] = 1;
- RemovePlayerFromVehicle(playerid);
- return 1;
- }
- }
- }
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(newstate == PLAYER_STATE_DRIVER)
- {
- new vehicle = GetPlayerVehicleID(playerid);
- if(booby[vehicle] == 1)
- {
- new Float:X,Float:Y,Float:Z;
- GetVehiclePos(vehicle,X,Y,Z);
- CreateExplosion(X,Y,Z,7,10);
- PlayerPlaySound(playerid,1057,0,0,0);
- booby[vehicle] = 0;
- SendClientMessage(playerid,COLOUR_RED,"Vehicle has been booby trapped!");
- GameTextForPlayer(playerid,"~r~Booby trapped",10000,4);
- return 1;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment