Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding

Thread Tools Display Modes
Old 07-03-2012, 04:10 PM   #1
Join Date: Nov 2011
Reputation: 0
Posts: 11
Console Commands via Weapon

I've spent the last hour Googling this, but can't find anything anywhere.
How would I go about telling a weapon to execute a console command instead of firing a bullet? Specifically, I want to create a camera, like Garry's Mod has, that will take a screenshot when you click.
Does this need to be edited in the weapon's .cpp, or the script? Or will I need to create a whole new weapon type?
Codexofwisdom is offline  
Reply With Quote
Old 07-03-2012, 06:00 PM   #2
Join Date: Jun 2008
Reputation: 13
Posts: 132
It should be pretty easy. In a weapon's PrimaryAttack function (in the cpp file) simply remove everything weapon related and instead put:

CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
if ( pPlayer )
engine->ClientCommand( pPlayer->edict(), "WhateverTheScreenshotCmdIs\n" );

Last edited by Alters: 07-03-2012 at 08:31 PM.
Alters is offline   Reply With Quote

Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding

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

All times are GMT -7. The time now is 01:22 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2015, All Rights Reserved.