Raised This Month: $51 Target: $400
 12% 

GetEntDataString problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 12-08-2007 , 00:58   GetEntDataString problem
Reply With Quote #1

I'm trying to use GetEntDataString to fetch string_t m_ModelName defined in baseentity.h.

GetEntDataString will just return some garbage which might be a raw pointer value since it contains non printable characters and is equal for two entities using the same model.

My example code:
Code:
stock getBlockType(const entity) {
    if (!IsValidEntity(entity)) {
        return BLOCK_TYPE_INVALID;
    } else {
        new offset = FindDataMapOffs(entity, "m_ModelName");

        SayToAll("offset m_ModelName: %i", offset);

        if (offset != -1) {
            new String:buffer[255];
            GetEntDataString(entity, offset, buffer, 255);

            SayToAll("block model: %s", buffer);

            return BLOCK_TYPE_UNKNOWN;
        } else {
            return BLOCK_TYPE_INVALID;
        }
    }
}
How can i get the real model string?
sfPlayer is offline
BAILOPAN
Join Date: Jan 2004
Old 12-08-2007 , 11:04   Re: GetEntDataString problem
Reply With Quote #2

Indeed, m_ModelName is a string_t which is a pointer. You will need to file a feature request to read strings of this nature.

Setting strings like this is a much different story -- the strings aren't modifiable generally because they're pooled in game memory. You'd have to allocate/pool a new string.

Thus if you only need to read, the feature will be much easier for us to implement.
__________________
egg
BAILOPAN is offline
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 12-08-2007 , 18:58   Re: GetEntDataString problem
Reply With Quote #3

done at http://bugs.alliedmods.net/index.php...1258&project=5

thx
sfPlayer is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode