Thanks. But players can change the color of the animals and they can change their animals anytime during the game. Like what i mentioned, there is no problem when they select or change the animals, its when they change the color. Also I added an event_touch but only the player can do that with their own animal. I also included event_click and same problem. This is some part of my code:

// Panel for color selection
PANEL* color_pan =
{
layer = 2;
pos_x = 500;
pos_y = 0;
button (0, 10, "blue.pcx", "blue.pcx", "blue.pcx", entity_color, NULL, func_over_color_sound);
button (55, 10, "brown.pcx", "brown.pcx", "brown.pcx", entity_color, NULL, func_over_color_sound);
button (110, 10, "black1.pcx", "black1.pcx", "black1.pcx",entity_color, NULL, func_over_color_sound);

// flags = OVERLAY | SHOW;
}

// Panel for animal selection
PANEL* charac_pan =
{
layer = 3;
pos_x = 0;
pos_y = 0;
button (10, 0, "horse1.tga", "horse1.tga", "horse3.tga", create_entity, NULL, func_over_entity_sound);
button (120, 0, "pig1.tga", "pig1.tga", "pig2.tga", create_entity, NULL, func_over_entity_sound);
button (230, 0, "bat1.tga", "bat1.tga", "bat2.tga", create_entity, NULL, func_over_entity_sound);
// flags = OVERLAY | SHOW;
}
// Initiate client-server connection
void start_clientserver()
{
enet_init(); //ENet is initialized

enet_svset_event(EVENT_CONNECTED,_str("client_connected"));
// enet_svset_event(EVENT_DISCONNECTED,_str("client_disconnected"));

enet_server = enet_init_server(2300,5,_str("")); //initializes the server with port 2300,
enet_client = enet_init_client(_str("127.0.0.1"),2300,_str("")); //Initializes a client
}

// character entity 1 event
void char_ent1_event()
{
if (event_type == EVENT_TOUCH)
{
my.ambient = 100;
my.lightrange = 20;
}

else
{
if (event_type == EVENT_RELEASE)
{
my.ambient = 0;
my.lightrange = 0;
}
}

if (event_type == EVENT_CLICK)
{
active_entity = 1;
media_stop(soundhandle1);
str_cpy(sound1,"horse effect1.mp3");
soundhandle1 = media_play(sound1,NULL,50);

move_percentage = 0;
str_cpy(action_str, "gallop");

while (1)
{
ent_animate(my,action_str,move_percentage, ANM_CYCLE);
move_percentage += speed * time_step;
move_percentage %= 100;
wait (1);
}
}
}

// character entity 2 event
void char_ent2_event()
{
if (event_type == EVENT_TOUCH)
{
my.ambient = 100;
my.lightrange = 20;
}

else
{
if (event_type == EVENT_RELEASE)
{
my.ambient = 0;
my.lightrange = 0;
}
}

if (event_type == EVENT_CLICK)
{
active_entity = 2;
media_stop(soundhandle1);
str_cpy(sound1,"pig effect1.mp3");
soundhandle1 = media_play(sound1,NULL,50);

move_percentage = 0;
str_cpy(action_str, "kosma");

while (1)
{
ent_animate(my,action_str,move_percentage, ANM_CYCLE);
move_percentage += speed * time_step;
move_percentage %= 100;
wait (1);
}
}
}

// character entity 3 event
void char_ent3_event()
{
if (event_type == EVENT_TOUCH)
{
my.ambient = 100;
my.lightrange = 20;
}

else
{
if (event_type == EVENT_RELEASE)
{
my.ambient = 0;
my.lightrange = 0;
}
}

if (event_type == EVENT_CLICK)
{
active_entity = 3;
media_stop(soundhandle1);
str_cpy(sound1,"bat2.mp3");
soundhandle1 = media_play(sound1,NULL,100);

move_percentage = 0;
str_cpy(action_str, "fly");

while (1)
{
ent_animate(my,action_str,move_percentage, ANM_CYCLE);
move_percentage += speed * time_step;
move_percentage %= 100;
wait (1);
}
}
}


