Raised This Month: $ Target: $400
 0% 

i need to add admin command HELP!!!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
31m0_owns
Member
Join Date: May 2008
Location: SLH, New Jersey-- U.S.A
Old 03-13-2009 , 07:14   i need to add admin command HELP!!!
Reply With Quote #1

My friend and I were working on this plugin. We didn't want people getting lowergrav by typing out the menu command. We also want to make it so admins can give gravity to a certain player through command... Here is the code
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"
 
public plugin_init() 
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_concmd("say /gravmenu""GravMenu")
 
register_clcmd("amx_gravmenu""Bring grav menu up"ADMIN_IMMUNITY"Brings up the grav menu to admins")
}
public 
GravMenu(id)
{
 new 
menu menu_create("\rGravityMenu""menu_handler")
 
menu_additem(menu"\w400 Gravity""1"ADMIN_IMMUNITY)
 
menu_additem(menu"\w500 Gravity""2"ADMIN_IMMUNITY)
 
menu_additem(menu"\w600 Gravity""3"ADMIN_IMMUNITY)
 
menu_additem(menu"\w700 Gravity""4"ADMIN_IMMUNITY)
 
menu_additem(menu"\w800 Gravity""5"ADMIN_IMMUNITY)
 
menu_additem(menu"\wExit""6"6)
 
 
menu_setprop(menuMPROP_EXITMEXIT_ALL)
 
menu_display(idmenu0)
 
}
public 
menu_handler(idmenuitem)
{
 if (
item ==MENU_EXIT)
 {
  
menu_destroy(menu)
  return 
PLUGIN_HANDLED
 
}
 new 
data[6], iName [64]
 new 
accesscallback
 menu_item_getinfo
(menuitemaccessdata,5iName63callback)
 new 
key str_to_num(data)
 switch(
key)
 {
  case 
1:{
   
set_user_gravity(id0.50)
   
client_print(idprint_chat"You Have Switched to 400 Gravity")
  }
  case 
2:{
   
set_user_gravity(id0.625)
   
client_print(idprint_chat"You Have Switched to 500 Gravity")
  }
  case 
3:{
   
set_user_gravity(id0.75)
   
client_print(idprint_chat"You Have Switched to 600 Gravity")
  }
  case 
4:{
   
set_user_gravity(id0.875)
   
client_print(idprint_chat"You Have Switched to 700 Gravity")
  }
  case 
5:{
   
set_user_gravity(id1.00)
   
client_print(idprint_chat"You Have Switched to 800 Gravity")
  }
  case 
6:{
   
menu_destroy(menu)
   return 
PLUGIN_CONTINUE
  
}
 }
 
 
menu_destroy(menu)
 return 
PLUGIN_CONTINUE

__________________
Project(s):
Prop-Hunt: 5%
Killcam: NEVER GOING TO HAPPEN!!!
31m0_owns is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 03-13-2009 , 07:31   Re: i need to add admin command HELP!!!
Reply With Quote #2

http://wiki.amxmodx.org/Intro_to_AMX_Mod_X_Scripting
__________________

anakin_cstrike is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-13-2009 , 08:52   Re: i need to add admin command HELP!!!
Reply With Quote #3

I was bored so I edited your code to give you what you want. I changed how the menu is set up so that it would be easier to incorporate an admin command.

Also, any command that will lead to a menu you should use register_clcmd().

Attached is what I got, use it if you like it .
__________________

Last edited by fysiks; 04-19-2009 at 21:14.
fysiks 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 08:54.


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