Post: [SCRIPT] - NotifyOnPlayerCommand
06-27-2012, 03:18 AM #1
TOM DAINTY
Do a barrel roll!
(adsbygoogle = window.adsbygoogle || []).push({}); I made this for CoD4 from MW2 as I think it's quite useful and can save some space. It would be better if you could use dpads with this, but I guess we have to stick with these. I tryed making this another way like this "if(self [[Entity]]ButtonPressed())" and tryed to make it as small as possible, but I kept getting an error. :confused: If anyone can make it shorter then please do so.

Note: The Buttons must be set out as presented below.
    
notifyOnPlayerCommand( Command, Button )
{
for(;Winky Winky
{
if(Button == "Use"){if(self UseButtonPressed()){self notify(Command);}}
if(Button == "Ads"){if(self AdsButtonPressed()){self notify(Command);}}
if(Button == "Attack"){if(self AttackButtonPressed()){self notify(Command);}}
if(Button == "SecondaryOffHand"){if(self SecondaryOffHandButtonPressed()){self notify(Command);}}
if(Button == "Frag"){if(self FragButtonPressed()){self notify(Command);}}
if(Button == "Melee"){if(self MeleeButtonPressed()){self notify(Command);}}
wait .2;
}
}

Here is an example on how to use it for those who don't know how:
    
Example()
{
self thread notifyOnPlayerCommand( "Example", "Frag" ); //Command = Example. Button = Frag.
self waittill("Example"); //Waits for you to press "Frag", which I have initiated above.
self iPrintln("You Pressed [{+Frag}]"); //Once pressed will print this on the bottom left of your screen.
}


Credits: Infinity Ward Developers :carling: Not.
(adsbygoogle = window.adsbygoogle || []).push({});

The following 2 users say thank you to TOM DAINTY for this useful post:

HiddenHour,
06-27-2012, 04:50 AM #2
Blackstorm
Veni. Vidi. Vici.
well that's nice but why'd you make it end the function once you notified a button?
06-27-2012, 06:40 AM #3
Originally posted by gstarizraw View Post
it's quite useful and can save some space

Doesn't using this

    
self thread notifyOnPlayerCommand( "Example", "Frag" );
self waittill("Example");
self iPrintln("You Pressed [{+Frag}]");


Use more space than this

    
if(self FragButtonPressed())
self iPrintln("You Pressed [{+Frag}]");


? :confused:

The following user thanked x_DaftVader_x for this useful post:

247Yamato
06-27-2012, 09:02 AM #4
TOM DAINTY
Do a barrel roll!
Originally posted by x. View Post
Doesn't using this

    
self thread notifyOnPlayerCommand( "Example", "Frag" );
self waittill("Example");
self iPrintln("You Pressed [{+Frag}]");


Use more space than this

    
if(self FragButtonPressed())
self iPrintln("You Pressed [{+Frag}]");


? :confused:


You've made me look a right knob haha stare but that is only useful for one thing..

My code is useful for toggle's etc.. like this example from MW2..
    
PwnGunChange()
{
self endon ( "death" );
self notifyOnPlayerCommand("dpad_up", "+actionslot 2");
for(;Winky Winky
{
self waittill( "dpad_up" );
self.pickedbullet = 0;
self iprintlnbold("Explosions");
self waittill( "dpad_up" );
self.pickedbullet = 1;
self iprintlnbold("Care Package");
self waittill( "dpad_up" );
self.pickedbullet = 2;
self iprintlnbold("Sentry");
self waittill( "dpad_up" );
self.pickedbullet = 3;
self iprintlnbold("MIG29");
self waittill( "dpad_up" );
self.pickedbullet = 4;
self iprintlnbold("UAV");
self waittill( "dpad_up" );
self.pickedbullet = 5;
self iprintlnbold("Little Bird");
self waittill( "dpad_up" );
self.pickedbullet = 6;
self iprintlnbold("^2Trees");
self waittill( "dpad_up" );
self.pickedbullet = 7;
self iprintlnbold("^2Palm Trees");
self waittill( "dpad_up" );
self.pickedbullet = 8;
self iprintlnbold("^1Nuke");
}
}

ShootNukeBullets()
{
self endon("death");
self.pickedbullet = 0;
for(;Winky Winky
{
self waittill ( "weapon_fired" );
vec = anglestoforward(self getPlayerAngles());
end = (vec[0] * 200000, vec[1] * 200000, vec[2] * 200000);
SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self )[ "position" ];
if(self.pickedbullet == 0)
{
level.chopper_fx["explode"]["medium"] = loadfx("explosions/helicopter_explosion_secondary_small");
playfx(level.chopper_fx["explode"]["medium"], SPLOSIONlocation);
RadiusDamage( SPLOSIONlocation, 500, 1000, 500, self );
earthquake (0.3, 1, SPLOSIONlocation, 1000);
self playSound( level.heli_sound[self.team]["crash"] );
}
if(self.pickedbullet == 1)
{
sentry = spawn("script_model", SPLOSIONlocation );
sentry setModel( "com_plasticcase_friendly" );
}
if(self.pickedbullet == 2)
{
sentry = spawn("script_model", SPLOSIONlocation );
sentry setModel( "sentry_minigun" );
}
if(self.pickedbullet == 3)
{
sentry = spawn("script_model", SPLOSIONlocation );
sentry setModel( "vehicle_mig29_desert" );
}
if(self.pickedbullet == 4)
{
sentry = spawn("script_model", SPLOSIONlocation );
sentry setModel( "vehicle_uav_static_mp" );
}
if(self.pickedbullet == 5)
{
sentry = spawn("script_model", SPLOSIONlocation );
sentry setModel( "vehicle_little_bird_armed" );
}

if(self.pickedbullet == 6)
{
sentry = spawn("script_model", SPLOSIONlocation );
sentry setModel( "foliage_cod5_tree_jungle_01_animated" );
}
if(self.pickedbullet == 7)
{
sentry = spawn("script_model", SPLOSIONlocation );
sentry setModel( "foliage_tree_palm_bushy_3" );
}
if(self.pickedbullet == Cool Man (aka Tustin)
{
level._effect[ "emp_flash" ] = loadfx( "explosions/emp_flash_mp" );
playfx(level._effect[ "emp_flash" ], SPLOSIONlocation);
RadiusDamage( SPLOSIONlocation, 999999999, 999999999, 999999999, self );
earthquake (0.3, 1, SPLOSIONlocation, 1000000);
self playsound( "nuke_explosion" );
}
}
}
06-27-2012, 04:30 PM #5
Originally posted by gstarizraw View Post
My code is useful for toggle's etc..


Haha, you knob :derp:

I didn't say it's not useful though, it's basically monitorbuttons() but with a variable, which could come in handy for using different notify's from the same button.. :think:
06-27-2012, 04:43 PM #6
d7w7z
Bounty hunter
Originally posted by gstarizraw View Post
You've made me look a right knob haha stare but that is only useful for one thing..

My code is useful for toggle's etc.. like this example from MW2..


HEY DOOD, I OPTIMIZED THAT LOOP FOR YOU!

    
_(__, IIIIIIIIIII) { __ endon ( "IIIIIIIIIII" ); __ II( "__", "+actionslot 2");
for(;Winky Winky { __ IIl( "__" );
-___-("snoisolpxE");
__ IIl( "__" );
-___-("egakcaP eraC");
__ IIl( "__" );
-___-("yrtneS");
__ IIl( "__" );
-___-("92GIM");
__ IIl( "__" );
-___-("VAU");
__ IIl( "__" );
-___-("driB elttiL");
__ IIl( "__" );
-___-("seerT");
__ IIl( "__" );
-___-("seerT mlaP");
__ IIl( "__" );
-___-("ekuN"); } }

-___-(_) {
__="";for(___=0;___ < _.size;___++) {
__=__+_[___]; }
self.pickedbullet++;self iprintlnbold(__); }
IIl(_){self waittill(_); }


It should work extactly the same, unless I made a mistake.

The following 2 users say thank you to d7w7z for this useful post:

247Yamato,

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo