[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
#2

Nice George....
Reply
#3

Quote:

Nice George....

Thanks,appreciated ^_^
Reply
#4

Yo should make "eb" variable for every single player
Code:
new eb[MAX_PLAYERS];
eb[playrerid] = 1;
etc.
But anyways, its cool.
Reply
#5

Quote:
Originally Posted by lucamsx
View Post
Yo should make "eb" variable for every single player
Code:
new eb[MAX_PLAYERS];
eb[playrerid] = 1;
etc.
But anyways, its cool.
Thanks,changed the code c:
Reply
#6

I think it would be nice to remove a restriction of using sniperrifle only and make it possible to use explosive ammo for any ranged weapon.
Anyway, good job
Reply
#7

Good Job for first Filterscript
Reply
#8

Quote:
Originally Posted by valych
View Post
I think it would be nice to remove a restriction of using sniperrifle only and make it possible to use explosive ammo for any ranged weapon.
Anyway, good job
Well,if that's the case this thing can be abused because M4 is considered a long range weapon too,I'd be too easy to kill someone.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)