I'm trying to make a plugin that creates a bunch of props when another prop is broken and shoot them out everywhere with a randomly coloured beam following them.
This is how I'm creating the props:
PHP Code:
int entNum = GetRandomInt(5, 20);
for(int i = 0; i < entNum; i++)
{
int ent = CreateEntityByName("prop_physics_override");
DispatchKeyValue(ent, "Health", "0");
DispatchKeyValue(ent, "Model", "models/items/boxmrounds.mdl");
HookSingleEntityOutput(ent, "OnPlayerUse", OnPlayerUse, true);
int rgba[4] = { GetRandomInt(0, 255), GetRandomInt(0, 255), GetRandomInt(0, 255), 255 };
TE_SetupBeamFollow(ent, g_iLaser, g_iHalo, 10.0, 5.0, 1.0, 10, rgba);
DispatchSpawn(ent);
float pos[3], velocity[3];
GetEntPropVector(victim, Prop_Send, "m_vecOrigin", pos);
velocity[0] = GetRandomFloat(0.0, 20.0);
velocity[1] = GetRandomFloat(0.0, 20.0);
velocity[2] = GetRandomFloat(0.0, 20.0);
TeleportEntity(ent, pos, NULL_VECTOR, velocity);
TE_SendToAll();
}
And this is where I'm having trouble:
PHP Code:
int rgba[4] = { GetRandomInt(0, 255), GetRandomInt(0, 255), GetRandomInt(0, 255), 255 };
TE_SetupBeamFollow(ent, g_iLaser, g_iHalo, 10.0, 5.0, 1.0, 10, rgba);
Every time I try to compile while setting the colour randomly I get an error of: error 008: must be a constant expression; assumed zero
I know I could just use a switch statement to pick colours but I'd much prefer being able to have it completely random.
Thanks in advance.