Dont damage AWP

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Заключена
Потребителски аватар

Автор на темата
lantimilan
Foreigner
Foreigner
Мнения: 224
Регистриран: 29 ное 2017, 22:49
Се отблагодари: 4 пъти
Получена благодарност: 1 път
Контакти:

Dont damage AWP

Мнение от lantimilan » 05 мар 2019, 08:36

Hello its any possible to make one plugin to set some steamid not damage if anybody try to kill with AWP.

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5181
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 64 пъти
Получена благодарност: 512 пъти
Години: 21
Контакти:

Dont damage AWP

Мнение от OciXCrom TM » 06 мар 2019, 20:47

Create a file named NoDamageAWP.ini in your amxmodx/configs folder and put each SteamID on a new line.

Код: Избери всички

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32
#endif

#if !defined MAX_AUTHID_LENGTH
const MAX_AUTHID_LENGTH = 64
#endif

const BLOCKED_WEAPON = CSW_AWP

new g_szSteamId[MAX_PLAYERS][MAX_AUTHID_LENGTH], Trie:g_tSteamIds

public plugin_init()
{
	register_plugin("No Damage AWP by SteamID", "1.0", "OciXCrom")
	RegisterHam(Ham_TakeDamage, "player", "PreTakeDamage", 0)
	g_tSteamIds = TrieCreate()
	ReadFile()
}

public plugin_end()
{
	TrieDestroy(g_tSteamIds)
}

public client_putinserver(id)
{
	get_user_authid(id, g_szSteamId[id], charsmax(g_szSteamId[]))
}

ReadFile()
{
	new szFilename[256]
	get_configsdir(szFilename, charsmax(szFilename))
	add(szFilename, charsmax(szFilename), "/NoDamageAWP.ini")

	new iFilePointer = fopen(szFilename, "rt")

	if(iFilePointer)
	{
		new szData[128]

		while(!feof(iFilePointer))
		{
			fgets(iFilePointer, szData, charsmax(szData))
			trim(szData)

			switch(szData[0])
			{
				case EOS, ';', '#': continue
				default:
				{
					trim(szData)
					TrieSetCell(g_tSteamIds, szData, 1)
				}
			}
		}

		fclose(iFilePointer)
	}
}

public PreTakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits)
{
	return (TrieKeyExists(g_tSteamIds, g_szSteamId[iAttacker]) && get_user_weapon(iAttacker) == BLOCKED_WEAPON && iAttacker == iInflictor) ? HAM_SUPERCEDE : HAM_IGNORED
}

Потребителски аватар

Автор на темата
lantimilan
Foreigner
Foreigner
Мнения: 224
Регистриран: 29 ное 2017, 22:49
Се отблагодари: 4 пъти
Получена благодарност: 1 път
Контакти:

Dont damage AWP

Мнение от lantimilan » 06 мар 2019, 21:11

OciXCrom написа:
06 мар 2019, 20:47
Create a file named NoDamageAWP.ini in your amxmodx/configs folder and put each SteamID on a new line.

Код: Избери всички

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32
#endif

#if !defined MAX_AUTHID_LENGTH
const MAX_AUTHID_LENGTH = 64
#endif

const BLOCKED_WEAPON = CSW_AWP

new g_szSteamId[MAX_PLAYERS][MAX_AUTHID_LENGTH], Trie:g_tSteamIds

public plugin_init()
{
	register_plugin("No Damage AWP by SteamID", "1.0", "OciXCrom")
	RegisterHam(Ham_TakeDamage, "player", "PreTakeDamage", 0)
	g_tSteamIds = TrieCreate()
	ReadFile()
}

public plugin_end()
{
	TrieDestroy(g_tSteamIds)
}

public client_putinserver(id)
{
	get_user_authid(id, g_szSteamId[id], charsmax(g_szSteamId[]))
}

ReadFile()
{
	new szFilename[256]
	get_configsdir(szFilename, charsmax(szFilename))
	add(szFilename, charsmax(szFilename), "/NoDamageAWP.ini")

	new iFilePointer = fopen(szFilename, "rt")

	if(iFilePointer)
	{
		new szData[128]

		while(!feof(iFilePointer))
		{
			fgets(iFilePointer, szData, charsmax(szData))
			trim(szData)

			switch(szData[0])
			{
				case EOS, ';', '#': continue
				default:
				{
					trim(szData)
					TrieSetCell(g_tSteamIds, szData, 1)
				}
			}
		}

		fclose(iFilePointer)
	}
}

public PreTakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits)
{
	return (TrieKeyExists(g_tSteamIds, g_szSteamId[iAttacker]) && get_user_weapon(iAttacker) == BLOCKED_WEAPON && iAttacker == iInflictor) ? HAM_SUPERCEDE : HAM_IGNORED
}
Its any possible to have in plugin steamid not have file .ini i need very much

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5181
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 64 пъти
Получена благодарност: 512 пъти
Години: 21
Контакти:

Dont damage AWP

Мнение от OciXCrom TM » 06 мар 2019, 21:15

You mean inside the .sma file? But why? That way you will need to recompile the plugin every time you want to add/remove something.

Код: Избери всички

#include <amxmodx>
#include <hamsandwich>

#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32
#endif

#if !defined MAX_AUTHID_LENGTH
const MAX_AUTHID_LENGTH = 64
#endif

const BLOCKED_WEAPON = CSW_AWP

new const g_szSteamIds[][] =
{
	"STEAM_:0:123456789",
	"STEAM_:0:123456789",
	"STEAM_:0:123456789"
}

new bool:g_bNoDamage[MAX_PLAYERS]

public plugin_init()
{
	register_plugin("No Damage AWP by SteamID", "1.0", "OciXCrom")
	RegisterHam(Ham_TakeDamage, "player", "PreTakeDamage", 0)
}

public client_putinserver(id)
{
	g_bNoDamage[id] = false

	new szAuthId[MAX_AUTHID_LENGTH]
	get_user_authid(id, szAuthId, charsmax(szAuthId))

	for(new i; i < sizeof(g_szSteamIds); i++)
	{
		if(equal(g_szSteamIds[i], szAuthId))
		{
			g_bNoDamage[id] = true
			break
		}
	}
}

public PreTakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits)
{
	return (g_bNoDamage[iAttacker] && get_user_weapon(iAttacker) == BLOCKED_WEAPON && iAttacker == iInflictor) ? HAM_SUPERCEDE : HAM_IGNORED
}

Потребителски аватар

Автор на темата
lantimilan
Foreigner
Foreigner
Мнения: 224
Регистриран: 29 ное 2017, 22:49
Се отблагодари: 4 пъти
Получена благодарност: 1 път
Контакти:

Dont damage AWP

Мнение от lantimilan » 06 мар 2019, 21:16

Because some people who have acces in ftp can joke with this plugin and this form i stoped abuse

Added in 3 minutes 45 seconds:
Thanks for this great plugin closed topic thanks :D

Заключена

Върни се в “Заявки за плъгини”

Кой е на линия

Потребители, разглеждащи този форум: Няма регистрирани потребители и 3 госта