AlliedModders Donor
Join Date: Dec 2011
Location: Israel
|
05-19-2012
, 21:26
Re: ClientCommand
|
#9
|
Quote:
Originally Posted by Powerlord
Use ITEMDRAW_SPACER instead of ITEMDRAW_DISABLED. However, this doesn't work if the menu has multiple pages.
|
Thank you!
There is only a final thing that i need to fix before release.
some stuff dont working, i mean some stuff not executing the command on the client.
Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#define PLUGIN_VERSION "2.5.0"
#pragma semicolon 1
new bool:allow[MAXPLAYERS+1];
new bool:tele_saved[MAXPLAYERS+1] = {false, ...};
new Float:checkpoint[MAXPLAYERS+1][3];
new bool:tele_saved2[MAXPLAYERS+1] = {false, ...};
new Float:checkpoint2[MAXPLAYERS+1][3];
new Handle:weaponsallow = INVALID_HANDLE;
new Handle:gravityallow = INVALID_HANDLE;
new Handle:checkpointsallow = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "Bunnyhop Commands",
author = "TimeBomb",
description = "Bunnyhop Commands.",
version = PLUGIN_VERSION,
url = ""
};
public OnPluginStart()
{
RegConsoleCmd("sm_superlowgrav", Command_SuperLowgravity, "Super Low Gravity for Client.");
RegConsoleCmd("sm_lowgrav", Command_Lowgravity, "Low Gravity for Client.");
RegConsoleCmd("sm_highgrav", Command_Highgravity, "High Gravity for Client..");
RegConsoleCmd("sm_normalgrav", Command_Normalgravity, "Normal Gravity for Client.");
RegConsoleCmd("sm_superlowgravity", Command_SuperLowgravity, "Super Low Gravity for Client.");
RegConsoleCmd("sm_lowgravity", Command_Lowgravity, "Low Gravity for Client.");
RegConsoleCmd("sm_highgravity", Command_Highgravity, "High Gravity for Client.");
RegConsoleCmd("sm_normalgravity", Command_Normalgravity, "Normal Gravity for Client.");
RegConsoleCmd("sm_slg", Command_SuperLowgravity, "Super Low Gravity for Client.");
RegConsoleCmd("sm_lg", Command_Lowgravity, "Low Gravity for Client.");
RegConsoleCmd("sm_hg", Command_Highgravity, "High Gravity for Client.");
RegConsoleCmd("sm_ng", Command_Normalgravity, "Normal Gravity for Client.");
RegConsoleCmd("sm_r", Command_reviver, "Respawning Client, Usable for Restarting the Map.");
RegConsoleCmd("sm_restart", Command_reviver, "Respawning Client, Usable for Restarting the Map.");
RegConsoleCmd("sm_commands", Command_Commands, "Commands Menu.");
RegConsoleCmd("sm_bhop", Command_Commands, "Commands Menu.");
RegConsoleCmd("sm_comms", Command_Commands, "Commands Menu.");
RegConsoleCmd("sm_guns", Command_Guns, "Guns Menu.");
RegConsoleCmd("sm_w", Command_Guns, "Guns Menu.");
RegConsoleCmd("sm_weapons", Command_Guns, "Guns Menu.");
RegConsoleCmd("sm_knife", Command_knife, "Spawns a Knife, Usable to Maps without Knifes.");
RegConsoleCmd("sm_kn", Command_knife, "Spawns a Knife, For a Fat lazy Man, Usable to Maps without Knifes.");
RegConsoleCmd("sm_usp", Command_usp, "Spawns a Usp Pistol.");
RegConsoleCmd("sm_awp", Command_awp, "Spawns a AWP Sniper Rifle.");
RegConsoleCmd("sm_deagle", Command_deagle, "Spawns a Desert Eagle Pistol.");
RegConsoleCmd("sm_scout", Command_scout, "Spawns a Scout Sniper Rifle.");
RegConsoleCmd("sm_save1", Command_save1, "Saving a Checkpoint on The Client Position.");
RegConsoleCmd("sm_tele1", Command_tele1, "Teleport to your Saved Checkpoint [1].");
RegConsoleCmd("sm_s1", Command_save1, "Saving a Checkpoint on The Client Position [1].");
RegConsoleCmd("sm_t1", Command_tele1, "Teleport to your Saved Checkpoint. [1]");
RegConsoleCmd("sm_save2", Command_save2, "Saving a Checkpoint on The Client Position. [2]");
RegConsoleCmd("sm_tele2", Command_tele2, "Teleport to your Saved Checkpoint. [2]");
RegConsoleCmd("sm_s2", Command_save2, "Saving a Checkpoint on The Client Position. [2]");
RegConsoleCmd("sm_t2", Command_tele2, "Teleport to your Saved Checkpoint. [2]");
RegConsoleCmd("sm_cp", Command_cp, "CheckPoints Menu.");
RegConsoleCmd("sm_checkpoints", Command_cp, "CheckPoints Menu.");
RegConsoleCmd("sm_gravitycommands", Command_gravity, "Gravity Commands.");
RegConsoleCmd("sm_grav", Command_gravity, "Gravity Commands.");
weaponsallow = CreateConVar("sm_bhopcommands_weapons", "1", "Enable Weapon Spawning? [1 - True] [0 - False].");
gravityallow = CreateConVar("sm_bhopcommands_gravity", "1", "Enable Gravity Commands? [1 - True] [0 - False].");
checkpointsallow = CreateConVar("sm_bhopcommands_checkpoints", "1", "Enable Check Points? [1 - True] [0 - False].");
CreateConVar("sm_bhopcommands_version", PLUGIN_VERSION, "Bunnyhop Commands Version.", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
SetConVarInt(FindConVar("sv_enablebunnyhopping"), 1);
SetConVarInt(FindConVar("sv_enableboost"), 1);
SetConVarInt(FindConVar("sv_airaccelerate"), 99999999);
CreateTimer(240.0, ad, _, TIMER_REPEAT);
AutoExecConfig(true, "bhopcommands");
}
public OnMapStart()
{
for(new i = 1; i <= MaxClients; i++)
{
allow[i]=true;
}
}
public Action:ad(Handle:SuperTimer, any:data)
{
PrintToChatAll("\x04[SM]\x01 This Server is Running Bunnyhop Commands %s.", PLUGIN_VERSION);
}
public Action:Command_Lowgravity(client, args)
{
if(GetConVarBool(gravityallow) && IsPlayerAlive(client))
{
PrintToChat(client, "\x04[SM]\x01 You have Just Changed Your Gravity to Lower!");
SetEntityGravity(client, 0.5);
}
else
{
PrintToChat(client, "\x04[SM]\x01 Gravity Commands are Disabled/You are dead and unable to change gravity.");
}
return Plugin_Handled;
}
public Action:Command_Highgravity(client, args)
{
if(GetConVarBool(gravityallow) && IsPlayerAlive(client))
{
PrintToChat(client, "\x04[SM]\x01 You have Just Changed Your Gravity to Higher!");
SetEntityGravity(client, 1.5);
}
else
{
PrintToChat(client, "\x04[SM]\x01 Gravity Commands are Disabled/You are dead and unable to change gravity.");
}
return Plugin_Handled;
}
public Action:Command_Normalgravity(client, args)
{
if(GetConVarBool(gravityallow) && IsPlayerAlive(client))
{
PrintToChat(client, "\x04[SM]\x01 You have Just Changed Your Gravity to Normal!");
SetEntityGravity(client, 1.0);
}
else
{
PrintToChat(client, "\x04[SM]\x01 Gravity Commands are Disabled/You are dead and unable to change gravity.");
}
return Plugin_Handled;
}
public Action:Command_SuperLowgravity(client, args)
{
if(GetConVarBool(gravityallow) && IsPlayerAlive(client))
{
PrintToChat(client, "\x04[SM]\x01 You have Just Changed Your Gravity to \x03SUPERLOWGRAVITYYY!");
SetEntityGravity(client, 0.2);
}
else
{
PrintToChat(client, "\x04[SM]\x01 Gravity Commands are Disabled/You are dead and unable to change gravity.");
}
return Plugin_Handled;
}
public Action:Command_Commands(client, args)
{
new Handle:CommandsMenu = CreateMenu(MenuHandler_CommandsMenu);
SetMenuTitle(CommandsMenu, "Commands:");
AddMenuItem(CommandsMenu, "commands", "!commands / !commds / !bhop - This Menu", ITEMDRAW_DISABLED);
AddMenuItem(CommandsMenu, "gravity", "!gravitycommands / !grav - Gravity Menu");
AddMenuItem(CommandsMenu, "guns", "!guns - Guns/Weapons Menu");
AddMenuItem(CommandsMenu, "revive", "!r / !restart - Respawning Yourself");
AddMenuItem(CommandsMenu, "checkpoints", "!cp / !checkpoints - CheckPoints Menu");
DisplayMenu(CommandsMenu, client, MENU_TIME_FOREVER);
return Plugin_Handled;
}
public MenuHandler_CommandsMenu(Handle:CommandsMenu, MenuAction:action, iClient, iMenuItem)
{
new client = iClient;
if (action == MenuAction_Select)
{
decl String:strSelection[4];
GetMenuItem(CommandsMenu, iMenuItem, strSelection, sizeof(strSelection));
if(strcmp(strSelection, "gravity", false) == 0)
{
FakeClientCommand(client, "sm_grav");
}
else if(strcmp(strSelection, "guns", false) == 0)
{
FakeClientCommand(client, "sm_guns");
}
else if(strcmp(strSelection, "revive", false) == 0)
{
FakeClientCommand(client, "sm_r");
}
else if(strcmp(strSelection, "checkpoints", false) == 0)
{
FakeClientCommand(client, "sm_cp");
}
}
else if (action == MenuAction_End)
{
CloseHandle(CommandsMenu);
}
}
public Action:Command_reviver(client, args)
{
PrintToChat(client, "\x04[SM]\x01 Have Fun!");
CS_RespawnPlayer(client);
return Plugin_Handled;
}
public Action:Command_Guns(client, args)
{
new Handle:WeaponMenu = CreateMenu(MenuHandler_SelectWeapon);
SetMenuTitle(WeaponMenu, "Choose Weapon");
SetMenuExitButton(WeaponMenu, true);
AddMenuItem(WeaponMenu, "scout", "Scout [!scout]");
AddMenuItem(WeaponMenu, "awp", "AWP [!awp]");
AddMenuItem(WeaponMenu, "deagle", "Deagle [!deagle]");
AddMenuItem(WeaponMenu, "usp", "USP [!usp]");
AddMenuItem(WeaponMenu, "knife", "Knife [!knife/!kn]");
DisplayMenu(WeaponMenu, client, MENU_TIME_FOREVER);
return Plugin_Handled;
}
public MenuHandler_SelectWeapon(Handle:WeaponMenu, MenuAction:action, iClient, iMenuItem)
{
new client = iClient;
if (action == MenuAction_Select)
{
decl String:strSelection[4];
GetMenuItem(WeaponMenu, iMenuItem, strSelection, sizeof(strSelection));
if(strcmp(strSelection, "scout", false) == 0)
{
FakeClientCommand(client, "sm_scout");
}
else if(strcmp(strSelection, "awp", false) == 0)
{
FakeClientCommand(client, "sm_awp");
}
else if(strcmp(strSelection, "deagle", false) == 0)
{
FakeClientCommand(client, "sm_deagle");
}
else if(strcmp(strSelection, "usp", false) == 0)
{
FakeClientCommand(client, "sm_usp");
}
else if(strcmp(strSelection, "knife", false) == 0)
{
FakeClientCommand(client, "sm_knife");
}
}
else if (action == MenuAction_End)
{
CloseHandle(WeaponMenu);
}
}
public Action:Command_cp(client, args)
{
if(GetConVarBool(checkpointsallow) && IsPlayerAlive(client))
{
new Handle:CPMenu = CreateMenu(MenuHandler_CPMenu);
SetMenuTitle(CPMenu, "CheckPoints");
SetMenuExitButton(CPMenu, true);
AddMenuItem(CPMenu, "save1", "Save 1 - [!save1]");
AddMenuItem(CPMenu, "tele1", "Teleport 1 - [!tele1]");
AddMenuItem(CPMenu, "empty1", "", ITEMDRAW_SPACER);
AddMenuItem(CPMenu, "empty2", "", ITEMDRAW_SPACER);
AddMenuItem(CPMenu, "save2", "Save 2 - [!save2]");
AddMenuItem(CPMenu, "tele2", "Teleport 2 - [!tele2]");
DisplayMenu(CPMenu, client, MENU_TIME_FOREVER);
}
else
{
PrintToChat(client, "\x04[SM]\x01 CheckPoints Commands are Disabled/You are dead and unable to use checkpoints.");
}
return Plugin_Handled;
}
public MenuHandler_CPMenu(Handle:CPMenu, MenuAction:action, iClient, iMenuItem)
{
new client = iClient;
if (action == MenuAction_Select)
{
decl String:strSelection[4];
GetMenuItem(CPMenu, iMenuItem, strSelection, sizeof(strSelection));
if(strcmp(strSelection, "save", false) == 0)
{
FakeClientCommand(client, "sm_save1");
DisplayMenu(CPMenu, client, MENU_TIME_FOREVER);
}
else if(strcmp(strSelection, "tele", false) == 0)
{
FakeClientCommand(client, "sm_tele1");
DisplayMenu(CPMenu, client, MENU_TIME_FOREVER);
}
else if(strcmp(strSelection, "save2", false) == 0)
{
FakeClientCommand(client, "sm_save2");
DisplayMenu(CPMenu, client, MENU_TIME_FOREVER);
}
else if(strcmp(strSelection, "save2", false) == 0)
{
FakeClientCommand(client, "sm_tele2");
DisplayMenu(CPMenu, client, MENU_TIME_FOREVER);
}
}
}
public Action:Command_gravity(client, args)
{
new Handle:GravityMenu = CreateMenu(MenuHandler_SelectGravity);
SetMenuTitle(GravityMenu, "Choose Gravity");
SetMenuExitButton(GravityMenu, true);
AddMenuItem(GravityMenu, "lowgrav", "Low Gravity [!lg/!lowgrav/!lowgravity]");
AddMenuItem(GravityMenu, "highgrav", "High Gravity [!hg/!highgrav/!highgravity]");
AddMenuItem(GravityMenu, "normalgrav", "Normal Gravity [!ng/!normalgrav/!normalgravity]");
AddMenuItem(GravityMenu, "superlowgrav", "Super Low Gravity [!slg/!superlowgrav/!superlowgravity]");
DisplayMenu(GravityMenu, client, MENU_TIME_FOREVER);
return Plugin_Handled;
}
public MenuHandler_SelectGravity(Handle:GravityMenu, MenuAction:action, iClient, iMenuItem)
{
new client = iClient;
if (action == MenuAction_Select)
{
decl String:strSelection[4];
GetMenuItem(GravityMenu, iMenuItem, strSelection, sizeof(strSelection));
if(strcmp(strSelection, "lowgrav", false) == 0)
{
FakeClientCommand(client, "sm_lg");
}
else if(strcmp(strSelection, "highgrav", false) == 0)
{
FakeClientCommand(client, "sm_hg");
}
else if(strcmp(strSelection, "normalgrav", false) == 0)
{
FakeClientCommand(client, "sm_ng");
}
else if(strcmp(strSelection, "superlowgrav", false) == 0)
{
FakeClientCommand(client, "sm_slg");
}
}
else if (action == MenuAction_End)
{
CloseHandle(GravityMenu);
}
}
public Action:Command_knife(client,args)
{
if(GetConVarBool(weaponsallow) && IsPlayerAlive(client))
{
if(allow[client]==true)
{
GivePlayerItem(client, "weapon_knife");
allow[client]=false;
CreateTimer(30.0, Action_weaponspawner, client, TIMER_FLAG_NO_MAPCHANGE);
}
else
{
PrintToChat(client, "\x04[SM]\x01 You must wait 30 seconds between Spawning Weapons, Abuse will get you banned.");
}
}
else
{
PrintToChat(client, "\x04[SM]\x01 Weapons commands are Disabled/You are dead and unable to use Them.");
}
return Plugin_Handled;
}
public Action:Command_usp(client,args)
{
if(GetConVarBool(weaponsallow) && IsPlayerAlive(client))
{
if(allow[client]==true)
{
GivePlayerItem(client, "weapon_usp");
allow[client]=false;
CreateTimer(30.0, Action_weaponspawner, client, TIMER_FLAG_NO_MAPCHANGE);
}
else
{
PrintToChat(client, "\x04[SM]\x01 You must wait 30 seconds between Spawning Weapons, Abuse will get you banned.");
}
}
else
{
PrintToChat(client, "\x04[SM]\x01 Weapons commands are Disabled/You are dead and unable to use Them.");
}
return Plugin_Handled;
}
public Action:Command_deagle(client,args)
{
if(GetConVarBool(weaponsallow) && IsPlayerAlive(client))
{
if(allow[client]==true)
{
GivePlayerItem(client, "weapon_deagle");
allow[client]=false;
CreateTimer(30.0, Action_weaponspawner, client, TIMER_FLAG_NO_MAPCHANGE);
}
else
{
PrintToChat(client, "\x04[SM]\x01 You must wait 30 seconds between Spawning Weapons, Abuse will get you banned.");
}
}
else
{
PrintToChat(client, "\x04[SM]\x01 Weapons commands are Disabled/You are dead and unable to use Them.");
}
return Plugin_Handled;
}
public Action:Command_awp(client,args)
{
if(GetConVarBool(weaponsallow) && IsPlayerAlive(client))
{
if(allow[client]==true)
{
GivePlayerItem(client, "weapon_awp");
allow[client]=false;
CreateTimer(30.0, Action_weaponspawner, client, TIMER_FLAG_NO_MAPCHANGE);
}
else
{
PrintToChat(client, "\x04[SM]\x01 You must wait 30 seconds between Spawning Weapons, Abuse will get you banned.");
}
}
else
{
PrintToChat(client, "\x04[SM]\x01 Weapons commands are Disabled/You are dead and unable to use Them.");
}
return Plugin_Handled;
}
public Action:Command_scout(client,args)
{
if(GetConVarBool(weaponsallow) && IsPlayerAlive(client))
{
if(allow[client]==true)
{
GivePlayerItem(client, "weapon_scout");
allow[client]=false;
CreateTimer(30.0, Action_weaponspawner, client, TIMER_FLAG_NO_MAPCHANGE);
}
else
{
PrintToChat(client, "\x04[SM]\x01 You must wait 30 seconds between Spawning Weapons, Abuse will get you banned.");
}
}
else
{
PrintToChat(client, "\x04[SM]\x01 Weapons commands are Disabled/You are dead and unable to use Them.");
}
return Plugin_Handled;
}
public Action:Action_weaponspawner(Handle:timer, any:client)
{
allow[client] = true;
}
public Action:Command_save1(client, args)
{
if(GetConVarBool(checkpointsallow) && IsPlayerAlive(client))
{
GetEntPropVector(client, Prop_Send, "m_vecOrigin", checkpoint[client]);
tele_saved[client] = true;
PrintToChat(client, "\x04[SM]\x01 CheckPoint [1] Saved.");
}
else
{
PrintToChat(client, "\x04[SM]\x01 CheckPoints are disabled, or you are dead and have to be alive.");
}
return Plugin_Handled;
}
public Action:Command_tele1(client, args)
{
if(tele_saved[client] && GetConVarBool(checkpointsallow) && IsPlayerAlive(client))
{
TeleportEntity(client, checkpoint[client], NULL_VECTOR, NULL_VECTOR);
PrintToChat(client, "\x04[SM]\x01 Teleported to Checkpoint [1].");
}
else
{
PrintToChat(client, "\x04[SM]\x01 You Have to Place a Checkpoint [1] First, Type !s1/!save1 for that, or you are dead and have to be alive.");
}
return Plugin_Handled;
}
public Action:Command_save2(client, args)
{
if(GetConVarBool(checkpointsallow) && IsPlayerAlive(client))
{
GetEntPropVector(client, Prop_Send, "m_vecOrigin", checkpoint2[client]);
tele_saved2[client] = true;
PrintToChat(client, "\x04[SM]\x01 CheckPoint [2] Saved.");
}
else
{
PrintToChat(client, "\x04[SM]\x01 CheckPoints are disabled, or you are dead and have to be alive.");
}
return Plugin_Handled;
}
public Action:Command_tele2(client, args)
{
if(tele_saved2[client] && GetConVarBool(checkpointsallow) && IsPlayerAlive(client))
{
TeleportEntity(client, checkpoint2[client], NULL_VECTOR, NULL_VECTOR);
PrintToChat(client, "\x04[SM]\x01 Teleported to Checkpoint [2].");
}
else
{
PrintToChat(client, "\x04[SM]\x01 You Have to Place a Checkpoint [2] First, Type !s2/!save2 for that, or you are dead and have to be alive.");
}
return Plugin_Handled;
}
__________________
retired
|
|