
stock create_status_icon(id,status,sprite[],red,green,blue)
{
	message_begin(MSG_ONE,g_msg_status_icon,{0,0,0},id);
	write_byte(status);
	write_string(sprite);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	message_end();
}

stock create_death_msg(id,victim,headshot,weapon_name[])
{
	message_begin(MSG_ALL,g_msg_death_msg,{0,0,0},0);
	write_byte(id);
	write_byte(victim);
	write_byte(headshot);
	write_string(weapon_name);
	message_end();
}

stock create_te_sprite(origin[3],sprite,scale,alpha)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_SPRITE);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	write_short(sprite);
	write_byte(scale);
	write_byte(alpha);
	message_end() ;
}

stock create_te_spray(origin[3],direction[3],sprite,count,speed,noise,rendermode)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_SPRAY);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	write_coord(direction[0]);
	write_coord(direction[1]);
	write_coord(direction[2]);
	write_short(sprite);
	write_byte(count);
	write_byte(speed);
	write_byte(noise);
	write_byte(rendermode);
	message_end();
}

stock create_screen_fade(id,duration,holdtime,fadetype,red,green,blue,alpha)
{
	message_begin(MSG_ONE,g_msg_screen_fade,{0,0,0},id);
	write_short(duration);
	write_short(holdtime);
	write_short(fadetype);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(alpha);
	message_end();
}

stock create_te_largefunnel(origin[3],sprite,flags)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_LARGEFUNNEL);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	write_short(sprite);
	write_short(flags);
	message_end();
}

stock create_te_beaments(start_entity,end_entity,sprite,frame_start,frame_rate,life,width,noise,red,green,blue,alpha,speed)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_BEAMENTS);
	write_short(start_entity);
	write_short(end_entity);
	write_short(sprite);
	write_byte(frame_start);
	write_byte(frame_rate);
	write_byte(life);
	write_byte(width);
	write_byte(noise);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(alpha);
	write_byte(speed);
	message_end();
}

stock create_te_beamtorus(origin[3],center[3],axis[3],sprite,frame_start,frame_rate,life,width,amplitude,red,green,blue,brightness,speed)
{
	message_begin(MSG_PAS,SVC_TEMPENTITY,origin);
	write_byte(TE_BEAMTORUS);
	write_coord(center[0]);
	write_coord(center[1]);
	write_coord(center[2]);
	write_coord(axis[0]);
	write_coord(axis[1]);
	write_coord(axis[2]);
	write_short(sprite);
	write_byte(frame_start);
	write_byte(frame_rate);
	write_byte(life);
	write_byte(width);
	write_byte(amplitude);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(brightness);
	write_byte(speed);
	message_end();
}

stock create_te_beamcylinder(origin[3],center[3],axis[3],sprite,frame_start,frame_rate,life,width,amplitude,red,green,blue,brightness,speed)
{
	message_begin(MSG_PAS,SVC_TEMPENTITY,origin);
	write_byte(TE_BEAMCYLINDER);
	write_coord(center[0]);
	write_coord(center[1]);
	write_coord(center[2]);
	write_coord(axis[0]);
	write_coord(axis[1]);
	write_coord(axis[2]);
	write_short(sprite);
	write_byte(frame_start);
	write_byte(frame_rate);
	write_byte(life);
	write_byte(width);
	write_byte(amplitude);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(brightness);
	write_byte(speed);
	message_end();
}

stock create_te_beampoint(start_entity,origin[3],sprite,frame_start,frame_rate,life,width,noise,red,green,blue,alpha,speed)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_BEAMENTPOINT);
	write_short(start_entity);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	write_short(sprite);
	write_byte(frame_start);
	write_byte(frame_rate);
	write_byte(life);
	write_byte(width);
	write_byte(noise);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(alpha);
	write_byte(speed);
	message_end();
}

stock create_te_beampoints(origin_start[3],origin_end[3],sprite,frame_start,frame_rate,life,width,noise,red,green,blue,alpha,speed)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_BEAMENTPOINTS);
	write_coord(origin_start[0]);
	write_coord(origin_start[1]);
	write_coord(origin_start[2]);
	write_coord(origin_end[0]);
	write_coord(origin_end[1]);
	write_coord(origin_end[2]);
	write_short(sprite);
	write_byte(frame_start);
	write_byte(frame_rate);
	write_byte(life);
	write_byte(width);
	write_byte(noise);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(alpha);
	write_byte(speed);
	message_end();
}

stock create_te_spritetrail(origin_start[3],origin_end[3],sprite,count,life,scale,velocity,randomness)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_SPRITETRAIL);
	write_coord(origin_start[0]);
	write_coord(origin_start[1]);
	write_coord(origin_start[2]);
	write_coord(origin_end[0]);
	write_coord(origin_end[1]);
	write_coord(origin_end[2]);
	write_short(sprite);
	write_byte(count);
	write_byte(life);
	write_byte(scale);
	write_byte(velocity);
	write_byte(randomness);
	message_end();
}

stock create_te_elight(entity,origin[3],radius,red,green,blue,life,decay_rate)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_ELIGHT);
	write_short(entity);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	write_coord(radius);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(life);
	write_coord(decay_rate);
	message_end();
}

stock create_te_lightning(origin[3],origin2[3],life,width,amplitude,sprite)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_LIGHTNING);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	write_coord(origin2[0]);
	write_coord(origin2[1]);
	write_coord(origin2[2]);
	write_byte(life);
	write_byte(width);
	write_byte(amplitude);
	write_short(sprite);
	message_end();
}

stock create_te_smoke(origin[3],sprite,scale,frame_rate)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_SMOKE);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	write_short(sprite);
	write_byte(scale);
	write_byte(frame_rate);
	message_end();
}

stock create_screen_shake(id,amount,duration,frequency)
{
	message_begin(MSG_ONE,g_msg_screen_shake,{0,0,0},id);
	write_short(amount);
	write_short(duration);
	write_short(frequency);
	message_end();
}

stock create_te_explosion(origin[3],sprite,scale,frame_rate,flags)
{	
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_EXPLOSION);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	write_short(sprite);
	write_byte(scale);
	write_byte(frame_rate);
	write_byte(flags);
	message_end();
}

stock create_te_tarexplosiom(origin[3])
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_TAREXPLOSION);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	message_end();
}

stock create_te_spark(origin[3])
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_SPARKS);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	message_end();
}

stock create_te_teleport(origin[3])
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_TELEPORT);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	message_end();
}

stock create_te_gunshotdecal(origin[3],decal)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_GUNSHOTDECAL);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	write_short(0);
	write_byte (decal);
	message_end();
}

stock create_bartime(id,duration,flag)
{
	message_begin(MSG_ONE,g_msg_bartime,{0,0,0},id);
	write_byte(duration);
	write_byte(flag);
	message_end();
}

stock create_te_dlight(origin[3],radius,red,green,blue,life,decay_rate)
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
	write_byte(TE_DLIGHT);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	write_byte(radius);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(life);
	write_byte(decay_rate);
	message_end();
}
