Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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?

AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD

76561197984667096.png

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...