R1KO
fuck society
- Сообщения
- 9,457
- Реакции
- 7,786
- Команда форума
- #21
ну не знаю... я бы сделал так:
PHP:
#include <sourcemod>
#include <sdkhooks>
new Handle:g_hCvarKnifeSpeed,
bool:g_bHasSpeed[MAXPLAYERS+1] = false;
public OnPluginStart()
{
g_hCvarKnifeSpeed = CreateConVar("sm_knife_speed", "1.0", "How Speed Will Be Player whuch used Weapon Knife", FCVAR_NOTIFY, true, 0.1, true, 3.0);
}
public OnClientPutInServer(client)
{
g_bHasSpeed[client] = false;
SDKHook(client, SDKHook_WeaponSwitch, Weapon_Function);
}
public Action:Weapon_Function(client, weapon)
{
decl String:weapon_classname[16];
GetEdictClassname(weapon, weapon_classname, sizeof(weapon_classname));
if (IsClientInGame(client))
{
if(StrEqual(weapon_classname, "weapon_knife", false))
{
g_bHasSpeed[client] = true;
SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", GetConVarFloat(g_hCvarKnifeSpeed));
} else
{
if(g_bHasSpeed[client])
{
g_bHasSpeed[client] = false;
SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 1.0);
}
}
}
}