Hi, i trying to hook game function "CBaseObject::IsPlacementPosValid", but it doesnt work, its always return 0(false) in any cases...
What i doing wrong?
PHP Code:
int sentryEntity = -1;
Handle hIsPlacementPosValid;
public void OnPluginStart()
{
RegAdminCmd("sm_canPlace", Command_ForcePlacement, ADMFLAG_GENERIC);
Handle gamedatafile=LoadGameConfigFile("buildonbuildings_defs.games");
if(gamedatafile==null)
{
SetFailState("Cannot find file buildonbuildings_defs.games!");
}
StartPrepSDKCall(SDKCall_Entity);
PrepSDKCall_SetFromConf(gamedatafile, SDKConf_Signature, "CBaseObject::IsPlacementPosValid");
PrepSDKCall_SetReturnInfo(SDKType_Bool, SDKPass_ByValue);
PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_ByValue);
PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
hIsPlacementPosValid = EndPrepSDKCall();
}
public Action Command_ForcePlacement(int client, int args)
{
float flPos[3];
GetClientLookPosition(client, flPos);
if (sentryEntity == -1)
{
sentryEntity = SpawnSentry(client, flPos);
}
//TeleportEntity(sentryEntity, NULL_VECTOR, NULL_VECTOR, flPos);
bool can = SDKCall(hIsPlacementPosValid, sentryEntity, flPos);
PrintToChat(client, "%d", can);
}