SA-MP Forums Archive
Making headshot Dis/able cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Making headshot Dis/able cmd (/showthread.php?tid=596304)



Making headshot Dis/able cmd - SyCHO - 15.12.2015

Well, my script actually doesn't only containt a gamemode (pwn + amx)
it actually has everything defined as include (commands, callbacks, defines..etcs)

This is what i've copied in:

Defines
Код:
#define WEAPON_BODY_PART_CHEST 3
#define WEAPON_BODY_PART_CROTCH 4
#define WEAPON_BODY_PART_LEFT_ARM 5
#define WEAPON_BODY_PART_RIGHT_ARM 6
#define WEAPON_BODY_PART_LEFT_LEG 7
#define WEAPON_BODY_PART_RIGHT_LEG 8
#define WEAPON_BODY_PART_HEAD 9
Callbacks
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount)
{
    if(issuerid != INVALID_PLAYER_ID )
    {
        SetPlayerHealth(playerid, 0.0);
    }
    return 1;
}
Am kinda new, and I need help to turn this system to a Filterscript and use a command to able and disable headshot system (ofc will be used by admins or smth)..


Re: Making headshot Dis/able cmd - SnG.Scot_MisCuDI - 15.12.2015

Код:
new bool:HeadShots;
CMD:headshot(playerid, params[])
{
	//isplayeradmin(here)
	{
		if(HeadShots == false)
		{
			SendClientMessage(playerid, COLOR, "You have enabled headshots");
			HeadShots = true;
		}
		else
		{
			HeadShots = false;
			SendClientMessage(playerid, COLOR, "You have disabled headshots");
		}
	}
	return 1;
}
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID && bodypart == 9 && HeadShots == true) 
    {
        // One shot to the head to kill
        SetPlayerHealth(playerid, 0.0);
    }
    return 1;
}



Re: Making headshot Dis/able cmd - SyCHO - 15.12.2015

Quote:
Originally Posted by SnG.Scot_MisCuDI
Посмотреть сообщение
Код:
new bool:HeadShots;
CMD:headshot(playerid, params[])
{
	//isplayeradmin(here)
	{
		if(HeadShots == false)
		{
			SendClientMessage(playerid, COLOR, "You have enabled headshots");
			HeadShots = true;
		}
		else
		{
			HeadShots = false;
			SendClientMessage(playerid, COLOR, "You have disabled headshots");
		}
	}
	return 1;
}
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID && bodypart == 9 && HeadShots == true) 
    {
        // One shot to the head to kill
        SetPlayerHealth(playerid, 0.0);
    }
    return 1;
}
What if I want it as a Filterscript?
do I have to write the bodyparts defines?
and how I'll make the command seperated with callback/enum


Re: Making headshot Dis/able cmd - SyCHO - 16.12.2015

Anyone


Re: Making headshot Dis/able cmd - SyCHO - 20.12.2015

bump!


Re: Making headshot Dis/able cmd - SaltySandy - 20.12.2015

What exactly do you want to achieve? I don't quite get it.. I'll gladly help you write the command ( or filterscript ) but I'm not sure what I should explain to you.