// animal 1 action
void char_ent1_action()
{
//wait until the entity has a global pointer:
while(enet_ent_globpointer(my) == -1) {wait(1);}

my.pan = 280;
ent_setskin(my,NULL,0);
media_stop(soundhandle1);

my.emask |= (ENABLE_TOUCH | ENABLE_RELEASE | ENABLE_CLICK);
my.event = char_ent1_event;
}

// animal 2 action
void char_ent2_action()
{
//wait until the entity has a global pointer:
while(enet_ent_globpointer(my) == -1) {wait(1);}

my.pan = 200;
ent_setskin(my,NULL,0);
media_stop(soundhandle1);

my.emask |= (ENABLE_TOUCH | ENABLE_RELEASE | ENABLE_CLICK);
my.event = char_ent2_event;
}

// animal 3 action
void char_ent3_action()
{
//wait until the entity has a global pointer:
while(enet_ent_globpointer(my) == -1) {wait(1);}

my.pan = 200;
ent_setskin(my,NULL,0);
media_stop(soundhandle1);

my.emask |= (ENABLE_TOUCH | ENABLE_RELEASE | ENABLE_CLICK);
my.event = char_ent3_event;
}

// Function when mouse is over button. Entity sounds
void func_over_entity_sound(var butt)
{
if (butt == 1)
{
str_cpy(sound2,"horse.mp3");
soundhandle2 = media_play(sound2,NULL,100);
}

if (butt == 2)
{
str_cpy(sound2,"pig.mp3");
soundhandle2 = media_play(sound2,NULL,100);
}

if (butt == 3)
{
str_cpy(sound2,"bat.mp3");
soundhandle2 = media_play(sound2,NULL,100);
}
}

// Function when mouse is over button. color sounds
void func_over_color_sound(var butt)
{
if (butt == 1)
{
str_cpy(sound2,"blue.mp3");
soundhandle2 = media_play(sound2,NULL,100);
}

if (butt == 2)
{
str_cpy(sound2,"brown.mp3");
soundhandle2 = media_play(sound2,NULL,100);
}

if (butt == 3)
{
str_cpy(sound2,"black.mp3");
soundhandle2 = media_play(sound2,NULL,100);
}
}

// create first animal
void create_entity(var butt)
{
if (active_entity == 1)
{
enet_ent_remove(enet_ent_globpointer(char_ent1));
//ptr_remove(char_ent1);
}

if (active_entity == 2)
{
enet_ent_remove(enet_ent_globpointer(char_ent2));
// ptr_remove(char_ent2);
}

if (active_entity == 3)
{
enet_ent_remove(enet_ent_globpointer(char_ent3));
// ptr_remove(char_ent3);
}

if (butt == 1)
{
char_ent1 = enet_ent_create(_str("horse.mdl"),vector(200,-50,-50),_str("char_ent1_action"));
str_cpy(action_str, "gallop");
active_entity = 1;
}

if (butt == 2)
{
char_ent2 = enet_ent_create(_str("boar.mdl"),vector(300,50,-75),_str("char_ent2_action"));
str_cpy(action_str, "kosma");
active_entity = 2;
}

if (butt == 3)
{
char_ent3 = enet_ent_create(_str("bat.mdl"),vector(400,50,50),_str("char_ent3_action"));
str_cpy(action_str, "fly");
active_entity = 3;
}
}

// set animal color 1
void entity_color(var butt)
{
if (butt == 1)
{
if (active_entity == 1)
{
ent_mtlset (char_ent1, mtlcolor1, 0);
}
if (active_entity == 2)
{
ent_mtlset (char_ent2, mtlcolor1, 0);
}
if (active_entity == 3)
{
ent_mtlset (char_ent3, mtlcolor1, 0);
}
}

if (butt == 2)
{
if (active_entity == 1)
{
ent_mtlset (char_ent1, mtlcolor2, 0);
}
if (active_entity == 2)
{
ent_mtlset (char_ent2, mtlcolor2, 0);
}
if (active_entity == 3)
{
ent_mtlset (char_ent3, mtlcolor2, 0);
}
}

if (butt == 3)
{
if (active_entity == 1)
{
ent_mtlset (char_ent1, mtlcolor3, 0);
}
if (active_entity == 2)
{
ent_mtlset (char_ent2, mtlcolor3, 0);
}
if (active_entity == 3)
{
ent_mtlset (char_ent3, mtlcolor3, 0);
}
}
}