Code:
#include <sourcemod>
#include <sdktools>
#include <sdktools_sound>
#include <cstrike>
#include <sdkhooks>
#include <clientprefs>
#pragma semicolon 1
#define VERSION "1.7"
public Plugin:myinfo =
{
name = "Knife menu",
author = "GUCCI",
description = " Knife menu",
version = VERSION,
url = "www.laleagane.ro"
};
public OnPluginStart()
{
LoadTranslations("common.phrases");
RegConsoleCmd("sm_knife", KnifeMenu);
RegConsoleCmd("buy", KnifeMenu);
RegConsoleCmd("buymenu", KnifeMenu);
RegConsoleCmd("autobuy", KnifeMenu);
RegConsoleCmd("rebuy", KnifeMenu);
// ======================================================================
HookEvent( "player_spawn", OnPlayerSpawn );
}
public Action:OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId( GetEventInt( event, "userid" ));
if ( IsValidPlayer( client ))
{
if(GetClientTeam(client) == CS_TEAM_CT)
{
new iWeapon = GetPlayerWeaponSlot(client, 2);
PrintToChat(client, "\x01[\x02Bhop\x01]\x01 You spawned with the Default Knife.");
SetEntityGravity(client, 1.0);
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon);
new knife = GivePlayerItem(client, "weapon_bayonet");
EquipPlayerWeapon(client, knife);
KCM(client);
}
}
}
public Action:KnifeMenu(client,args)
{
if(client == 0)
{
PrintToServer("%t","Command is in-game only");
return Plugin_Handled;
}
else if ( IsPlayerAlive( client ))
{
if(GetClientTeam(client) == CS_TEAM_CT)
{
KCM(client);
}
}
else
{
PrintToChat(client, "\x01[\x02Bhop\x01]\x01 You can't choose Knife.");
}
return Plugin_Handled;
}
public Action:KCM(clientId)
{
new Handle:menu = CreateMenu(KCMenuHandler);
SetMenuTitle(menu, "Bhop - Knife Menu");
AddMenuItem(menu, "option1", "Default [Normal]");
AddMenuItem(menu, "option2", "Butcher [Low Gravity]");
AddMenuItem(menu, "option3", "Pocket [High Speed]");
AddMenuItem(menu, "option4", "VIP [Only vips]");
SetMenuExitButton(menu, true);
DisplayMenu(menu, clientId, MENU_TIME_FOREVER);
return Plugin_Handled;
}
public KCMenuHandler(Handle:menu, MenuAction:action, client, itemNum)
{
if ( action == MenuAction_Select )
{
new String:info[32];
new iWeapon = GetPlayerWeaponSlot(client, 2);
GetMenuItem(menu, itemNum, info, sizeof(info));
if ( strcmp(info,"option1") == 0 )
{
{
PrintToChat(client, "\x01[\x02Bhop\x01]\x01 You now have Default Knife.");
SetEntityGravity(client, 1.0);
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon);
new knife = GivePlayerItem(client, "weapon_bayonet");
EquipPlayerWeapon(client, knife);
}
}
else if ( strcmp(info,"option2") == 0 )
{
{
PrintToChat(client, "\x01[\x02Bhop\x01]\x01 You now have Butcher Knife.");
SetEntityGravity(client, 0.6);
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon);
new knife = GivePlayerItem(client, "weapon_knife_gut");
EquipPlayerWeapon(client, knife);
}
}
else if ( strcmp(info,"option3") == 0 )
{
{
PrintToChat(client, "\x01[\x02Bhop\x01]\x01 You now have Pocket Knife.");
SetEntityGravity(client, 1.0);
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.3);
RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon);
new knife = GivePlayerItem(client, "weapon_knife_flip");
EquipPlayerWeapon(client, knife);
}
}
else if ( strcmp(info,"option4") == 0 )
{
{
if (IsPlayerVip(client))
{
PrintToChat(client, "\x01[\x02Bhop\x01]\x01 You now have VIP Knife.");
SetEntityGravity(client, 0.;
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.1);
RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon);
new knife = GivePlayerItem(client, "weapon_knife_karambit");
EquipPlayerWeapon(client, knife);
}
else
{
PrintToChat(client, "\x01[\x02Bhop\x01]\x01 You are not VIP.");
KCM(client);
}
}
}
}
}
public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (GetClientTeam(client) == 1 && !IsPlayerAlive(client))
{
return;
}
}
bool:IsPlayerVip(client)
{
return CheckCommandAccess(client, "flag_vip", ADMFLAG_CUSTOM1, false);
}
bool:IsValidPlayer( client )
{
if ( client < 1 || client > MaxClients ) return false;
if ( !IsClientConnected( client )) return false;
if ( !IsClientInGame( client )) return false;
if ( IsFakeClient( client )) return false;
return true;
}