Headshot , Normal kill (how to define)

Ако имате затруднения при изработката/преработката на даден плъгин - пишете тук, ще се опитаме да ви помогнем!
Аватар
BloodyPro
Извън линия
Foreigner
Foreigner
Мнения: 26
Регистриран на: 26 Юли 2020, 16:28
Местоположение: Palestine
Се отблагодари: 1 път
Обратна връзка:

Headshot , Normal kill (how to define)

Мнение от BloodyPro » 13 Сеп 2020, 15:52

Hey,

im trying to make a plugin that gives certian admin flag hp when he get kills.
so how do i let he plugin know that he get a headshot kill or normal kill

Аватар
atmax
Извън линия
Потребител
Потребител
Мнения: 492
Регистриран на: 22 Мар 2018, 15:06
Се отблагодари: 37 пъти
Получена благодарност: 43 пъти

Headshot , Normal kill (how to define)

Мнение от atmax » 13 Сеп 2020, 16:14

First register the function that will be called after someone dies.

Код за потвърждение: Избери целия код

public plugin_init()
{
	...
	register_event("DeathMsg", "eventDeathMsg", "a")
}
Then you do this:

Код за потвърждение: Избери целия код

public eventDeathMsg()
{
	new iKiller = read_data(1), iVictim = read_data(2) //Here we got the Killer and Victim's Id
	new iHeadshot = read_data(3) // This is for Headshot Kill
	
	if(!is_user_connected(iKiller) || iKiller == iVictim)	//This is mandatory! iKiller == iVictim with this you can check self kills/suicides
		return PLUGIN_CONTINUE;
	
	if(iHeadshot)	//This is called on headshot kill
	{
		//do something
	}
	else	//Thats my way to detect headshot and normal kill! :) (Thats the normal)
	{
		//do something
	}
}
Rest in peace my friend I always will remember you! 🖤👊

Аватар
BloodyPro
Извън линия
Foreigner
Foreigner
Мнения: 26
Регистриран на: 26 Юли 2020, 16:28
Местоположение: Palestine
Се отблагодари: 1 път
Обратна връзка:

Headshot , Normal kill (how to define)

Мнение от BloodyPro » 13 Сеп 2020, 16:25

atmax написа: 13 Сеп 2020, 16:14 First register the function that will be called after someone dies.

Код за потвърждение: Избери целия код

public plugin_init()
{
	...
	register_event("DeathMsg", "eventDeathMsg", "a")
}
Then you do this:

Код за потвърждение: Избери целия код

public eventDeathMsg()
{
	new iKiller = read_data(1), iVictim = read_data(2) //Here we got the Killer and Victim's Id
	new iHeadshot = read_data(3) // This is for Headshot Kill
	
	if(!is_user_connected(iKiller) || iKiller == iVictim)	//This is mandatory! iKiller == iVictim with this you can check self kills/suicides
		return PLUGIN_CONTINUE;
	
	if(iHeadshot)	//This is called on headshot kill
	{
		//do something
	}
	else	//Thats my way to detect headshot and normal kill! :) (Thats the normal)
	{
		//do something
	}
}
Thank you !!

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Помощ в скриптирането”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 9 госта