SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Filterscripts (https://forum.sa-mp.com/forumdisplay.php?f=17)
-   -   [FilterScript] Explosive Sniper bullets! (https://forum.sa-mp.com/showthread.php?t=598262)

Shovelizer 10/01/2016 02:07 PM

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/

Ankon 10/01/2016 02:09 PM

Re: Explosive Sniper bullets!
 
Nice George....

Shovelizer 10/01/2016 02:17 PM

Re: Explosive Sniper bullets!
 
Quote:

Nice George....
Thanks,appreciated ^_^

lucamsx 10/01/2016 04:57 PM

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.

Shovelizer 11/01/2016 11:04 AM

Re: Explosive Sniper bullets!
 
Quote:

Originally Posted by lucamsx (Post 3639707)
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:

valych 11/01/2016 11:22 AM

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 :)

Amunra 11/01/2016 12:25 PM

Re: Explosive Sniper bullets!
 
Good Job for first Filterscript

Shovelizer 11/01/2016 02:34 PM

Re: Explosive Sniper bullets!
 
Quote:

Originally Posted by valych (Post 3640103)
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.


All times are GMT. The time now is 11:16 PM.

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