Code:
/*
*
* Amx Paint
* by Genesis
*
* Be carefull painting, too many
* paint dots will crash the server
*
*/
#include <amxmodx>
#include <amxmisc>
#include <engine>
// Storage for limiting.
new paint;
public plugin_init()
{
register_plugin("Paint","1.4","Edit: Mel")
register_concmd("paint","draw",ADMIN_LEVEL_C,"[R] [G] [B] <paint on the wall ??>")
register_concmd("clearpaint","flush",ADMIN_LEVEL_C,"[Player] <flush paint ??>")
register_cvar("paint_limit","50")
paint = 0;
//return PLUGIN_CONTINUE No need for this
}
public draw(id, level, cid)
{
if (!cmd_access(id,level,cid,0)) return PLUGIN_HANDLED
if(paint > get_cvar_num("paint_limit") ) return PLUGIN_HANDLED;
// Get the colors.
new arg[32]
read_argv(1,arg,31)
new r = str_to_num(arg)
if(!r) r = random_num(0,255)
read_argv(2,arg,31)
new g = str_to_num(arg)
if(!g) g = random_num(0,255)
read_argv(3,arg,31)
new b = str_to_num(arg)
if(!b) b = random_num(0,255)
new endpoint[3]
get_user_origin(id, endpoint, 3)
new entid = create_entity("info_target")
if(!entid) return PLUGIN_HANDLED;
// I use a different classname, since it could conflict in HLDM.
entity_set_string(entid, EV_SZ_classname, "paint_dot")
entity_set_edict(entid, EV_ENT_owner, id)
entity_set_int(entid, EV_INT_movetype, MOVETYPE_NONE)
entity_set_int(entid, EV_INT_solid, SOLID_NOT)
// I suggest glow shell, but this should work too.
set_rendering(entid, kRenderFxNoDissipation, r, g, b, kRenderGlow, 255)
entity_set_model(entid, "sprites/dot.spr")
new Float:Vec[3]
IVecFVec(endpoint, Vec)
entity_set_origin(entid, Vec)
paint++;
return PLUGIN_HANDLED
}
public flush(id, level, cid)
{
if (!cmd_access(id,level,cid,0)) return PLUGIN_HANDLED
new arg[32]
read_argv(1,arg,31)
new ownerid = str_to_num(arg)
if(!ownerid)
{
remove_entity_name("paint_dot")
paint = 0;
}
else remove_by_owner(ownerid,"paint_dot")
return PLUGIN_HANDLED
}
public remove_by_owner(id,classname[])
{
new iEntity = find_ent_by_owner ( -1, classname, id, 0 )
while (iEntity > 0)
{
paint--;
remove_entity(iEntity)
iEntity = find_ent_by_class(-1, classname)
}
return 1;
}
public plugin_precache() precache_model("sprites/dot.spr");
I also hacked in a little limiter, and you can now specify if you want to remove only one persons ents.
Sorry if I butchered your plugin in any way, I just reduced it to simplest terms (in my standards) and edited it. Hope I helped ^^