コンテキスト:私は、私が取得するGET_ENTITY_COORDS
機能を使用していますグランド・セフト・オートV.Cは - メンバーの要求に何かに「X」ではない構造体または共用
と呼ばれるゲームのためのいくつかの変更をしようとしていますゲーム内のエンティティの座標は:
static Inline struct Vector3 GET_ENTITY_COORDS(Entity entity, BOOL alive) {
args[0] = entity;
args[1] = alive;
invokeNative(0x3FEF770D40960D5A);
struct Vector3 vector3 = { *(float*)&rets[0], *(float*)&rets[1], *(float*)&rets[2] };
return vector3;
}
これはxPos
、yPos
とzPos
を返す必要があります。
今これは私が現在で苦労しているどのようなコードです:
#include "gta.h"
void invokeNative_s(u64 hash) {
struct Native_s** g_Natives = (struct Native_s**)NativeTableAddress;
struct Native_s* Natives = g_Natives[hash & 0xFF];
while (Natives != 0) {
for (unsigned int i = 0; i < Natives->NativeCount; i++) {
if (Natives->NativeHashes[i] == hash) {
((void(*)(struct NativeArg_s*))Natives->NativeFunctions[i])((struct NativeArg_s*)FreeSpaceAddress);
return;
}
}
Natives = Natives->LastNativeTable;
}
}
struct gtaVars_s {
BOOL init;
int frameCount;
};
static struct gtaVars_s *gtaVars = (struct gtaVars_s*)FreeSpaceAddress+0x100;
BOOL nativeHook() {
if (!gtaVars->init) {
nativeArg->ArgValues = args;
nativeArg->ReturnValue = rets;
gtaVars->frameCount = 0;
gtaVars->init = TRUE;
}
int newFrameCount = GET_FRAME_COUNT();
if (gtaVars->frameCount < newFrameCount) {
gtaVars->frameCount = newFrameCount;
Ped pedID = PLAYER_PED_ID();
Player playerID = PLAYER_ID();
/* define player coords */
Vector3 playerCoords = GET_ENTITY_COORDS(pedID, 1);
char waterRadius = 10;
SET_SUPER_JUMP_THIS_FRAME(playerID);
SET_PLAYER_INVINCIBLE(playerID, TRUE);
if (IS_CONTROL_JUST_PRESSED(0, Button_Tpad)) {
// teleport to beach
SET_ENTITY_COORDS(pedID, -1374.881, -1398.835, 6.141, FALSE, FALSE, FALSE, TRUE);
// set water
MODIFY_WATER(playerCoords.x, playerCoords.y, waterRadius, 10);
MODIFY_WATER(playerCoords.x+2, playerCoords.y, waterRadius, 10);
MODIFY_WATER(playerCoords.x, playerCoords.y+2, waterRadius, 10);
MODIFY_WATER(playerCoords.x+2, playerCoords.y+2, waterRadius, 10);
MODIFY_WATER(playerCoords.x+4, playerCoords.y, waterRadius, 10);
MODIFY_WATER(playerCoords.x, playerCoords.y+4, waterRadius, 10);
MODIFY_WATER(playerCoords.x+4, playerCoords.y+4, waterRadius, 10);
MODIFY_WATER(playerCoords.x+6, playerCoords.y, waterRadius, 10);
MODIFY_WATER(playerCoords.x, playerCoords.y+6, waterRadius, 10);
MODIFY_WATER(playerCoords.x+6, playerCoords.y+6, waterRadius, 10);
MODIFY_WATER(playerCoords.x+8, playerCoords.y, waterRadius, 10);
MODIFY_WATER(playerCoords.x, playerCoords.y+8, waterRadius, 10);
MODIFY_WATER(playerCoords.x+8, playerCoords.y+8, waterRadius, 10);
}
}
return TRUE;
}
しかし、私は、私は私のスクリプトで上記の関数を定義しているにもかかわらず、GET_ENTITY_COORDS
関数から複数のエラーを取得しています:
source/gta.c:42:3: error: unknown type name ‘Vector3’
Vector3 playerCoords = GET_ENTITY_COORDS(pedID, 1);
^
source/gta.c:42:26: error: incompatible types when initializing type ‘int’ using type ‘struct Vector3’
Vector3 playerCoords = GET_ENTITY_COORDS(pedID, 1);
^
source/gta.c:53:29: error: request for member ‘x’ in something not a structure or union
このエラーの原因は何ですか、どのように修正できますか?私はかなりの日のためにこれと苦労しているので、それは多くをありがとうと思って、それが解決するのを見て大好きです、事前に感謝します。この作品以来、それはそれはstruct
として(いくつかのコードでは、我々が表示されていない)に定義されますことを意味するが、ないよう、
static Inline struct Vector3 GET_ENTITY_COORDS
ので:あなたのスニペットVector3
の一部に示すよう
'Vector3' =>' struct Vector3'はそれを修正する必要があります。 –