- Home /
How do i rearrange this in C(sharp)?
Hello
I was wondering if someone could help me well basically how do covert this into C(sharp)
if(Input.GetKey(KeyCode.F) && BulletsLeft ){
not all of the line just the && because i get an error message but in java this works fine
please can someone help me thank you in advance MCHALO
Answer by Ziad · Aug 21, 2011 at 04:17 AM
You can't get an error message cuz there is no error there just make sure that (BulletsLeft) is exist in ur C# Script
I have :) its called public int BulletsLeft = 0;
on my script and i get this error :
Assets/FPSScripts/C(Sharp)/RayShootC.cs(68,34): error CS0019: Operator &&' cannot be applied to operands of type
bool' and `int'
:)
yes you can't do this because (BulletsLeft) is int and u need to make something like this
if(Input.Get$$anonymous$$ey($$anonymous$$eyCode.F) && BulletsLeft == 0 ){
yep that solved it i need to do that but the equal had to be > because if i did 0 then i could only fire if my bullets went to 0 thank you :)
Your answer
![](https://koobas.hobune.stream/wayback/20220612185327im_/https://answers.unity.com/themes/thub/images/avi.jpg)