I'm trying to create a function in which the entity gradually disappears through the alpha, but it's not working.
If anyone can help me I'll be grateful
script is below
Script
PHP Code:
CreateTimer(0.1, DecreaseAlpha, EntIndexToEntRef(iSmoke), TIMER_REPEAT); //Repeatable CreateTimer for function
int Alpha[2000];
Action DecreaseAlpha(Handle timer, int iEntity)
{
if (!IsValidEntRef(iEntity))
return Plugin_Stop;
int entity = EntRefToEntIndex(iEntity);
Alpha[entity] += 5;
/* Function for alpha not to be greater than 255 or less than 0 */
if(Alpha[entity] >= 255) Alpha[entity] = 255;
else Alpha[entity] = 0;
//Function to change entity alpha
SetVariantInt(255 - Alpha[entity]);
AcceptEntityInput(entity, "Alpha");
return Plugin_Continue;
}
__________________