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

[EXTENSION][Any?] PointDetour


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 05-03-2012 , 01:11   [EXTENSION][Any?] PointDetour
Reply With Quote #1

This would not have been possible at all without Dr!fter (Or Dr. !fter, as I'm sure no one calls him).

What is this?

This is a simple detour of PointServerCommand::InsertCommand, which allows you to block, modify or listen to point_servercommand entities firing (and get the command they're running).

Why would you write this?
Well, I've been wanting to do this for a while for VIPMod (L. Duke used convars instead of the actual brush entities ). But recently it was made clear to my community by a mapper that they're ultimately in control. How? Through the use of this one horrible entity called point_servercommand. With this, they can change your server rcon password, set a server password, change the map, change timeleft, do whatever they want. The same can be done with clients using point_clientcommand, and that's coming to this extension Soon™. Voogru warned people in the past about randomly running maps (or so I vaguely recall), but it still happens often so that's why this is here.

What does this do?
See What is this?. But if you're an end user, this allows for plugin developers to hook the firing of point_servercommand.

THIS CRASHES MY WINDOWS SERVER.
Welp, Sorry. Since Valve doesn't release Symbols for Windows, I can't ever support it. With this being said, thanks to Dr!fter, there's a untested Windows Build, and gamedata to go with it. If it works, great! I can't ever support this, though.

THIS CRASHES MY LINUX SERVER
Oh no! Tragic! Please post a stack trace in the thread.

Special Thanks to:
Drifter
- Holding my hand through a lot of this.
Psychonic - Suggesting a Hack, then providing a less hacky way

Asherkin - I learned a lot from ZombieFix, which appears to be based off of SDKHooks.
Sammy-ROCK! - Learned about Forwards from CSS Speed Mod.
Attached Files
File Type: txt PSCDetour.txt (447 Bytes, 503 views)
File Type: gz iscdetour1.0.1.tar.gz (64.5 KB, 579 views)
File Type: so PointDetour.ext.so (22.4 KB, 397 views)
File Type: dll PointDetour.ext.dll (70.0 KB, 420 views)
File Type: inc pscd.inc (2.2 KB, 433 views)

Last edited by KyleS; 05-03-2012 at 21:21. Reason: New build.
KyleS is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 05-03-2012 , 01:17   Re: [EXTENSION][Any?] PointDetour
Reply With Quote #2

Example:

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <pscd>

public Action:PointServerCommandForward(const String:sCommand[])
{
    
PrintToServer("DetourCalled!!!!!");
    
PrintToServer("Command Trying to be Called: %s"sCommand);
    return 
Plugin_Continue;

Quote:
Originally Posted by Server
DetourCalled!!!!!
Command Trying to be Called: vip_escapezone2 2080 50 -115 2400 280 -17
DetourCalled!!!!!
Command Trying to be Called: vip_escapezone 2100 -825 32 2515 -378 308
Unknown command "vip_escapezone2"
Unknown command "vip_escapezone"

Last edited by KyleS; 05-03-2012 at 20:56.
KyleS is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 05-03-2012 , 02:11   Re: [EXTENSION][Any?] PointDetour
Reply With Quote #3

Nice job! I always thought these entities needed some kind of whitelist for their commands. This will do nicely.

Quote:
Originally Posted by KyleS View Post
The same can be done with clients using point_clientcommand, and that's coming to this extension Soon™.
Am I mistaken or is this already functional in the ext/gamedata but missing from the include file?
__________________

Last edited by GoD-Tony; 05-03-2012 at 03:04.
GoD-Tony is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 05-03-2012 , 09:51   Re: [EXTENSION][Any?] PointDetour
Reply With Quote #4

Quote:
Originally Posted by GoD-Tony View Post
Am I mistaken or is this already functional in the ext/gamedata but missing from the include file?
I haven't tested it
KyleS is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-03-2012 , 05:04   Re: [EXTENSION][Any?] PointDetour
Reply With Quote #5

Quote:
Originally Posted by KyleS View Post
I want to execute my own commands using this!
Ok there hot shot. I should warn you that if you write over the max length, you're treading into unknown waters. Besides that though, I've yet to crash using this (Writing within the boundaries), so by all means go right ahead!
You should probably just const-qualify that param and not invoke the copyback stuff.
It's slow, and the ServerCommand native exists for that purpose.
__________________
asherkin is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 05-03-2012 , 12:59   Re: [EXTENSION][Any?] PointDetour
Reply With Quote #6

Quote:
Originally Posted by asherkin View Post
You should probably just const-qualify that param and not invoke the copyback stuff.
It's slow, and the ServerCommand native exists for that purpose.
There's no detour for ServerCommand Alright though, I'll kill it.

The include is going to change!

Plugin_Stop = Don't fire.
Plugin_Handled = Null the String, the output will still fire.
Plugin_Changed <= Continue.

Quote:
Originally Posted by Dr!fter View Post
I tested windows it works fine . Only problem you should add the block to the include that forces the extension to load I had to create an autoload file or else it wouldnt load (You can look for this in dhooks include or sdkhooks include). But after it loaded it worked, and nice job!
Awesome! and Oops! Will fix when I get home.
KyleS is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 05-03-2012 , 13:13   Re: [EXTENSION][Any?] PointDetour
Reply With Quote #7

Quote:
Originally Posted by KyleS View Post
There's no detour for ServerCommand Alright though, I'll kill it.

The include is going to change!

Plugin_Stop = Don't fire.
Plugin_Handled = Null the String, the output will still fire.
Plugin_Changed <= Continue.


Awesome! and Oops! Will fix when I get home.
It makes sense to remove the copyback since if you really needed to change it you could just use (I didnt think of this heh) ServerCommand native and block it the function from calling.

I would just make Continue fire else block. Since Nulling it wont make any difference since it would just pass an empty string to ServerCommand
Dr!fter is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 05-03-2012 , 13:39   Re: [EXTENSION][Any?] PointDetour
Reply With Quote #8

Quote:
Originally Posted by Dr!fter View Post
It makes sense to remove the copyback since if you really needed to change it you could just use (I didnt think of this heh) ServerCommand native and block it the function from calling.

I would just make Continue fire else block. Since Nulling it wont make any difference since it would just pass an empty string to ServerCommand
That does indeed make more sense I don't know what I was thinking before

const it is!

Last edited by KyleS; 05-03-2012 at 13:42.
KyleS is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 05-03-2012 , 12:16   Re: [EXTENSION][Any?] PointDetour
Reply With Quote #9

I tested windows it works fine . Only problem you should add the block to the include that forces the extension to load I had to create an autoload file or else it wouldnt load (You can look for this in dhooks include or sdkhooks include). But after it loaded it worked, and nice job!

Also, ventrilo used to call me "Doctor Fter" Until i added a phonetic

Edit: as for the "ANY?" Im almost 100% positive that any orangebox-valve game yes. After that its very likely the others work too, but not as sure . I doubt that function changes much if at all between games.

Last edited by Dr!fter; 05-03-2012 at 14:14. Reason: -s
Dr!fter is offline
Blowst
Senior Member
Join Date: Feb 2011
Location: Korea, Republic of
Old 05-03-2012 , 12:20   Re: [EXTENSION][Any?] PointDetour
Reply With Quote #10

I appreciate your job.

Thx!
__________________
Sorry about my poor English

Blowst 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 01:21.


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