1. You're not declaring "Particle" correct. When you create entity by name you're actually storing an index. So you need to declare it with int.
PHP Code:
int Particle = CreateEntityByName("env_fog_controller");
Secondly no need to check for IsValidEntity.
Thirdly, change
PHP Code:
ActivateEntity(Particle);
to this
PHP Code:
AcceptEntityInput(Particle, "TurnOn");