Nice release !
BTW can you tell me which throwing knife plugin you're using?
AePT
12-30-2020 22:12
Re: [CS:GO] CS:GO Weapon fists
Nice release! :3
Quote:
Originally Posted by nguyenbaodanh
(Post 2730757)
Nice release !
BTW can you tell me which throwing knife plugin you're using?
CS:GO has a cvar to enable knife throwing.
mp_drop_knife_enable 1
Effeff
12-31-2020 13:20
Re: [CS:GO] CS:GO Weapon fists
I had written something similar awhile ago. I do not change the movement speed, I just changed the damage of fists to be similar to knife against no armor opponents. Maybe it will be helpful or give ideas? It looks like this:
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
g_bLate = late;
}
public void OnPluginStart()
{
g_hUseFist = RegClientCookie("cookie_usefists", "Spawn with fists", CookieAccess_Private);
HookEvent("player_spawn", Event_PlayerSpawn);
RegConsoleCmd("sm_fists", ShowFistMenu, "Toggle spawning with knife or fists in menu");
if (g_bLate)
{
for (int i = 1; i < MaxClients; ++i)
{
if (IsClientInGame(i))
{
SDKHook(i, SDKHook_OnTakeDamage, Event_OnTakeDamage);
SDKHook(i, SDKHook_WeaponDrop, Event_WeaponDrop);
}
}
}
}
public Action OnPlayerRunCmd(int client, int &buttons)
{
if(!(buttons & IN_ATTACK || buttons & IN_ATTACK2))
{
return Plugin_Continue;
}
public void OnMapStart()
{
for (int client = 0; client < sizeof(g_iClientFistPhase); client++)
{
g_iClientFistPhase[client] = -1;
}
}
public Action ShowFistMenu(int client, int args)
{
Menu menu = new Menu(MenuHandlerFist);
menu.SetTitle("Fist Settings");
if (!g_iClientUseFist[client])
{
menu.AddItem("0", "Spawn With Knife [ENABLED]");
menu.AddItem("1", "Spawn With Fists");
}
else
{
menu.AddItem("0", "Spawn With Knife");
menu.AddItem("1", "Spawn With Fists [ENABLED]");
}
menu.Display(client, MENU_TIME_FOREVER);
return Plugin_Handled;
}
int MenuHandlerFist(Menu menu, MenuAction action, int client, int option)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Select)
{
char menuItem[32];
menu.GetItem(option, menuItem, sizeof(menuItem));
g_iClientUseFist[client] = StringToInt(menuItem);
SetMeleeWeapon(GetClientUserId(client));
SetClientCookie(client, g_hUseFist, menuItem);
}
}
public void OnClientPostAdminCheck(int client)
{
g_bClientPostAdminChecked[client] = true;
if (AreClientCookiesCached(client))
{
OnClientCookiesCached(client);
}
SDKHook(client, SDKHook_OnTakeDamage, Event_OnTakeDamage);
SDKHook(client, SDKHook_WeaponDrop, Event_WeaponDrop);
}
public void OnClientCookiesCached(int client)
{
if (client && IsClientInGame(client) && g_bClientPostAdminChecked[client])
{
char buffer[24];
GetClientCookie(client, g_hUseFist, buffer, sizeof(buffer));
if (strlen(buffer) > 0)
{
g_iClientUseFist[client] = StringToInt(buffer);
}
}
}
int GetClientMeleeWeapon(int client)
{
int entity = GetPlayerWeaponSlot(client, 2);
if (entity != -1)
{
char weaponName[32];
GetEntityClassname(entity, weaponName, sizeof(weaponName));
if (strcmp(weaponName, "weapon_knife") == 0)
{
return KNIFE;
}
else if (strcmp(weaponName, "weapon_fists") == 0)
{
return FIST;
}
else
{
return NONE;
}
}
return -1;
}
void RemoveClientKnife(int client)
{
int array_size = GetEntPropArraySize(client, Prop_Send, "m_hMyWeapons");
int entity;
char weaponName[32];
for (int i = 0; i < array_size; i++)
{
entity = GetEntPropEnt(client, Prop_Send, "m_hMyWeapons", i);
if (entity != -1 && GetEntSendPropOffs(entity, "m_bStartArming") == -1)
{
GetEdictClassname(entity, weaponName, sizeof(weaponName));
if (strcmp(weaponName, "weapon_knife") == 0)
{
CS_DropWeapon(client, entity, false, true);
RemoveEntity(entity);
break;
}
}
}
}
void SetMeleeWeapon(int userId)
{
int client = GetClientOfUserId(userId);
if (client && client < MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
{
if (g_iClientUseFist[client])
{
int weapon = GetClientMeleeWeapon(client);
if (weapon == KNIFE)
{
RemoveClientKnife(client);
}
else if(weapon == NONE)
{
EquipFists(userId);
}
}
else
{
int weapon = GetClientMeleeWeapon(client);
if (weapon == FIST)
{
PrintToChat(client, "Fists cannot be immediately removed.");
PrintToChat(client, "You will spawn with a knife next time you die.");
}
else if(weapon == NONE)
{
GivePlayerItem(client, "weapon_knife");
}
}
}
}
darkboss
12-07-2021 05:09
Re: [CS:GO] CS:GO Weapon fists
can u make it like in danger zone? i mean to have bare hands and the knife in the same time, I have one plugin similar but I can't pick up the dropped knife