AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Gravity Menu (https://forums.alliedmods.net/showthread.php?t=313766)

generals 01-22-2019 04:06

Gravity Menu
 
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

GUCCICSGO 01-22-2019 08:59

Re: Gravity Menu
 
Quote:

Originally Posted by generals (Post 2635904)
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;
}


adma 01-22-2019 11:23

Re: Gravity Menu
 
1 Attachment(s)
!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

generals 01-22-2019 13:06

Re: Gravity Menu
 
hi ..really tnx guys


All times are GMT -4. The time now is 17:10.

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