UDK - Type mismatch in 'If' for MyInventory functil
I am having trouble getting a pawn class to compile. The error is Type开发者_JS百科 mismatch in 'If' in the line: if( MyInventory[inc] == int (x) );
CODE: [CODE]class BSAPawn extends UTPawn;
var() array MyInventory;
function bool HasItem(int x) { local int len; local int inc; len = MyInventory.Length;
for(inc = 0; inc < len; inc++)
{
if( MyInventory[inc] = int x );
return true;
}
return false;
}[/CODE]
Does anyone know how to sort this out? Tom
You're assigning a value =
instead of doing a comparison ==
it should look like..
for(inc = 0; inc < len; inc++)
{
if( MyInventory[inc] == x )
return true;
}
return false;
Plus why are you using int x
instead of simply x
精彩评论