SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 10/01/2016, 03:07 PM   #1
Shovelizer
Little Clucker
 
Join Date: Dec 2015
Posts: 8
Reputation: 1
Default Explosive Sniper bullets!

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/

Last edited by Shovelizer; 11/01/2016 at 12:04 PM.
Shovelizer is offline   Reply With Quote
Old 10/01/2016, 03:09 PM   #2
Ankon
Little Clucker
 
Join Date: May 2015
Posts: 37
Reputation: 0
Default Re: Explosive Sniper bullets!

Nice George....
__________________
Ankon is offline   Reply With Quote
Old 10/01/2016, 03:17 PM   #3
Shovelizer
Little Clucker
 
Join Date: Dec 2015
Posts: 8
Reputation: 1
Default Re: Explosive Sniper bullets!

Quote:
Nice George....
Thanks,appreciated ^_^
Shovelizer is offline   Reply With Quote
Old 10/01/2016, 05:57 PM   #4
lucamsx
Big Clucker
 
lucamsx's Avatar
 
Join Date: Oct 2015
Location: Poland
Posts: 197
Reputation: 37
Default Re: Explosive Sniper bullets!

Yo should make "eb" variable for every single player
Code:
new eb[MAX_PLAYERS];
eb[playrerid] = 1;
etc.
But anyways, its cool.
lucamsx is offline   Reply With Quote
Old 11/01/2016, 12:04 PM   #5
Shovelizer
Little Clucker
 
Join Date: Dec 2015
Posts: 8
Reputation: 1
Default Re: Explosive Sniper bullets!

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:
Shovelizer is offline   Reply With Quote
Old 11/01/2016, 12:22 PM   #6
valych
Big Clucker
 
valych's Avatar
 
Join Date: Aug 2009
Posts: 110
Reputation: 15
Default Re: Explosive Sniper bullets!

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
valych is offline   Reply With Quote
Old 11/01/2016, 01:25 PM   #7
Amunra
Gangsta
 
Amunra's Avatar
 
Join Date: Nov 2015
Location: Indonesian
Posts: 502
Reputation: 12
Default Re: Explosive Sniper bullets!

Good Job for first Filterscript
__________________
Legendary Criminals


Amunra is offline   Reply With Quote
Old 11/01/2016, 03:34 PM   #8
Shovelizer
Little Clucker
 
Join Date: Dec 2015
Posts: 8
Reputation: 1
Default Re: Explosive Sniper bullets!

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.
Shovelizer is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Explosive bullets! Cena44 Filterscripts 14 13/06/2014 09:04 AM
[Bug?] Sniper bullets not firing Admigo Scripting Help 6 19/01/2014 01:08 AM
[Need Help] Explosive Help. Hash [NL-RP] Help Archive 3 11/05/2010 03:25 AM
Explosive barrel bug?? MB@ Client Support 3 26/08/2009 06:39 AM


All times are GMT. The time now is 06:13 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.