При респавне через вип выдает декой

SIRIUS

♿___DejaVu
Сообщения
509
Реакции
253
Установил плагин для фикса лежачих скинов и пропадания ножа, но при респавне стал выдавать декой которую нельзя использовать
пробовал заменить
int iWeapon = GivePlayerItem(client, "weapon_decoy");
на
int iWeapon = GivePlayerItem(client, "weapon_knife");
но когда ты респавнишся тебе дается ножик, но он дает еще раз и проподает
 

Вложения

  • no_weapon_fix.sp
    2.9 КБ · Просмотры: 9

AlmazON

Не путать с самим yand3xmail
Сообщения
5,099
Реакции
2,755
при респавне стал выдавать декой которую нельзя использовать
Может заработает:
PHP:
#pragma semicolon 1

#define PLUGIN_VERSION "1.3.1"

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#pragma newdecls required

public Plugin myinfo = 
{
	name = "No Weapon Fix",
	author = ".#Zipcore",
	description = "",
	version = PLUGIN_VERSION,
	url = ""
};

#define LoopIngamePlayers(%1) for(int %1=1;%1<=MaxClients;++%1)\
if(IsClientInGame(%1) && !IsFakeClient(%1))

int g_iFakeWeaponRef[MAXPLAYERS + 1];

bool g_bEnable;

public void OnPluginStart()
{
	CreateConVar("no_weapon_fix_version", PLUGIN_VERSION, "No Weapon Fix Version", FCVAR_DONTRECORD|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
	
	ConVar cvEnable = CreateConVar("no_weapon_fix_enable",		"1",	"Set to 0 to disable this plugin.", _, true, 0.0, true, 1.0);
	g_bEnable = cvEnable.BoolValue;
	HookConVarChange(cvEnable, OnSettingChanged);
	
	LoopIngamePlayers(client)
		OnClientPostAdminCheck(client);
}

public void OnSettingChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
	g_bEnable = convar.BoolValue;
}

public void OnClientPostAdminCheck(int client)
{
	g_iFakeWeaponRef[client] = -1;
	
	SDKHook(client, SDKHook_WeaponEquip, WeaponSwitch);
	SDKHook(client, SDKHook_WeaponDrop, WeaponDrop);
}

public Action WeaponSwitch(int client, int weapon)
{
	if(weapon != (weapon = EntRefToEntIndex(g_iFakeWeaponRef[client])))
	{
		SetEntProp(client, Prop_Data, "m_bDrawViewmodel", 1);
		RemovePlayerItem(client, weapon);
		AcceptEntityInput(weapon, "Kill");
	}
	return Plugin_Continue;
}

public Action WeaponDrop(int client, int weapon)
{
	if(weapon == EntRefToEntIndex(g_iFakeWeaponRef[client]) && weapon != -1)
	{
		SetEntProp(client, Prop_Data, "m_bDrawViewmodel", 1);
		RemovePlayerItem(client, weapon);
		AcceptEntityInput(weapon, "Kill");
	}
	return Plugin_Continue;
}

