There seems to be a limit of 32 dynamic lights. If there are more, some will turn off shortly after activation.
This variant creates dynamic lights with a 0.1s pause before creating the next one. It's good for debugging purposes.
The glass_votemap entities are models. They don't have an origin, so the average of the mins and maxs is used instead.
Code:
#include <amxmodx>
#include <engine>
public plugin_init()
{
register_plugin("test","1","pizzahut")
set_task(4.0, "create_light", 0, _, _, "b")
}
public create_light(ent)
{
new Float:mins[3], Float:maxs[3], origin[3]
if ((ent = find_ent_by_tname(ent, "glass_votemap")))
{
entity_get_vector(ent, EV_VEC_mins, mins)
entity_get_vector(ent, EV_VEC_maxs, maxs)
origin[0] = floatround((mins[0] + maxs[0]) / 2.0)
origin[1] = floatround((mins[1] + maxs[1]) / 2.0)
origin[2] = floatround((mins[2] + maxs[2]) / 2.0)
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_DLIGHT)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_byte(10) // radius
write_byte(255) // r
write_byte(255) // g
write_byte(255) // b
write_byte(40) // life time
write_byte(0) // decay
message_end()
set_task(0.1, "create_light", ent)
}
}