
public item_drop(id,item_id)
{
	new Float:origin[3],Float:colors[3];
	entity_get_vector(id,EV_VEC_origin,origin);
	
	new ent = create_entity("info_target");
	
	entity_set_string(ent,EV_SZ_classname,"item_drop");
	entity_set_model(ent,"models/sphere.mdl");
	
	origin[2] += 10.0;
	entity_set_origin(ent,origin);
	
	entity_set_int(ent,EV_INT_rendermode,kRenderTransColor);
	entity_set_int(ent,EV_INT_renderfx,kRenderFxGlowShell);
	
	entity_set_int(ent,EV_INT_movetype,MOVETYPE_TOSS);
	entity_set_int(ent,EV_INT_solid,SOLID_TRIGGER);
	
	colors[0]=g_item_color_red[item_id];
	colors[1]=g_item_color_green[item_id];
	colors[2]=g_item_color_blue[item_id];
	
	entity_set_vector(ent,EV_VEC_rendercolor,colors);
	entity_set_float(ent,EV_FL_renderamt,150.0);
	
	entity_set_edict(ent,EV_ENT_owner,item_id);

	drop_to_floor(ent);
	
	return PLUGIN_CONTINUE;
}

public item_drop_touch(touched,toucher)
{
	if(!is_user_alive(toucher))
	{
		return PLUGIN_CONTINUE;
	}
	
	static item_id;
	item_id=entity_get_edict(touched,EV_ENT_owner);
	
	if(g_player_use[toucher])
	{
		if(g_player_item[toucher] > 0)
		{
			print_hud_status(toucher,"%L",toucher,"L_STATUS_ITEM_HAVE");
			return PLUGIN_CONTINUE;
		}
			
		g_player_item[toucher]=item_id;
		item_passive(toucher);
		
		print_hud_player(toucher);
		remove_entity(touched);
	}
	else
	{
		print_hud_status(toucher,"%L",toucher,"L_STATUS_ITEM",g_item_names[item_id]);
	}
	
	return PLUGIN_CONTINUE;
}

public item_drop_remove()
{
	new ent = 0;
	while((ent = find_ent_by_class(-1,"item_drop")) > 0)
	{
		if(is_valid_ent(ent))
		{
			remove_entity(ent);
		}
	}
	
	return PLUGIN_CONTINUE;
}
