Quote:
Originally Posted by Bobbls
I also tried using Prop_Data with the same results, it seems to always return -1.
|
You're checking things too early (SpawnPost still appears to be too early to check). A quick hack of getting it a frame after it spawns seems to return stuff that isn't -1.
I've had a similar issue when I worked on
the Revive Health modifications. Just using
RequestFrame here since I'm not sure if ropes can even think.
Code:
#include <sdkhooks>
public void OnEntityCreated(int entity, const char[] name) {
if (StrEqual(name, "move_rope")) {
SDKHook(entity, SDKHook_SpawnPost, OnMoveRopeSpawnPost);
}
}
public void OnMoveRopeSpawnPost(int entity) {
RequestFrame(PrintRopeStuff, entity);
}
public void PrintRopeStuff(int rope) {
int hStartPoint = GetEntPropEnt(rope, Prop_Data, "m_hStartPoint");
int hEndPoint = GetEntPropEnt(rope, Prop_Data, "m_hEndPoint");
char sStartOrigin[64], sEndOrigin[64];
GetEntOriginString(hStartPoint, sStartOrigin, sizeof(sStartOrigin));
GetEntOriginString(hEndPoint, sEndOrigin, sizeof(sEndOrigin));
PrintToServer("rope -- start: %d (%s), end: %d (%s)", hStartPoint, sStartOrigin, hEndPoint, sEndOrigin);
}
void GetEntOriginString(int entity, char[] buffer, int maxlen) {
float vecOrigin[3];
GetEntPropVector(entity, Prop_Data, "m_vecOrigin", vecOrigin);
Format(buffer, maxlen, "%.2f %.2f %.2f", vecOrigin[0], vecOrigin[1], vecOrigin[2]);
}
There might be a better hook to call that doesn't need callbacks, but I'm too lazy to check.
(I know you already got the news from our mutual staff comms, just wanted to post it if anyone else has a similar issue later on.)
__________________