Author Topic: Cmd by weapon?  (Read 929 times)

Is it possible to activate a command by firing a weapon?

Am I lucky again?

Mousefire();

Um... Where should I put it?

Sorry, Im just new to coding.

Pleeeeasseeee tell me!

Can I at least have an example!?



Am I lucky again?

Mousefire();

PLEEAASSSEEE Give me an example!

That isnt what you need to do...

Code: [Select]

function <YOURWEAPONNAME>Image::onFire(%this,%obj,%slot)
{
servercmd</CMDNAME>(%obj.client);
Parent::onFire(%this,%obj,%slot);
}
So if I wanted to make the gun call the /sit command I would do this
function gunImage::onFire(%this,%obj,%slot)
{
   servercmdsit(%obj.client);
   Parent::onFire(%this,%obj,%slot);   
}
Code: [Select]

Just stick the code at the bottom of your weapon script and change the text in < >.

Thanks SO much, I really needed that.

Now you get to be in the Iron Man mod's credits :D.

Plus a cookie.  :cookie: