#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//
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; } }
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// { } }
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; } }
Nice George.... |
new eb[MAX_PLAYERS]; eb[playrerid] = 1;
Yo should make "eb" variable for every single player
Code:
new eb[MAX_PLAYERS]; eb[playrerid] = 1; But anyways, its cool. |
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 ![]() |