Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <sscanf2>
- new BombAttached[MAX_PLAYERS];
- forward Explosion();
- forward Float:GetDistanceBetweenPlayers(p1,p2);
- #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- #define RED 0xFF0000AA
- #define LIGHTGREEN 0x33AA33AA
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" iBomb Filterscript v1.0 loaded!");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n----------------------------------");
- print(" iBomb Filterscript v1.0 unloaded!");
- print("----------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(bomb,4,cmdtext);
- return 1;
- }
- dcmd_bomb(playerid,params[])
- {
- new targetid;
- new crand = random(100);
- if(GetDistanceBetweenPlayers(playerid, targetid) > 4) return SendClientMessage(playerid, RED, "[ERROR]{FFFFFF} Player is too far away.");
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, RED, "[USAGE]{FFFFFF} /rob [name/id]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, RED, "[ERROR]{FFFFFF} Player not found.");
- if(BombAttached[targetid] == 1) return SendClientMessage(playerid, RED, "[ERROR]{FFFFFF} A bomb is already attached to the player.");
- if(playerid == targetid) return SendClientMessage(playerid, RED, "[ERROR]{FFFFFF} You cannot attach bomb on yourself!");
- if(IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid, RED, "[ERROR]{FFFFFF} The player should not be in a vehicle!");
- if(crand <= 30) return SendClientMessage(playerid, RED, "[FAIL]{FFFFFF} You have failed to attach the bomb on the player.");
- if(crand > 30)
- {
- SendClientMessage(playerid, LIGHTGREEN, "[SUCCESSFUL]{FFFFFF} You have attached the bomb on the player and will explode in 10 seconds");
- SendClientMessage(targetid, RED, "[DANGER]{FFFFFF} A bomb has been attached on you and will explode in 10 seconds!");
- SetTimer("Explosion", 10000, false);
- BombAttached[targetid] =1;
- }
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- public Explosion()
- {
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(BombAttached[i] == 1)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(i, x, y, z);
- CreateExplosion(x,y,z,6,10.0);
- SetPlayerHealth(i, 0);
- BombAttached[i] =0;
- }
- }
- }
- }
- public Float:GetDistanceBetweenPlayers(p1,p2)
- {
- new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
- if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
- {
- return -1.00;
- }
- GetPlayerPos(p1,x1,y1,z1);
- GetPlayerPos(p2,x2,y2,z2);
- return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement