weequ
2010-08-09 13:38:53
This might be becouse hooks are not up to date but I think it should then just result an array with 0 length and not give errors.
I don't understand too much about try..finally things so here is the code from characters.simba
I don't understand too much about try..finally things so here is the code from characters.simba
function GetPlayers: array of TPlayer;
var
i, IndexPos, Count, Player, theName, L: integer;
begin
Count := SmartGetFieldInt(0, hook_static_PlayerCount);
SetArrayLength(result, Count);
if Count < 1 then Exit;
for i := 0 to Count-1 do
try
IndexPos := SmartGetFieldArrayInt(0, hook_static_PlayerIndexArray, i);
Player := SmartGetFieldArrayObject(0, hook_static_GetPlayers, IndexPos);
theName := SmartGetFieldObject(Player, hook_player_GetName);
Result[L].Index := IndexPos;
Result[L].Name := GetJavaString(theName, 255);
Result[L].Tile.X := (SmartGetFieldInt(0, hook_static_BaseX) + (SmartGetFieldInt(Player, hook_animable_PixelX) / 512));
Result[L].Tile.Y := (SmartGetFieldInt(0, hook_static_BaseY) + (SmartGetFieldInt(Player, hook_animable_PixelY) / 512));
Result[L].Height := iabs(SmartGetFieldInt(Player, hook_character_GetHeight));
Result[L].Animation := SmartGetFieldInt(Player, hook_character_Animation);
Result[L].Moving := (SmartGetFieldInt(Player, hook_character_Motion)>0);
Result[L].HPRatio := SmartGetFieldInt(Player, hook_character_HPRatio) * 100 / $FF;
Result[L].Level := SmartGetFieldInt(Player, hook_player_GetLevel);
Result[L].Orientation := Round(FixD(180 + (SmartGetFieldInt(Player, hook_character_Orientation)* 45) / 2048));
Result[L].Interacting := SmartGetFieldInt(Player, hook_character_GetInteracting);
Inc(L);
finally
SmartFreeObject(Player);
SmartFreeObject(theName);
end;
SetArrayLength(Result, L);
end;