Raised This Month: $12 Target: $400
 3% 

Gravity Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
generals
Senior Member
Join Date: Aug 2018
Old 01-22-2019 , 04:06   Gravity Menu
Reply With Quote #1

hi

i want gravity menu for bhop servers

With these features:
very low gravity
low gravity
normal gravity
high gravity
very high gravity

command:
!gravity

tnx

Last edited by generals; 01-22-2019 at 06:03.
generals is offline
GUCCICSGO
Junior Member
Join Date: Jan 2019
Location: IASI
Old 01-22-2019 , 08:59   Re: Gravity Menu
Reply With Quote #2

Quote:
Originally Posted by generals View Post
hi

i want gravity menu for bhop servers

With these features:
very low gravity
low gravity
normal gravity
high gravity
very high gravity

command:
!gravity

tnx

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;
}

Last edited by GUCCICSGO; 01-22-2019 at 08:59.
GUCCICSGO is offline
adma
Senior Member
Join Date: Oct 2015
Old 01-22-2019 , 11:23   Re: Gravity Menu
Reply With Quote #3

!gm (!gravity is already a command)
If you've removed it, just edit RegConsoleCmd("sm_gm", sm_gm, "Open gravity menu") -> RegConsoleCmd("sm_gravity", sm_gm, "Open gravity menu");

Five cvars:
gm_verylow
gm_low
gm_normal
gm_high
gm_veryhigh

Values are percentages, e.g. 0.5 makes your gravity half, 2.0 double, etc.

PHP Code:
#include <sourcemod>

ConVar g_veryLowGravity,
g_lowGravity
g_normalGravity
g_highGravity
g_veryHighGravity;

public 
Plugin myinfo = {
  
name "Gravity Menu",
  
author "adma",
  
description "",
  
version "1.0",
  
url ""
};

public 
void OnPluginStart() {
  
RegConsoleCmd("sm_gm"sm_gm"Open gravity menu");
  
g_veryLowGravity CreateConVar("gm_verylow""0.2"""_true0.0);
  
g_lowGravity CreateConVar("gm_low""0.5"""_true0.0);
  
g_normalGravity CreateConVar("gm_normal""1.0"""_true0.0);
  
g_highGravity CreateConVar("gm_high""2.0"""_true0.0);
  
g_veryHighGravity CreateConVar("gm_veryhigh""5.0"""_true0.0);
}

public 
Action sm_gm(int clientint args) {
  if (
client <= || !IsClientInGame(client)) return Plugin_Handled;
  
Menu menu = new Menu(GMHandlerMENU_ACTIONS_ALL);
  
menu.SetTitle("Gravity Menu");
  
menu.AddItem("1""Very Low");
  
menu.AddItem("2""Low");
  
menu.AddItem("3""Normal");
  
menu.AddItem("4""High");
  
menu.AddItem("5""Very High");
  
menu.Display(clientMENU_TIME_FOREVER);
  return 
Plugin_Handled;
}

public 
int GMHandler(Menu menuMenuAction actionint param1int param2) {
  switch (
action) {
    case 
MenuAction_Enddelete menu;
    case 
MenuAction_Select: {
      
char info[2]; menu.GetItem(param2infosizeof(info));
      
int selection StringToInt(info);
      switch (
selection) {
        case 
1SetEntityGravity(param1g_veryLowGravity.FloatValue);
        case 
2SetEntityGravity(param1g_lowGravity.FloatValue);
        case 
3SetEntityGravity(param1g_normalGravity.FloatValue);
        case 
4SetEntityGravity(param1g_highGravity.FloatValue);
        case 
5SetEntityGravity(param1g_veryHighGravity.FloatValue);
      }
    }
  }

  return 
0;

Note: gravity is not saved, so it is not reapplied if the player disconnects then reconnects
Attached Files
File Type: sp Get Plugin or Get Source (gravitymenu.sp - 102 views - 1.8 KB)

Last edited by adma; 01-22-2019 at 11:31.
adma is offline
generals
Senior Member
Join Date: Aug 2018
Old 01-22-2019 , 13:06   Re: Gravity Menu
Reply With Quote #4

hi ..really tnx guys
generals is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode