1. sayfa (Toplam 1 sayfa)

Reapi Silah Modeli Giydirme

Gönderilme zamanı: Pzt Ara 13, 2021 4:16 pm
gönderen 1000DAYS
Arkadaşlar eklentiler-pluginler/weapon-skin-menu-t48372.html bu eklentiyi menü olarak değil de, ghw weapon replacement eklentisi gibi yapma şansınız var mı ?
direk inideki silahı giydircek şekilde yani.

Reapi Silah Modeli Giydirme

Gönderilme zamanı: Pzt Ara 13, 2021 5:08 pm
gönderen orucoglukayra
Dene bakalım ;

Kod: Tümünü seç

/*
	* Plugin created by ` BesTCore;
	* Plugin created for "forum.csduragi.com"
	* Date: 17.06.2021 - 23:32
*/
#pragma semicolon 1

#include <amxmodx>
#include <reapi>

#define iMaxSkin  30   // Kac adet skin varsa "+1" fazlası. !! Aksi takdirde hata çıkarabilir.

new const g_szSkinsFile[] = "addons/amxmodx/configs/Skins.ini";   // Skin verilerinin kayıt yolu. * The storage location of the skin data.

enum _:SkinData
{
	szSkinName[32],
	szSkinFile[64],
	szSkinWeaponCode[32]
};
new Array:g_aSkin;

public plugin_init()
{
	register_plugin("Weapon Skin Menu", "0.1", "` BesTCore;");

	RegisterHookChain(RG_CBasePlayerWeapon_DefaultDeploy, "RG_CBasePlayerWeapon_DefaultDeploy_Pre", .post = false);
}
public RG_CBasePlayerWeapon_DefaultDeploy_Pre(const iWeapon, szViewModel[], szWeaponModel[], iAnim, szAnimExt[], skiplocal)
{
	new iSize = ArraySize(g_aSkin), aData[SkinData], iWeaponIdType = get_member(iWeapon, m_iId);

	for(new i = 0; i < iSize; i++)
	{
		ArrayGetArray(g_aSkin, i, aData);

		if(iWeaponIdType != get_weaponid(aData[szSkinWeaponCode]))   // If the weapon does not match the code, skip it.
		{
			continue;
		}

		SetHookChainArg(2, ATYPE_STRING, aData[szSkinFile]);   // Add your skin.
	}
}
public plugin_precache()
{
	g_aSkin = ArrayCreate(SkinData);

	new iFile = fopen(g_szSkinsFile, "rt");

	if(iFile)
	{
		new szBuffer[MAX_FMT_LENGTH],
			pSkinName[32], pSkinFile[64], pSkinWeaponCode[32], aData[SkinData];

		while(fgets(iFile, szBuffer, charsmax(szBuffer)))
		{
			trim(szBuffer);

			if(szBuffer[0] == EOS || szBuffer[0] == ';')
			{
				continue;
			}

			parse(szBuffer, pSkinName, charsmax(pSkinName), pSkinFile, charsmax(pSkinFile), pSkinWeaponCode, charsmax(pSkinWeaponCode));

			copy(aData[szSkinName], charsmax(aData), pSkinName);
			copy(aData[szSkinFile], charsmax(aData), pSkinFile);
			copy(aData[szSkinWeaponCode], charsmax(aData), pSkinWeaponCode);

			ArrayPushArray(g_aSkin, aData);

			precache_model(fmt("%s", pSkinFile));
		}
		fclose(iFile);
	}
}
public plugin_end()
{
	ArrayDestroy(g_aSkin);
}