Can you recommend any code cleanup or enhancement for this plugin?
I'm in the process of cleaning up Halloween plugins in preparation for Scream Fortress. This plugin works just fine as-is. However, if you have any tips for code cleanup or improvement I'd love to hear them. I'm eager to learn.
Current plugin functionality:
Target player becomes Merasmus the Wizard. Changes to gray team and can attack players on RED and BLU team. Changes to sniper class with Merasmus player model. Removes all weapons and is given a melee weapon. Can cast 500 fireball spells. Can cast unlimited lightning spells. Can launch nearby players very high into air. Can release bombs that damage nearby players. Has extremely enhanced attributes with damage resistances. Melee attacks have increased range and instantly kill and turns victim to gold. Ambient sounds are played while Merasmus is alive.
You can remove public from non-global forward callbacks such as OnPlayerActivate and Event_DeathPre. It's been a few major versions since that was necessary (SM 1.7, I think?)
You might be able to put the braced initializer directly into TeleportEntity without a tag mismatch; I keep forgetting if that's been fixed in SM 1.11 and don't feel like setting up an environment to test.
The strings that are part of a set could be moved to an array:
Normally I'd suggest putting the strings there directly, but some of them are reused in Command_GetmsRandom.
I'd suggest using GetURandomInt over GetRandomInt just to avoid depending on the game's own random stream. It looks like you already do that with GetURandomFloat.
Rename variables for consistency, but the globals in particular should all have a prefix to make it obvious what scope they have and to minimize the risk of variable shadowing, even though the compiler does warn you about that.
ParticleIndex should use an entity reference EntIndexToEntRef. You can use the value in most places that accept entity indices. You may also want to use a client-sized array to store that state and ensure that calls to BuildParticle clean up previous particles.