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

Need help with menu.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CPUsave
Junior Member
Join Date: Dec 2012
Location: Sweden
Old 03-06-2013 , 18:31   Need help with menu.
Reply With Quote #1

Hello there. Working on a menu.

I need to know how to make the plugin send a console command, like sm_something
Whats the code for sending command. Im new at sourcemod. But i will at least give it a try.

Example if i press "Hello" on the menu the menu will send the command sm_trails
CPUsave is offline
ajr1234
Senior Member
Join Date: Mar 2011
Location: Chicago, IL, U.S.A.
Old 03-06-2013 , 18:55   Re: Need help with menu.
Reply With Quote #2

There is a tutorial here:
http://wiki.alliedmods.net/Menu_API_(SourceMod)

Also see:
http://docs.sourcemod.net/api/index....d=show&id=459&

Last edited by ajr1234; 03-06-2013 at 18:56. Reason: fixed link
ajr1234 is offline
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 03-08-2013 , 15:57   Re: Need help with menu.
Reply With Quote #3

Welcome to Sourcemod

What you searching for is:
Quote:
FakeClientCommand(client, "sm_trails"); // This forces a client to write "sm_trails" in his console
One solution:
PHP Code:
public Action:ShowMenuclient ){
 
 new 
Handle:menu CreateMenuYourMenuHandler );
 
 
SetMenuTitlemenu"Menu Title" );
 
 
AddMenuItemmenu"hello1""Hello1");
 
AddMenuItemmenu"hello2""Hello2" );
 
AddMenuItemmenu"hello3""Hello3" );
 
 
SetMenuExitButtonmenutrue );
 
DisplayMenumenuclientMENU_TIME_FOREVER );
}
 
public 
YourMenuHandlerHandle:menuMenuAction:actionparam1param2 ){
 if ( 
action == MenuAction_Select ){
  
decl String:info[64];
  
GetMenuItemmenuparam2infosizeofinfo  ));
 
  if( 
StrEqualinfo"hello1"  )){
   
FakeClientCommand(param1"sm_trails"); //param1 is the client who choosed the menu item
  
}
  else if( 
StrEqualinfo"hello2"  )){
   
FakeClientCommand(param1"sm_trails"); //param1 is the client who choosed the menu item
  
}
  else if( 
StrEqualinfo"hello3"  )){
   
FakeClientCommand(param1"sm_trails"); //param1 is the client who choosed the menu item
  
}
 }
 else if ( 
action == MenuAction_End ){
  
CloseHandlemenu );
 }


Last edited by TheWho; 03-08-2013 at 16:04.
TheWho is offline
Reply



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 14:23.


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