public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
{
	if(!g_bEnable || !IsPlayerAlive(client))
		return Plugin_Continue;

	static int iEntity;
	if((iEntity = EntRefToEntIndex(g_iFakeWeaponRef[client])) != -1)
	{
		float fUnlockTime = GetGameTime() + 0.5;
		
		SetEntProp(client, Prop_Data, "m_bDrawViewmodel", 0);
		SetEntPropFloat(client, Prop_Send, "m_flNextAttack", fUnlockTime);
		SetEntPropFloat(iEntity, Prop_Send, "m_flNextPrimaryAttack", fUnlockTime);
	}

	else if(weapon == -1 || GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon") == -1)
	{
		float fUnlockTime = GetGameTime() + 0.5;
		
		SetEntPropFloat(client, Prop_Send, "m_flNextAttack", fUnlockTime);
		SetEntPropFloat(weapon = GivePlayerItem(client, "weapon_decoy"), Prop_Send, "m_flNextPrimaryAttack", fUnlockTime);

		g_iFakeWeaponRef[client] = EntIndexToEntRef(weapon);
		return Plugin_Changed;
	}

  	return Plugin_Continue;
}
 

SIRIUS

♿___DejaVu
Сообщения
509
Реакции
253
Может заработает:
PHP:
#pragma semicolon 1

#define PLUGIN_VERSION "1.3.1"

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#pragma newdecls required

public Plugin myinfo =
{
    name = "No Weapon Fix",
    author = ".#Zipcore",
    description = "",
    version = PLUGIN_VERSION,
    url = ""
};

#define LoopIngamePlayers(%1) for(int %1=1;%1<=MaxClients;++%1)\
if(IsClientInGame(%1) && !IsFakeClient(%1))

int g_iFakeWeaponRef[MAXPLAYERS + 1];

bool g_bEnable;

public void OnPluginStart()
{
    CreateConVar("no_weapon_fix_version", PLUGIN_VERSION, "No Weapon Fix Version", FCVAR_DONTRECORD|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
 
    ConVar cvEnable = CreateConVar("no_weapon_fix_enable",        "1",    "Set to 0 to disable this plugin.", _, true, 0.0, true, 1.0);
    g_bEnable = cvEnable.BoolValue;
    HookConVarChange(cvEnable, OnSettingChanged);
 
    LoopIngamePlayers(client)
        OnClientPostAdminCheck(client);
}

public void OnSettingChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
    g_bEnable = convar.BoolValue;
}

public void OnClientPostAdminCheck(int client)
{
    g_iFakeWeaponRef[client] = -1;
 
    SDKHook(client, SDKHook_WeaponEquip, WeaponSwitch);
    SDKHook(client, SDKHook_WeaponDrop, WeaponDrop);
}

public Action WeaponSwitch(int client, int weapon)
{
    if(weapon != (weapon = EntRefToEntIndex(g_iFakeWeaponRef[client])))
    {
        SetEntProp(client, Prop_Data, "m_bDrawViewmodel", 1);
        RemovePlayerItem(client, weapon);
        AcceptEntityInput(weapon, "Kill");
    }
    return Plugin_Continue;
}

public Action WeaponDrop(int client, int weapon)
{
    if(weapon == EntRefToEntIndex(g_iFakeWeaponRef[client]) && weapon != -1)
    {
        SetEntProp(client, Prop_Data, "m_bDrawViewmodel", 1);
        RemovePlayerItem(client, weapon);
        AcceptEntityInput(weapon, "Kill");
    }
    return Plugin_Continue;
}

public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
{
    if(!g_bEnable || !IsPlayerAlive(client))
        return Plugin_Continue;

    static int iEntity;
    if((iEntity = EntRefToEntIndex(g_iFakeWeaponRef[client])) != -1)
    {
        float fUnlockTime = GetGameTime() + 0.5;
     
        SetEntProp(client, Prop_Data, "m_bDrawViewmodel", 0);
        SetEntPropFloat(client, Prop_Send, "m_flNextAttack", fUnlockTime);
        SetEntPropFloat(iEntity, Prop_Send, "m_flNextPrimaryAttack", fUnlockTime);
    }

    else if(weapon == -1 || GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon") == -1)
    {
        float fUnlockTime = GetGameTime() + 0.5;
     
        SetEntPropFloat(client, Prop_Send, "m_flNextAttack", fUnlockTime);
        SetEntPropFloat(weapon = GivePlayerItem(client, "weapon_decoy"), Prop_Send, "m_flNextPrimaryAttack", fUnlockTime);

        g_iFakeWeaponRef[client] = EntIndexToEntRef(weapon);
        return Plugin_Changed;
    }

      return Plugin_Continue;
}
Я понял как надо сделать.
Этот плагин дает невидимый декой, надо сделать что бы давал нож (если изменить SetEntPropFloat(weapon = GivePlayerItem(client, "weapon_decoy"), на SetEntPropFloat(weapon = GivePlayerItem(client, "weapon_knife"), то нож тоже невидимый) надо чтобы нормально выдавался
 
Последнее редактирование:
Сверху Снизу