Raised This Month: $ Target: $400
 0% 

Detect if command issued by console.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
-M-Jon
Member
Join Date: Dec 2009
Old 07-14-2011 , 07:38   Detect if command issued by console.
Reply With Quote #1

As the title states, is there a way to detect if the command has been issued by console?

For example:

if(g_Console)
{
function
}
else
{
function
}

Thanks!
-M-Jon is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 07-14-2011 , 08:03   Re: Detect if command issued by console.
Reply With Quote #2

Have you tried checking if the client index is <= 0?
__________________
databomb is offline
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 07-14-2011 , 08:11   Re: Detect if command issued by console.
Reply With Quote #3

you could use
PHP Code:
if (client == 0)
   
ReplyToCommand(client"This command can't be called from console"); 
__________________
napalm00 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 07-14-2011 , 09:43   Re: Detect if command issued by console.
Reply With Quote #4

By console, do you mean the server console, or a client running the command in the console (as opposed to chat)?
__________________
asherkin is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 07-14-2011 , 14:58   Re: Detect if command issued by console.
Reply With Quote #5

Quote:
Originally Posted by napalm00 View Post
you could use
PHP Code:
if (client == 0)
   
ReplyToCommand(client"This command can't be called from console"); 
Remember to return Plugin_Handled; to stop the callback from executing further!
__________________
Peace-Maker 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 13:39.


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