MrIslomaniac Posted January 21, 2010 Posted January 21, 2010 When i use this code from the wiki: void _stdcall MessageReceiveCallback( TEntity entity, str message, byte* extra ) { char str[256]; sprintf(str, "%d got a message. Message name: \"%s\"", (int)entity, message); MessageBoxA(0, str, "MessageReceiveCallback called", 0); } and call it with SendEntityMessage(Cube, "Hello World!"); i get this result : 31324672 got a message ... So i wondered if it would be possible to use somethign like SendEntityMessage(31324672, "Hello World!"); in order to send it to entities from other classes. This example obviously does not work =( Does anyone have an idea? Greetz and thanks Quote
Rick Posted January 21, 2010 Posted January 21, 2010 From what I know TEntity (and all the other entity types) is a char*. So it's storing a memory location. When you cast it to (int) I think you are getting the location in memory as an integer, but that's not the same as a pointer. So 31324672 is the memory location not an internal ID number for the object. Quote
VicToMeyeZR Posted January 21, 2010 Posted January 21, 2010 SendEntityMessage(31324672, "Hello World!"); The first argument is a string/char, not an integer or float. That's the reason that doesn't work. I don't know if SendEntityMessage("31324672", "Hello World!"); Will work or not, but that would be a string.. I believe rick is right, that's probably an integer of the pointer? Quote AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.