- You can remove "OnPluginEnd" stuff, unloading a plugin already does all of that.
- You can replace the call to "IsSurvivor" with "GetClientTeam(client) == 2" since the rest of the stock is just repeating what's already being checked in the for loop.
- As a trivial slight optimization you can do
PHP Code:
int WitchList = ListOWitches.Length;
for(int w = 0; w < WitchList; w++)
instead of using "ListOWitches.Length" within the for loop declaration. You have this in 1 place but not others.
- Another slight optimzation would be changing the two "char classname[8];" to "static char classname[8];" so the char is not constantly re-created and zeroed, since these are called often for almost every entity being create/deleted. I would do the same with "char sBuffer[512];" to "static char sBuffer[512];"
- You could change
PHP Code:
int entref = -1;
if(entity > 0)
entref = EntIndexToEntRef(entity);
else
return;
to
PHP Code:
if(entity < 1) return;
int entref = EntIndexToEntRef(entity);
and from the same function move "WitchInfo witch;" inside the "if(IsValidWitch(entity))" check, since it's never used outside of that.
- You can remove "public" from any callbacks that you name yourself, for example you have done this with the timer but not "public void witchevents".
__________________