[FilterScript] Explosive Sniper bullets!
#1

Hello SA-MP community!
Today after having a brainstorming session in the bathroom I finally attempted in making my first filterscript!!
This is a filterscript that allows a person to shoot an explosive bullet that kills the target instantly.
Here's the features:
-Only works with sniper
-Cannot be used by a person who doesn't have a sniper equipped
Here's the code ^_^
I even included comments so beginners like me can understand the code clearly.
Commands:
/explosive
/unloadexplosive

Code:
#include <a_samp>
#include <i-zcmd>
#define COLOR_RED 0xFF0000AA
new Float:X,Float:Y,Float:Z;
new eb[MAX_PLAYERS];
eb[playerid] = 1; //Explosive bullet variable//
//Mandatory includes and whatnot//
Code:
CMD:explosive(playerid, params[])
{
	if(GetPlayerWeapon(playerid) == 34 && eb == 0) //Checks if the person have a sniper and if it is loaded or not//
	{
	eb = 1;
	SendClientMessage(playerid, COLOR_RED, "You've loaded 1 explosive bullet");
	return 1;
	}
	else if(eb == 1) //checks if bullets are already loaded//
	{
	SendClientMessage(playerid, COLOR_RED, "Bullets already loaded!");
	return 1;
	}
	else //Sends a message if the player doesn't have a sniper.
	{
	SendClientMessage(playerid, COLOR_RED, "You don't have a sniper/haven't equiped a sniper yet!");
	return 1;
	}

}
Code:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if(eb == 1 && GetPlayerWeapon(playerid) == 34) //Checks if the person giving damage has loaded bullets and if he has shot a sniper//
    {
    GetPlayerPos(damagedid, X,Y,Z); //gets the position of the target//
    CreateExplosion(X, Y, Z, 0, 15.0); //BOOM BOOM BOOM! EVEN BRIGHTER THAN THE MOON MOON MOON!//
    CreateExplosion(X, Y, Z, 0, 15.0); //^That but 2wice so we give more damage //
    eb = 0; // unloads bullets//
    SendClientMessage(playerid, COLOR_RED, "Bullets unloaded!"); // sends message saying the bullets have been unloaded//
    SendClientMessage(damagedid, COLOR_RED, "Boom!You've been hit by an explosive bullet!!"); //Sends message to target that he has been shot by an explosive bullet//
	return 1;
	}
    else // does normal damage if bullets were not loaded//
    {
    }
}
EDIT:
Added an unload command!
Code:
CMD:unloadexplosive(playerid, params[])
{
	if(GetPlayerWeapon(playerid) == 34  && eb ==1)
	{
		eb = 0;
		SendClientMessage(playerid, COLOR_RED, "You've unloaded the bullet!");
		return 1;
	}
	else if(eb == 0)
	{
	    SendClientMessage(playerid, COLOR_RED, "You didn't even load the bullet!");
	    return 1;
	}
	else
	{
	    SendClientMessage(playerid, COLOR_RED, "Equip your sniper to unload it");
	    return 1;
	}

}
I'm a beginner and therefore have shit scripting abilities ^_^,Don't judge please.Hope you understand
Filterscript download: http://www.mediafire.com/download/za...iveBullets.rar
Virustotal(If you're a cautious person who cares about his computer):
https://www.virustotal.com/en/file/9...is/1452438340/
Reply


Messages In This Thread
Explosive Sniper bullets! - by Shovelizer - 10.01.2016, 14:07
Re: Explosive Sniper bullets! - by Ankon - 10.01.2016, 14:09
Re: Explosive Sniper bullets! - by Shovelizer - 10.01.2016, 14:17
Re: Explosive Sniper bullets! - by lucamsx - 10.01.2016, 16:57
Re: Explosive Sniper bullets! - by Shovelizer - 11.01.2016, 11:04
Re: Explosive Sniper bullets! - by valych - 11.01.2016, 11:22
Re: Explosive Sniper bullets! - by Amunra - 11.01.2016, 12:25
Re: Explosive Sniper bullets! - by Shovelizer - 11.01.2016, 14:34

Forum Jump:


Users browsing this thread: 1 Guest(s)