Hey, sorry to bump this since I'm trying to do the same thing
can you tell me why this doesnt work ?
PHP Code:
CBaseEntity *UTIL_FindEntityByClassname(int start, const char *pEntityClassname)
{
CBaseEntity *pEntity;
if (start == -1)
{
pEntity = (CBaseEntity *)g_pServerTools->FirstEntity();
}
else
{
pEntity = gamehelpers->ReferenceToEntity(start);
if (pEntity)
{
pEntity = (CBaseEntity *)g_pServerTools->NextEntity(pEntity);
}
}
if (pEntity)
{
static int offset = -1;
if (offset == -1)
{
sm_datatable_info_t info;
if (gamehelpers->FindDataMapInfo(gamehelpers->GetDataMap(pEntity), "m_iClassname", &info))
{
offset = info.actual_offset;
}
}
const char *pClassname;
string_t str;
int lastLetter;
while (pEntity)
{
str = *(string_t *)((uint8_t *)pEntity + offset);
if (str == NULL_STRING)
{
pEntity = (CBaseEntity *)g_pServerTools->NextEntity(pEntity);
continue;
}
pClassname = STRING(str);
lastLetter = strlen(pEntityClassname) - 1;
if (pEntityClassname[lastLetter] == '*' && !strncasecmp(pEntityClassname, pClassname, lastLetter))
{
return pEntity;
}
else if (!strcasecmp(pEntityClassname, pClassname))
{
return pEntity;
}
pEntity = (CBaseEntity *)g_pServerTools->NextEntity(pEntity);
}
}
return pEntity;
};
Basically I'm trying to find the fov ("ent_fov_controller") and edit it also is there any equivalent to SetVariant* and AcceptEntityInput
PHP Code:
void OnServer_Activate(edict_t *pEdict, int edictCount, int clientMax)
{
engine->LightStyle(0, MAP_LIGHT);
/*
CBaseEntity *pFogEntity = UTIL_FindEntityByClassname(-1, "env_fog_controller");
if (!pFogEntity)
{
g_pServerTools->DispatchSpawn(pFogEntity);
}
g_pServerTools->SetKeyValue(pFogEntity, "fogmaxdensity", 0.6);
SetVariantInt(FogStartDist);
AcceptEntityInput(FogControllerIndex, "SetStartDist");
SetVariantInt(FogEndDist);
AcceptEntityInput(FogControllerIndex, "SetEndDist");
SetVariantInt(FogZPlane);
AcceptEntityInput(FogControllerIndex, "SetFarZ");
SetVariantString(FogColor);
AcceptEntityInput(FogControllerIndex, "SetColor");
SetVariantString(FogColor);
AcceptEntityInput(FogControllerIndex, "SetColorSecondary");
SET START DIST, END DIST, FARZ
*/
}
The lightning works fine, but others doesnt