|
|
#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? |
|
|
|
|
|
#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:
Code:
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
if ( pPlayer )
{
engine->ClientCommand( pPlayer->edict(), "WhateverTheScreenshotCmdIs\n" );
}
Last edited by Alters: 07-03-2012 at 08:31 PM. |
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|