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

[DoD:S] GetEntPropString bugged? (SOLVED)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Prof. Orribilus
Member
Join Date: Jun 2013
Location: Italy
Old 08-30-2015 , 11:56   [DoD:S] GetEntPropString bugged? (SOLVED)
Reply With Quote #1

Hello.

I am running a DoD:S map where there are several game_player_equip entities where each has the Use input linked with the OnTrigger output of a trigger_multiple entity.

I am trying to access m_weaponNames and m_weaponCount props of the game_player_equip with the following code in the stable SourceMod 1.7.2:
PHP Code:
public void OnEntityCreated(int entity, const char[] classname)
{
    if (
StrEqual(classname"game_player_equip"false))
    {
        if (
SDKHookEx(entitySDKHook_UseManageGPEEntUseHook))
        {
            
PrintToServer("game_player_equip entity %d's Use hooking succeeded"entity);
        }
        else
        {
            
PrintToServer("game_player_equip entity %d's Use hooking failed"entity);
        }
    }
}


public 
Action ManageGPEEntUseHook(int entityint activatorint callerUseType typefloat value)
{
    
char message[128];
    
    if (
Entity_IsPlayer(activator))
    {
        
char arrayWeaponNames[MAX_EQUIP][128];
        
int arrayWeaponCount[MAX_EQUIP];
        
int numberWeaponNamesCurrElems GetEntPropArraySize(entityProp_Data"m_weaponNames");
        
        
strcopy(messagesizeof(message), "numberWeaponNamesCurrElems: %d")
        
PrintToServer(messagenumberWeaponNamesCurrElems);
        
PrintToChatAll(messagenumberWeaponNamesCurrElems);
        
        for(
int i 0numberWeaponNamesCurrElemsi++)
        {
            
GetEntPropString(entityProp_Data"m_weaponNames"arrayWeaponNames[i], 128i);
            
arrayWeaponCount[i] = GetEntProp(entityProp_Data"m_weaponCount"4i);
            
strcopy(messagesizeof(message), "arrayWeaponNames[%d]: '%s'")
            
PrintToServer(messageiarrayWeaponNames[i]);
            
PrintToChatAll(messageiarrayWeaponNames[i]);
            
strcopy(messagesizeof(message), "arrayWeaponCount[%d]: %d")
            
PrintToServer(messageiarrayWeaponCount[i]);
            
PrintToChatAll(messageiarrayWeaponCount[i]);
        }
    }
    
    return 
Plugin_Continue;

getting the following lines of text in console when the player touch one of the trigger_multiple:
Code:
numberIWeaponNamesCurrElems: 32
arrayIWeaponNames[0]: 'weapon_riflegren_us'
arrayIWeaponCount[0]: 3
L 08/29/2015 - 20:31:47: [SM] Native "GetEntPropString" reported: Prop m_weaponNames is not an array. Element 1 is invalid.
etc.
As we can see, the runtime error tells that the m_weaponNames is not an array but, when i use the GetEntPropArraySize to store its size in my numberWeaponNamesCurrElems variable, i get the number 32. So why does the GetEntPropString give me that error? Is it bugged?
__________________


Last edited by Prof. Orribilus; 09-02-2015 at 21:48.
Prof. Orribilus is offline
Prof. Orribilus
Member
Join Date: Jun 2013
Location: Italy
Old 09-02-2015 , 21:47   Re: [DoD:S] GetEntPropString bugged? (SOLVED)
Reply With Quote #2

Solved. It was a bug.
__________________

Prof. Orribilus 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 21:33.


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