make a trigger_shoot and then link it to a script that checks what the player is holding. if its the gun, continue with the script, if its not, do nothing. This should work in theory
Shooot( PassWeap ) { for(;;) { self waittil( "trigger" ); Weap = self GetCurrentWeapon(); if( Weap == PassWeap ) break; else continue; } // What you want done here }
There is a typo on the waittill("trigger") and it would be GetWeaponsListPrimaries, and I'm not sure if you can GetWeaponListPrimaries from the trigger. I like that you thought to getentarray instead of just getting one. May I suggest the following modifications:
Code Snippet
Plaintext
//thread shootme(); shootme(){ triggers = GetEntArray( "ENT", "targetname" ); for( i = 0; i < triggers.size; i++ ){ triggers[i] thread shotit("zombie_colt"); } } shotit(weapon){ currentgun = ""; while(!(currentgun==weapon)){ self waittill("trigger", player); currentgun = player GetCurrentWeapon(); } //Do what you want here }
There is a typo on the waittill("trigger") and it would be GetWeaponsListPrimaries, and I'm not sure if you can GetWeaponListPrimaries from the trigger. I like that you thought to getentarray instead of just getting one. May I suggest the following modifications:
Code Snippet
Plaintext
//thread shootme(); shootme(){ triggers = GetEntArray( "ENT", "targetname" ); for( i = 0; i < triggers.size; i++ ){ triggers[i] thread shotit("zombie_colt"); } } shotit(weapon){ currentgun = ""; while(!(currentgun==weapon)){ self waittill("trigger", player); currentgun = player GetCurrentWeapon(); } //Do what you want here }
Yah all the mistakes were made because I was a bit tired making this, like I said to deadra, so I wouldn't be hurt if there were mistakes.