barret only in prone

Posts 1–15 of 16 · Page 1 of 2
barret only in prone
hello,

I am making a code that disable's usage of the barret in stand and crouch position.

Code:
barretalleenliggend()
{
self endon("disconnect");
 self endon("death");
  for(;;)
   {
    currentweapon = self getCurrentWeapon();
    if(currentweapon == "barrett_mp" && self getstance() != "prone")
      {
	  self _disableWeapon();
	  }
 else
      {
	  self _enableWeapon();
      }
	  wait 0.4;
 }
  wait 0.4;
}
Only thing is it just keeps enable and disable the weapon not 1 time.

i already tried with remove the ammo but resetting the ammo again is hard for me.
Code:
testBarrett()
{
	self endon("death");
	self endon("disconnect");
	
	weapon = self getCurrentWeapon();
	weaponDisabled = false;
	
	for(;;) {
		if(isSubStr(weapon, "barrett") && !weaponDisabled) {
			self allowADS(false);
			self allowJump(false);
			self allowSprint(false);
			self disableUsability();
			
			weaponDisabled = true;
			self thread monitorBarrett();
		}
		else if(!isSubStr(weapon, "barrett") && weaponDisabled) {
			self allowADS(true);
			self allowJump(true);
			self allowSprint(true);
			self enableUsability();
			
			weaponDisabled = false;
		}
		
		self waittill("weapon_change", weapon);
	}
}

monitorBarrett()
{
	self endon("death");
	self endon("disconnect");
	self endon("weapon_change");
	
	for(;;) {
		self waittill("stance_changed", st);
		if(st != "prone") {
			self allowADS(false);
		}
		else {
			self allowADS(true);
		}
	}
}

monitorStances()
{
	self endon("death");
	self endon("disconnect");
	
	stance = self getStance();
	
	for(;;) {
		while(self getStance() == stance) wait(0.05);
		
		stance = self getStance();
		self notify("stance_changed", stance);
	}
}
monitorStances() and testBarrett() should run after "spawned_player" notify. Like there:
Code:
actSpawn()
{
	self endon("disconnect");
	
	for(;;) {
		self waittill("spawned_player");
		self thread testBarrett();
	}
}
Tell me if this will work.
Thanks for the reply

It works but thanks for that but the problem is that you only can't aim when you stand i am trying to disable shooting when you stand and crouch. So basicly no shooting when in stand, crouch and shooting enabled when you are prone.
Thats easy to fix just set the ammo clip to 0 or change the iDamage to 0
I am sorry, but I am a bit stupid
What you mean?

You want like:

Stand = No Aming.
Crouch = No Shoothing?

What you mean?

If you tell me clear what you want, I can help. But Since I am so stupid... Well, I can't
Quote Originally Posted by Jorndel View Post
I am sorry, but I am a bit stupid
What you mean?

You want like:

Stand = No Aming.
Crouch = No Shoothing?

What you mean?

If you tell me clear what you want, I can help. But Since I am so stupid... Well, I can't
I mean like:

stand = aiming but no shooting.
crouch = aiming but no shooting.
prone = aiming and shooting.
Quote Originally Posted by codGmer View Post
I mean like:

stand = aiming but no shooting.
crouch = aiming but no shooting.
prone = aiming and shooting.
See how easy it was to type so little and it gave so much more sence....

Well, what you want is:
Code:
WepCode()
{
for(;;)
{
if ( self GetStance() == "stand" )
{
self notify("stance");
cw = self getCurrentWeapon();
self setWeaponAmmoStock(cw, 0);
self setWeaponAmmoClip(cw, 0);
}
else
{
if ( self GetStance() == "crouch" )
{     
self notify("stance");
cw = self getCurrentWeapon();
self setWeaponAmmoStock(cw, 0);
self setWeaponAmmoClip(cw, 0);
}
else
{
if ( self GetStance() == "prone" )
{     
cw = self getCurrentWeapon();
self setWeaponAmmoStock(cw, ammocount);
self setWeaponAmmoClip(cw, ammocount2);
}
self waittill("stance");
ammocount = self getWeaponAmmoClip();
ammocount2 =  self getWeaponAmmoStock();
}
wait 0.7;
}
}
Well, I can't say that it will work.
But maybe you see what I mean here....
So basically u want if you prone u can shoot?
Quote Originally Posted by mathieutje12 View Post
So basically u want if you prone u can shoot?
yes and if you stand, crouch you can't shoot.
I made this code based on your code

Code:
barretalleenliggend()
{
self endon("disconnect");
 self endon("death");
 currentweapon = self getCurrentWeapon();
  while(currentweapon == isSubStr(currentweapon, "barrett"))
   {
	  if(self getstance() == "prone")
	  {
self setWeaponAmmoStock(currentweapon, 20);
	  }
 else
      {
	  self setWeaponAmmoStock(currentweapon, 0);
self setWeaponAmmoClip(currentweapon, 0);
      }
	  wait 0.4;
 }
}
The only problem now is that is gives the weapon unlimited ammo when you are prone. How to get the stock ammo? This code didnt work

Code:
ammocount = self getWeaponAmmoClip();
ammocount2 =  self getWeaponAmmoStock();

self setWeaponAmmoStock(cw, ammocount);
self setWeaponAmmoClip(cw, ammocount2);
I dunno the code of disable shooting, but you could try in _damage.gsc and search for
Code:
Callback_PlayerDamage_internal( eInflictor, eAttacker, victim, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime )
there is two, but you could try the first

and add

Code:
if(isSubStr(sWeapon, "barrett") && self getstance() != "prone") 
{ 
 iDamage = 0; 
}
this doesn't disable shooting(and don't ask what the code for it cuz i dunno), but it's make bullet hits with no damage
Quote Originally Posted by dsds1 View Post
I dunno the code of disable shooting, but you could try in _damage.gsc and search for
Code:
Callback_PlayerDamage_internal( eInflictor, eAttacker, victim, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime )
there is two, but you could try the first

and add

Code:
if(isSubStr(sWeapon, "barrett") && self getstance() != "prone") 
{ 
 iDamage = 0; 
}
this doesn't disable shooting(and don't ask what the code for it cuz i dunno), but it's make bullet hits with no damage
Then you just disable the damage, and you will still lose bullets.

What I tryed to do is:
It notifyes the getbullets. And save them.
And when he lai down, the saved bullets "load" back into his chamber.
Quote Originally Posted by Jorndel View Post
Then you just disable the damage, and you will still lose bullets.
nope, let the OP try cuz I tried the same code ad it didn't lose bullets when if statement is false
Quote Originally Posted by dsds1 View Post
nope, let the OP try cuz I tried the same code ad it didn't lose bullets when if statement is false
I don't get what you mean then.
Do you understand his question?

How long have you been doing GSC?

Because for me... I don't think you have done this for a long time. Maybe 1/2 month or a bit more...
Quote Originally Posted by Jorndel View Post
I don't get what you mean then.
Do you understand his question?

How long have you been doing GSC?

Because for me... I don't think you have done this for a long time. Maybe 1/2 month or a bit more...
Who are you asking that? If it is me, 6 months i think.
Posts 1–15 of 16 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?