Headshot active for everyone
#2

here you go :-
Код:
#include <a_samp>
#include <zcmd>
#include <sscanf>

new headshot[MAX_PLAYERS];


//-----------------------------------HEADSHOT-----------------------------------
CMD:ahs(playerid, parmas[])
{
		new activeheadshot;
		new text[128];
		if(logged[playerid] == 0) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in to use that command.");
		if(PlayerInfo[playerid][pAdmin] < 2)return SendClientMessage(playerid, COLOR_BRIGHTRED, "You are not an admin!");
		if(sscanf(parmas, "i", activeheadshot)) returnSendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /ahs [0/1]");
	    if(activeheadshot > 1 || activeheadshot < 0) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You must enter 1 or 0 to activate or deactivate headshots.");
		
        for(new i = 0; i < MAX_PLAYERS; i++)
		{
		if(activeheadshot == 1)
		{

			headshot[i] = 1;

            dini_IntSet("server.ini","headshot", activeheadshot);
			SendClientMessage(playerid, COLOR_ORANGE, "You have enabled headshots for everyone.");
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "Admin %s enabled headshots !", sendername);
	        SendClientMessageToAll(COLOR_WHITE, string);
            format(string, sizeof(string), "~w~HEADSHOT ENABLED");
            GameTextForAll(string, 5000, 3 );
			return 1;
		}
		if(activeheadshot == 0)
		{
		    headshot[i] = 0;

            dini_IntSet("server.ini","headshot", activeheadshot);
            GetPlayerName(playerid, sendername, sizeof(sendername));
			SendClientMessage(playerid, COLOR_ORANGE, "You have disabled headshots for everyone.");
			format(string, sizeof(string), "Admin %s disabled headshots !", sendername);
	        SendClientMessageToAll(COLOR_WHITE, string);
            format(string, sizeof(string), "~w~HEADSHOT DISABLED");
            GameTextForAll(string, 5000, 3);
			return 1;
		}
	}
		return 1;
}
	
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if(headshot[playerid] == 1)
    {
	  if(damagedid != INVALID_PLAYER_ID)
		 {
			if(bodypart == 9)
				{
					if(weaponid == 24 || weaponid == 33 || weaponid == 34)
					   {
						   SetPLayerHealth(damagedid, 0.0);
					   }
				}
		 }
    }
}

    return 1;
}
download zcmd and sscanf include. it will make your work easier. I used them for this script and this should work. (REMEMBER it is untested!)
Reply


Messages In This Thread
Headshot active for everyone - by Adamsy - 20.08.2016, 05:16
Re: Headshot active for everyone - by DeeadPool - 20.08.2016, 06:36
Re: Headshot active for everyone - by Logic_ - 20.08.2016, 15:14
Re: Headshot active for everyone - by Adamsy - 20.08.2016, 18:33
Re: Headshot active for everyone - by Shinja - 20.08.2016, 18:50
Re: Headshot active for everyone - by Adamsy - 20.08.2016, 20:44
Re: Headshot active for everyone - by Shinja - 20.08.2016, 20:55
Re: Headshot active for everyone - by Adamsy - 20.08.2016, 21:27
Re: Headshot active for everyone - by Adamsy - 21.08.2016, 20:16
Re: Headshot active for everyone - by SyS - 22.08.2016, 13:50

Forum Jump:


Users browsing this thread: 2 Guest(s)