is there any problem there, my friend sent me that code for learn viewmodel name. the problem is condition always false.
also when try this shows empty
PHP Code:
GetModelNameByIndex(GetClientViewModelIndex(client), ModelName, sizeof(ModelName))
PrintToChatAll("TEST %s", ModelName)
PHP Code:
int GetClientViewModelIndex(int client)
{
int viewmodel = GetEntPropEnt(client, Prop_Send, "m_hViewModel")
if(viewmodel != -1)
return GetEntProp(viewmodel, Prop_Send, "m_nModelIndex")
return 0
}
bool GetModelNameByIndex(int idx, char[] sBuffer, int size)
{
static int _tableIndex
if(!_tableIndex)
_tableIndex = FindStringTable("modelprecache")
if(GetStringTableNumStrings(_tableIndex) >= idx)
return false
ReadStringTable(_tableIndex, idx, sBuffer, size)
return true
}