Raised This Month: $32 Target: $400
 8% 

Solved [CS:GO] Property "m_iItemDefinitionIndex" not found


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 04-08-2018 , 03:45   [CS:GO] Property "m_iItemDefinitionIndex" not found
Reply With Quote #1

Exception reported: Property "m_iItemDefinitionIndex" not found (entity 327/weaponworldmodel)
Code:
public Action OnWeaponCanUse(client, weapon)
{
	decl String:sweapon[64];
	GetEdictClassname(weapon, sweapon, sizeof(sweapon));
	new weaponindex = GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
this error happens very rarely and crash server
after this code (EquipPlayerWeapon):
Code:
zweapon[client_index] = GetEntPropEnt(client_index, Prop_Data, "m_hActiveWeapon");
if (IsValidEntity(zweapon[client_index]))
{
	RemovePlayerItem(client_index, zweapon[client_index]);
}	
else zweapon[client_index] = -1;
then:
Code:
if(zweapon[client_index] != -1 && IsValidEntity(zweapon[client_index])) EquipPlayerWeapon(client_index, zweapon[client_index]);
what it is - weaponworldmodel?
how should i fix this?
Code:
zweapon[client_index] = GetEntPropEnt(client_index, Prop_Data, "m_hActiveWeapon");
char sweapon[64];
GetEdictClassname(zweapon[client_index], sweapon, sizeof(sweapon));
if (IsValidEntity(zweapon[client_index]) && StrContains(sweapon, "weapon_") != -1)
{
	RemovePlayerItem(client_index, zweapon[client_index]);
}
else zweapon[client_index] = -1;
will fix crash?

Last edited by Indarello; 04-08-2018 at 13:13.
Indarello is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 04-08-2018 , 10:34   Re: [CS:GO] Property "m_iItemDefinitionIndex" not found
Reply With Quote #2

You can fix it by storing the Entity Reference into zweapon[client_index] instead of the entity index.
EntIndexToEntRef(weapon);
EntRefToEntIndex(weapon);
Don't forget to check if the active weapon is valid before converting it to a reference and validating it after you convert it back to an index.
Mitchell is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 04-08-2018 , 13:13   Re: [CS:GO] Property "m_iItemDefinitionIndex" not found
Reply With Quote #3

thanks
Indarello 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 18:44.


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