May 09 2024 09:14:27
Navigation
· Home
· Articles
· Downloads
· FAQ
· Discussion Forum
· Web Links
· News Categories
· Contact Me
· Photo Gallery
· Search
· Gameservers
Languages
Users Online
· Guests Online: 2

· Members Online: 0

· Total Members: 1,129
· Newest Member: areen
Teamspeak 3
Last Seen Users
· Intruder07:02:02
· WEZ20:35:27
· Homi 3 days
· GONZO 5 days
· Sully 5 days
· ozzy-ita 1 week
· areen 2 weeks
· The ACE 2 weeks
· Bonnfreddy 2 weeks
· hackepter 2 weeks
· Terminator 3 weeks
· Silent Bob 3 weeks
· Highl@nder 5 weeks
· Jardacz 5 weeks
· desintegrator 5 weeks

View Thread: Gamemodes help!
Vietcong.Info » Vietcong General Discussion » Vietcong Tech Talk
Who is here? 1 Guest
Current Rating: (Total: 0 ratings)  
 Print Thread
Gamemodes help!
Kermit
I would like to use the radio gamemode in my maps,
but it has not been tested a lot and there seemed to be some lag problems. (don't know if it was the server, script etc., as I said it wasn't tested a lot...)
Sometimes people heard different music (they did hear us or vc music, just not the same random song).
Maybe some of you can check out the script.

it's called latin/pimp because it was intended for pimpcong..
you can test it in niogianh1.2 otherwise you'll need to pack musicfiles(+xsound and musicfile.txt) and the textmessages with your map.
there is a warm-up mode when you restartmap because sometimes playing the music would fail after restarting.

the idea is, there is one radio somewhere on the map, you have to stand close and it'll become vc or us and play a us or vc song for 2 min. You'll have to hold the radio for that long otherwise the other team plays their music etc. So the points can take very long, and playing with music on certainly gives a boost to the gameplay. It would be nice to get this mode working....

EDIT: I included two other modes from niogianh1.2 as well
If I remember well, the swapmode sometimes swapped a whole team after a round, before swapping the right ones etc. but this mode was not tested with more then 3 people as well....

script:
Spoiler:
radio1.c script:

#include <inc\sc_MPglobal.h>
#include <inc\sc_global.h>
#include <inc\sc_def.h>



//Stel hier dingen in!!

#define IMTESTING FALSE //TRUE als je in je eentje vlagge wil kunnen stelen, anders FALSE (duh)

#define DISTANCETOFLAG 3.0f //je moet binnen deze afstand tot de vlag/sprayplek zijn om te sprayen //tijd die nodig is om te sprayen voordat vlag/sprayplek is veroverd

#define AANTALMUZIEKJES 1

#define PIMPMUSIC1 49
#define PIMPMUSIC2 86
#define PIMPMUSIC3 87
#define PIMPMUSIC4 88
#define PIMPMUSIC5 89
#define PIMPMUSIC6 90

#define LATINMUSIC1 33
#define LATINMUSIC2 81
#define LATINMUSIC3 82
#define LATINMUSIC4 83
#define LATINMUSIC5 84
#define LATINMUSIC6 91

//Tot hier!!


#define NORECOV_TIME 8.0f // disable time of recoverplace after recovering someone there


#define REC_WPNAME_US "USSpawn_rw_%d"
#define REC_WPNAME_VC "VCSpawn_rw_%d"
#define REC_MAX 64

#define FLAG_US 0
#define FLAG_VC 1
#define FLAG_NEUTRAL 2


#define PHASE_NONE 0
#define PHASE_RUNS 1
#define PHASE_USWIN 2
#define PHASE_VCWIN 3
#define PHASE_NEUTRAL 4

#define GVAR_SIDE0POINTS 500
#define GVAR_SIDE1POINTS 501

#define GVAR_FLAGSTATUS 510
#define GVAR_PHASE 520
#define GVAR_INFO 530
#define GVAR_INFOPLHANDLE 540
#define GVAR_MUSIC 550
#define GVAR_OTIME 551
#define GVAR_WARMUP 552

#define TOWIN_OCCUPY_TIME 60.0f//5.0f

#define INFO_FL_NONE 0
#define INFO_FL_CAPT_US 1
#define INFO_FL_CAPT_VC 2

BOOL gestopt = FALSE;
dword warmupround = 0;
BOOL gespeeld = FALSE;

dword gInfo = INFO_FL_NONE;
dword gSend_Info;
dword gCLN_Info;

dword gInfoPlHandle = 0;
dword gSend_InfoPlHandle;
dword gCLN_InfoPlHandle;


float gCLN_HelpInfo_timer = 0.0f;
ushort gCLN_HelpInfo[256];

float gMission_afterstart_time = 0.0f;

float gMission_starting_timer = 0.0f;

dword gRecs[2] = {0,0};
s_SC_MP_Recover gRec[2][REC_MAX];
float gRecTimer[2][REC_MAX];


//dword gRecsFl;
//s_SC_MP_Recover gRecFl[REC_MAX];
//float gRecTimerFl[REC_MAX];

#if _GE_VERSION_ >= 138
dword g_FPV_UsFlag = 0;
dword g_FPV_VcFlag = 0;
dword g_FPV_NeFlag = 0;
#endif


float gNextRecover = 0.0f;

int gSidePoints[2] = {0,0};

int gCLN_SidePoints[2];

dword gPhase = PHASE_NONE;
float gPhaseTime = 0.0f;

dword gEndRule;
dword gEndValue;
float gTime;

float gOccupyTime = TOWIN_OCCUPY_TIME;


dword gRespawn_id = SC_MP_RESPAWN_WA;

dword gMusic;

BOOL SRV_CheckEndRule(float time){

switch(gEndRule){
case SC_MP_ENDRULE_TIME:

if (gPhase!=PHASE_NONE) gTime += time;
SC_MP_EndRule_SetTimeLeft(gTime,gPhase!=PHASE_NONE);

if (gTime>gEndValue){
SC_MP_LoadNextMap();
return TRUE;
}

break;

case SC_MP_ENDRULE_POINTS:

if ((gSidePoints[0]>=gEndValue)||(gSidePoints[1]>=gEndValue)){
SC_MP_LoadNextMap();
return TRUE;
}

break;

default:
SC_message("EndRule unsopported: %d",gEndRule);
break;

}// switch(gEndRule)

return FALSE;

}// void SRV_CheckEndRule(float time)


void setTowinOccupyTime(void) {
gOccupyTime = 75;
}



float GetRecovTime(void){
float val;
s_SC_MP_SRV_AtgSettings set;

SC_MP_SRV_GetAtgSettings(&set);

if (set.ctf_respawntime>1.0f){
return set.ctf_respawntime;
}

val = SC_ggf(400);
if (val==0) val = 30;
return val;
}

float GetRecovLimitTime(void){
float val;
s_SC_MP_SRV_AtgSettings set;

SC_MP_SRV_GetAtgSettings(&set);

if (set.ctf_respawntime>1.0f){
return set.ctf_respawntime / 4.0f;
}

val = SC_ggf(401);
if (val==0){
val = GetRecovTime()/4.0f;
}

return val;
}


void UpdateSidePoints(void){
SC_sgi(GVAR_SIDE0POINTS,gSidePoints[0]);
SC_sgi(GVAR_SIDE1POINTS,gSidePoints[1]);
}// void UpdateSidePoints(void)


//void *gFlagNod;
//dword gFlagIndex;
c_Vector3 gOrigFlagPos;
dword gFlagPhase = FLAG_NEUTRAL; // FLAG_PH_


dword gSend_FlagPhase;

dword gCLN_FlagPhase;

//dword gFlags = 0;

dword gSend_Music = 0;

dword gSend_OccupyTime = 0;

dword gSend_warmup = 0;


void SRV_ChechSendStatus(void){
dword i;

if (gFlagPhase!=gSend_FlagPhase){
gSend_FlagPhase = gFlagPhase;
SC_sgi(GVAR_FLAGSTATUS,gSend_FlagPhase);
}

if (gSend_Info!=gInfo){
gSend_Info = gInfo;
SC_sgi(GVAR_INFO,gSend_Info);
}// if (gInfo[i]!=gSend_Info[i])

if (gSend_InfoPlHandle!=gInfoPlHandle){
gSend_InfoPlHandle = gInfoPlHandle;
SC_sgi(GVAR_INFOPLHANDLE,gSend_InfoPlHandle);
}// if (gInfo[i]!=gSend_Info[i])

if (gSend_Music!=gMusic){
gSend_Music = gMusic;
SC_sgi(GVAR_MUSIC,gSend_Music);
}// if

if (gSend_OccupyTime!=gOccupyTime){
gSend_OccupyTime = gOccupyTime;
SC_sgi(GVAR_OTIME,gSend_OccupyTime);
}// if

if (gSend_warmup!=warmupround){
gSend_warmup = warmupround;
SC_sgi(GVAR_WARMUP,gSend_warmup);
}// if


}// void SRV_ChechSendStatus(void)



void ResetMission(void){
//dword i;

gFlagPhase = FLAG_NEUTRAL;
gInfo = INFO_FL_NONE;
gInfoPlHandle = 0;

}// void ResetMission(void)



void Check_ABL(dword pl_handle){
int val;
dword to_change;
s_SC_P_getinfo info;

if (!SC_MP_SRV_GetAutoTeamBalance()) return;

val = SC_MP_SRV_GetTeamsNrDifference(TRUE);

if ((val<3)&&(val>-3)) return; // no big difference

SC_P_GetInfo(pl_handle,&info);

if ((info.side==0)&&(val>0)) to_change = 1;
else
if ((info.side==1)&&(val<0)) to_change = 0;
else
return;

SC_MP_SRV_P_SetSideClass(pl_handle,to_change,1 + 20*to_change);

}// void Check_ABL(dword pl_handle)


void stopMusic(dword side) {
switch(side)
{
case 0:
SC_SND_MusicStop(PIMPMUSIC1);
SC_SND_MusicStop(PIMPMUSIC2);
SC_SND_MusicStop(PIMPMUSIC3);
SC_SND_MusicStop(PIMPMUSIC4);
SC_SND_MusicStop(PIMPMUSIC5);
SC_SND_MusicStop(PIMPMUSIC6);
break;
case 1:
SC_SND_MusicStop(LATINMUSIC1);
SC_SND_MusicStop(LATINMUSIC2);
SC_SND_MusicStop(LATINMUSIC3);
SC_SND_MusicStop(LATINMUSIC4);
SC_SND_MusicStop(LATINMUSIC5);
SC_SND_MusicStop(LATINMUSIC6);
break;
}
//SC_SND_MusicPlay(0, 0);
//SC_SND_MusicStop(0);
}


void playMusic(dword side) {
dword nummer = SC_ggi(GVAR_MUSIC);
switch(side)
{
case 0:
stopMusic(1);
switch(nummer)
{
case 1:
SC_SND_MusicPlay(PIMPMUSIC1, 100);
break;
case 2:
SC_SND_MusicPlay(PIMPMUSIC2, 100);
break;
case 3:
SC_SND_MusicPlay(PIMPMUSIC3, 100);
break;
case 4:
SC_SND_MusicPlay(PIMPMUSIC4, 100);
break;
case 5:
SC_SND_MusicPlay(PIMPMUSIC5, 100);
break;
case 6:
SC_SND_MusicPlay(PIMPMUSIC6, 100);
break;
}
break;
case 1:
stopMusic(0);
switch(nummer)
{
case 1:
SC_SND_MusicPlay(LATINMUSIC1, 100);
break;
case 2:
SC_SND_MusicPlay(LATINMUSIC2, 100);
break;
case 3:
SC_SND_MusicPlay(LATINMUSIC3, 100);
break;
case 4:
SC_SND_MusicPlay(LATINMUSIC4, 100);
break;
case 5:
SC_SND_MusicPlay(LATINMUSIC5, 100);
break;
case 6:
SC_SND_MusicPlay(LATINMUSIC6, 100);
break;
}
break;
}
}




int ScriptMain(s_SC_NET_info *info){
char txt[128],*itxt;
ushort wtxt[128],wtxt2[64],*iwtxt;
dword i,j,pl_id,k,txt_id,middle;
s_SC_MP_Recover *precov;
s_SC_MP_hud hudinfo;
s_SC_P_getinfo plinfo;
void *nod;
c_Vector3 vec,vec2,pos;
BOOL valid;
float pl_dist,yres;
s_SC_HUD_MP_icon icon[2];
s_SC_MP_EnumPlayers enum_pl[64];
BOOL side[2];
s_SC_MP_SRV_settings SRVset;
dword index_rec[2];
#if _GE_VERSION_ >= 138
s_SC_FpvMapSign fpv_list[1];
#endif

switch(info->message){

case SC_NET_MES_SERVER_TICK:

if (SRV_CheckEndRule(info->elapsed_time)) break;


side[0] = side[1] = IMTESTING;//FALSE;
j = 64;

if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL)){


if ((j==0)&&((gSidePoints[0]+gSidePoints[1])!=0)){
gSidePoints[0] = 0;
gSidePoints[1] = 0;
UpdateSidePoints();
}// if ((side[0]+side[1])==0)

for (i=0;i<j;i++)
if (enum_pl[i].status!=SC_MP_P_STATUS_NOTINGAME){

if (enum_pl[i].side<2) side[enum_pl[i].side] = TRUE;

}// if (enum_pl[i].status==SC_MP_P_STATUS_INGAME)

gMission_starting_timer -= info->elapsed_time;

if ((side[0])&&(side[1])){

SC_MP_SetInstantRecovery(FALSE);

if ((gPhase==PHASE_NONE)&&(gPhaseTime>2.0f)){
gPhase = PHASE_RUNS;
gMission_afterstart_time = 0.0f;
SC_sgi(GVAR_PHASE,gPhase);

if (gPhaseTime>5.0f){
SC_MP_SRV_InitGameAfterInactive();
ResetMission();
SC_MP_RecoverAllNoAiPlayers();
}
gMission_starting_timer = 8.0f;
}
}// if ((side[0])&&(side[1]))
else{

if (gMission_starting_timer<=0.0f){

SC_MP_SetInstantRecovery(TRUE);

if (gPhase==PHASE_RUNS){
gPhase = PHASE_NONE;
gMission_afterstart_time = 0.0f;
SC_sgi(GVAR_PHASE,gPhase);
ResetMission();
}

}

}// else if ((side[0])&&(side[1]))

}// if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL))



for (j=0;j<2;j++)
for (i=0;i<gRecs[j];i++)
gRecTimer[j][i] -= info->elapsed_time;

//for (i=0;i<gRecsFl;i++)
// gRecTimerFl[i] -= info->elapsed_time;

gNextRecover -= info->elapsed_time;
if (gNextRecover<0.0f) gNextRecover = GetRecovTime();

switch(gPhase){

case PHASE_NONE:
gPhaseTime += info->elapsed_time;
break;

case PHASE_RUNS:

vec = gOrigFlagPos;

gMission_afterstart_time += info->elapsed_time;

if (warmupround==1){

if (gMission_afterstart_time>10.0f){

j = SC_GetNearestPlayer(&vec,&pl_dist);

if ((j)&&(pl_dist<DISTANCETOFLAG)){

SC_P_GetInfo(j,&plinfo);

if ((plinfo.side!=gFlagPhase)) {
gFlagPhase = plinfo.side;
gInfoPlHandle = SC_MP_GetHandleofPl(j);
switch(plinfo.side){
case 0:
gInfo = INFO_FL_CAPT_US;
gOccupyTime = 0.0f;//TOWIN_OCCUPY_TIME;
break;
case 1:
gInfo = INFO_FL_CAPT_VC;
gOccupyTime = 0.0f;//TOWIN_OCCUPY_TIME;
break;
}// switch(plinfo.side)
gMusic = (rand()%AANTALMUZIEKJES)+1;
}// if (plinfo.side!=gFlagPhase[i])

}// if ((j)&&(pl_dist<1.0f))

}// if (valid)


if (gFlagPhase!=FLAG_NEUTRAL){

gOccupyTime -= info->elapsed_time;

if (gOccupyTime<=0.0f){

switch(gFlagPhase){
case FLAG_US:
gPhase = PHASE_USWIN;
gPhaseTime = 5.0f;
SC_sgi(GVAR_PHASE,gPhase);
warmupround = 0;
break;
case FLAG_VC:
gPhase = PHASE_VCWIN;
gPhaseTime = 5.0f;
SC_sgi(GVAR_PHASE,gPhase);
warmupround = 0;
break;
}// switch(j)

}// gOccupyTime

}// if (i==gFlags)
else gOccupyTime = 0.0f;//TOWIN_OCCUPY_TIME;

} else {

if (gMission_afterstart_time>10.0f){

j = SC_GetNearestPlayer(&vec,&pl_dist);

if ((j)&&(pl_dist<DISTANCETOFLAG)){

SC_P_GetInfo(j,&plinfo);

if ((plinfo.side!=gFlagPhase)) {
gFlagPhase = plinfo.side;
gInfoPlHandle = SC_MP_GetHandleofPl(j);
switch(plinfo.side){
case 0:
gInfo = INFO_FL_CAPT_US;
setTowinOccupyTime();//TOWIN_OCCUPY_TIME;
break;
case 1:
gInfo = INFO_FL_CAPT_VC;
setTowinOccupyTime();//TOWIN_OCCUPY_TIME;
break;
}// switch(plinfo.side)
gMusic = (rand()%AANTALMUZIEKJES)+1;
}// if (plinfo.side!=gFlagPhase[i])

}// if ((j)&&(pl_dist<1.0f))

}// if (valid)


if (gFlagPhase!=FLAG_NEUTRAL){

gOccupyTime -= info->elapsed_time;

if (gOccupyTime<=0.0f){

switch(gFlagPhase){
case FLAG_US:
gSidePoints[0]++;
UpdateSidePoints();

gPhase = PHASE_USWIN;
gPhaseTime = 10.0f;
SC_sgi(GVAR_PHASE,gPhase);
break;
case FLAG_VC:
gSidePoints[1]++;
UpdateSidePoints();

gPhase = PHASE_VCWIN;
gPhaseTime = 10.0f;
SC_sgi(GVAR_PHASE,gPhase);
break;
}// switch(j)

}// gOccupyTime

}// if (i==gFlags)
else setTowinOccupyTime();//TOWIN_OCCUPY_TIME;
}
break;

case PHASE_USWIN:
case PHASE_VCWIN:

gPhaseTime -= info->elapsed_time;

if (gPhaseTime<=0.0f){

gPhase = PHASE_NONE;
gPhaseTime = 0.0f;
SC_sgi(GVAR_PHASE,gPhase);

ResetMission();
SC_MP_RestartMission();

}// if (gPhaseTime<=0.0f)

break;

}// switch(gPhase)


SRV_ChechSendStatus();

break;

case SC_NET_MES_MESSAGE:
break;

case SC_NET_MES_CLIENT_TICK:

if (SC_ggi(GVAR_WARMUP)==1) {
if (SC_P_IsReady(SC_PC_Get())){
switch(SC_P_GetCurWeap(SC_PC_Get()))
{
case 7:
case 8:
case 9:
case 10:
case 22:
break;
default:
SC_P_SetSelWeapon(SC_PC_Get(), 1);
break;
}
}
}

if (gCLN_HelpInfo_timer>0.0f){
gCLN_HelpInfo_timer -= info->elapsed_time;
}

pl_id = SC_PC_Get();

for (i=0;i<2;i++){

gCLN_SidePoints[i] = SC_ggi(GVAR_SIDE0POINTS+i);
SC_MP_SetSideStats(i,0,gCLN_SidePoints[i]);

}// for (i=0;i<2;i++)


gCLN_FlagPhase = SC_ggi(GVAR_FLAGSTATUS);

switch(SC_ggi(GVAR_PHASE)){
case PHASE_NONE:
case PHASE_USWIN:
stopMusic(0);
stopMusic(1);
if (!gespeeld){
//SC_SND_PlaySound2D(5117);
gespeeld = TRUE;
}
break;
case PHASE_VCWIN:
stopMusic(0);
stopMusic(1);
if (!gespeeld){
SC_SND_PlaySound2D(5119);
gespeeld = TRUE;
}
break;
case PHASE_RUNS:
if (gespeeld) {
gespeeld = FALSE;
}
if (!gestopt) {
//if (gCLN_FlagPhase == FLAG_NEUTRAL) {
stopMusic(0);
stopMusic(1);
gestopt = TRUE;
//SC_SND_MusicPlay(13, 100);
//}
}
/*if (SC_ggi(GVAR_MTIME) > 3) {
SC_SND_MusicStop(13);
}*/
break;
}// switch(SC_ggi(GVAR_PHASE))

fpv_list[0].color = 0xffffffff;
fpv_list[0].pos = gOrigFlagPos;
fpv_list[0].scale = 1.0f;

icon[0].color = 0xffffffff;
icon[0].type = SC_HUD_MP_ICON_TYPE_NONE;


icon[1].color = 0xbbffffff;
icon[1].icon_id = 6;
icon[1].value = (int)(SC_ggi(GVAR_OTIME));//(int)(gOccupyTime);
icon[1].type = SC_HUD_MP_ICON_TYPE_TIME;


switch(gCLN_FlagPhase){

case FLAG_US:
fpv_list[0].id = g_FPV_UsFlag;
icon[0].icon_id = 0;
break;

case FLAG_VC:
fpv_list[0].id = g_FPV_VcFlag;
icon[0].icon_id = 3;
break;

case FLAG_NEUTRAL:
fpv_list[0].id = g_FPV_NeFlag;
icon[0].icon_id = 12;
break;
}


j = SC_ggi(GVAR_INFO);
if (j!=gCLN_Info){
gCLN_Info = j;
gCLN_InfoPlHandle = SC_ggi(GVAR_INFOPLHANDLE);

pl_id = SC_MP_GetPlofHandle(gCLN_InfoPlHandle);


switch(j){

case INFO_FL_CAPT_US:
if (pl_id){
swprintf(gCLN_HelpInfo,SC_Wtxt(5121),SC_P_GetName(pl_id),SC_Wtxt(5118));
gCLN_HelpInfo_timer = 10.0f;
}
playMusic(0);
break;
case INFO_FL_CAPT_VC:
if (pl_id){
swprintf(gCLN_HelpInfo,SC_Wtxt(5121),SC_P_GetName(pl_id),SC_Wtxt(5117));
gCLN_HelpInfo_timer = 10.0f;
}
playMusic(1);
break;

}// switch(j)


}// if (j!=gCLNd_Info[i])




if (gCLN_FlagPhase!=FLAG_NEUTRAL) {
SC_MP_SetIconHUD(icon,2);
}
else {
SC_MP_SetIconHUD(icon,1);
}

SC_MP_FpvMapSign_Set(1,fpv_list);

break;// SC_NET_MES_CLIENT_TICK


case SC_NET_MES_LEVELPREINIT:
SC_sgi(GVAR_MP_MISSIONTYPE,GVAR_MP_MISSIONTYPE_RW);

gEndRule = info->param1;
gEndValue = info->param2;
gTime = 0.0f;

SC_MP_EnableC4weapon(FALSE);

SC_MP_EnableBotsFromScene(FALSE);

break;// SC_NET_MES_LEVELPREINIT

case SC_NET_MES_LEVELINIT:

#if _GE_VERSION_ >= 138
g_FPV_UsFlag = SC_MP_FpvMapSign_Load("g\\weapons\\Vvh_map\\icons\\MPIC_USflag.BES");
g_FPV_VcFlag = SC_MP_FpvMapSign_Load("g\\weapons\\Vvh_map\\icons\\MPIC_VCflag.BES");
g_FPV_NeFlag = SC_MP_FpvMapSign_Load("g\\weapons\\Vvh_map\\icons\\MPIC_emptyflag.BES");
#endif


SC_MP_SRV_SetForceSide(0xffffffff);
SC_MP_SetChooseValidSides(3);

SC_MP_SRV_SetClassLimit(18,0);
SC_MP_SRV_SetClassLimit(19,0);
SC_MP_SRV_SetClassLimit(39,0);

SC_MP_GetSRVsettings(&SRVset);

for (i=0;i<6;i++){
SC_MP_SRV_SetClassLimit(i+1,SRVset.atg_class_limit[i]);
SC_MP_SRV_SetClassLimit(i+21,SRVset.atg_class_limit[i]);
}// for (i)


CLEAR(hudinfo);
hudinfo.title = 5119;

hudinfo.sort_by[0] = SC_HUD_MP_SORTBY_KILLS;
hudinfo.sort_by[1] = SC_HUD_MP_SORTBY_DEATHS | SC_HUD_MP_SORT_DOWNUP;
hudinfo.sort_by[2] = SC_HUD_MP_SORTBY_PINGS | SC_HUD_MP_SORT_DOWNUP;

hudinfo.pl_mask = SC_HUD_MP_PL_MASK_CLASS | SC_HUD_MP_PL_MASK_KILLS | SC_HUD_MP_PL_MASK_DEATHS;
hudinfo.use_sides = TRUE;
hudinfo.side_name[0] = 5118;
hudinfo.side_color[0] = 0x440000ff;
hudinfo.side_name[1] = 5117;
hudinfo.side_color[1] = 0x44ff0000;

hudinfo.side_mask = SC_HUD_MP_SIDE_MASK_POINTS;

SC_MP_HUD_SetTabInfo(&hudinfo);

SC_MP_AllowStPwD(TRUE);
SC_MP_AllowFriendlyFireOFF(TRUE);

SC_MP_SetItemsNoDisappear(FALSE);

gPhase = PHASE_NONE;

if (info->param2){

// preload flag items
//SC_Item_Preload(145);
//SC_Item_Preload(146);


//gFlags = 0;

nod = SC_NOD_GetNoMessage(NULL,"radio");
if (nod){
SC_NOD_GetWorldPos(nod,&gOrigFlagPos);

}// if (nod)
else {
SC_message("Radio not found");
}



if (info->param1){
// it's server

SC_MP_Gvar_SetSynchro(GVAR_SIDE0POINTS);
SC_MP_Gvar_SetSynchro(GVAR_SIDE1POINTS);
UpdateSidePoints();

SC_MP_Gvar_SetSynchro(GVAR_PHASE);
SC_sgi(GVAR_PHASE,0);

SC_MP_Gvar_SetSynchro(GVAR_FLAGSTATUS);
SC_sgi(GVAR_FLAGSTATUS,FLAG_NEUTRAL);

SC_MP_Gvar_SetSynchro(GVAR_INFO);
SC_sgi(GVAR_INFO,INFO_FL_NONE);

SC_MP_Gvar_SetSynchro(GVAR_INFOPLHANDLE);
SC_sgi(GVAR_INFOPLHANDLE,0);

SC_MP_Gvar_SetSynchro(GVAR_MUSIC);
SC_sgi(GVAR_MUSIC,0);

SC_MP_Gvar_SetSynchro(GVAR_OTIME);
SC_sgi(GVAR_OTIME,0);

SC_MP_Gvar_SetSynchro(GVAR_WARMUP);
SC_sgi(GVAR_WARMUP,0);


// recovers for sides

CLEAR(gRecs);

for (i=0;i<REC_MAX;i++){
sprintf(txt,REC_WPNAME_US,i);
if (SC_NET_FillRecover(&gRec[0][gRecs[0]],txt)) gRecs[0]++;
}

#if _GE_VERSION_ >= 133
i = REC_MAX - gRecs[0];
SC_MP_GetRecovers(SC_MP_RESPAWN_RW_US,&gRec[0][gRecs[0]],&i);
gRecs[0] += i;
#endif

SC_Log(3,"RW respawns us: %d",gRecs[0]);


if (gRecs[0]==0) SC_message("no US recover place defined!");

for (i=0;i<REC_MAX;i++){
sprintf(txt,REC_WPNAME_VC,i);
if (SC_NET_FillRecover(&gRec[1][gRecs[1]],txt)) gRecs[1]++;
}

#if _GE_VERSION_ >= 133
i = REC_MAX - gRecs[1];
SC_MP_GetRecovers(SC_MP_RESPAWN_RW_VC,&gRec[1][gRecs[1]],&i);
gRecs[1] += i;
#endif

SC_Log(3,"RW respawns vc: %d",gRecs[1]);


if (gRecs[1]==0) SC_message("no VC recover place defined!");

CLEAR(gRecTimer);

}// if (info->param1)

}//if (info->param2)


break;// SC_NET_MES_LEVELINIT


case SC_NET_MES_RENDERHUD:

txt_id = 0;

switch(SC_ggi(GVAR_PHASE)){

case PHASE_NONE:
middle = 0;
txt_id = 101;
break;

case PHASE_USWIN:
middle = 1;
txt_id = 5116;
break;

case PHASE_VCWIN:
middle = 1;
txt_id = 5115;
break;
}// switch(SC_ggi(GVAR_PHASE))



if ((txt_id)||(gCLN_HelpInfo_timer>0.0f)){

SC_GetScreenRes(&pl_dist,&yres);

/*if (gCLN_HelpInfo_timer<=0.0f)
iwtxt = SC_Wtxt(txt_id);
else{
//middle = 1;//0;
iwtxt = gCLN_HelpInfo;
}*/
if (txt_id){
iwtxt = SC_Wtxt(txt_id);
} else {
iwtxt = gCLN_HelpInfo;
}

pl_dist -= SC_Fnt_GetWidthW(iwtxt,1);

if (middle) yres = yres * 0.45f;
else yres = 15;

SC_Fnt_WriteW(pl_dist * 0.5f,yres,iwtxt,1,0xffffffff);

}// itxt

if (SC_ggi(GVAR_WARMUP)==1){
SC_GetScreenRes(&pl_dist,&yres);
iwtxt = SC_Wtxt(5114);
pl_dist -= SC_Fnt_GetWidthW(iwtxt,2);
SC_Fnt_WriteW(pl_dist * 0.5f,yres * 0.7f,iwtxt,2,0xffffffff);
}

break;

case SC_NET_MES_SERVER_RECOVER_TIME:

if (info->param2){
info->fval1 = 0.1f;
}
else{
// killed
switch(gPhase){
case PHASE_NONE:
info->fval1 = 3.0f;
break;
case PHASE_RUNS:
if (gNextRecover>GetRecovLimitTime()) info->fval1 = gNextRecover;
else info->fval1 = gNextRecover + GetRecovTime();
break;
default:
info->fval1 = -1.0f;
break;
}// switch(gPhase)


}

break;

case SC_NET_MES_SERVER_RECOVER_PLACE:

precov = (s_SC_MP_Recover*)info->param2;

// side recover
i = SC_MP_SRV_GetBestDMrecov(gRec[info->param1],gRecs[info->param1],gRecTimer[info->param1],NORECOV_TIME);
gRecTimer[info->param1][i] = NORECOV_TIME;
*precov = gRec[info->param1][i];

break;


case SC_NET_MES_SERVER_KILL:

Check_ABL(info->param1);

break;// SC_NET_MES_SERVER_KILL

case SC_NET_MES_RESTARTMAP:

gestopt = FALSE;
warmupround = 1;
gespeeld = FALSE;

CLEAR(gInfo);
CLEAR(gSend_Info);

gMission_afterstart_time = 0.0f;
gMission_starting_timer = 0.0f;

//CLEAR(gRecTimerFl);
CLEAR(gRecTimer);

gNextRecover = 0.0f;

CLEAR(gSidePoints);
UpdateSidePoints();

gPhase = PHASE_NONE;
gPhaseTime = 10.0f;

gTime = 0;

setTowinOccupyTime();//TOWIN_OCCUPY_TIME;

gFlagPhase = FLAG_NEUTRAL;
gSend_FlagPhase = 99;

gSend_Music = 99;
gSend_OccupyTime = 99;
gSend_warmup = 99;

SC_MP_SetInstantRecovery(TRUE);

SC_MP_SRV_ClearPlsStats();

SC_MP_SRV_InitGameAfterInactive();
SC_MP_RecoverAllNoAiPlayers();

break;// SC_NET_MES_RESTARTMAP

case SC_NET_MES_RULESCHANGED:
gEndRule = info->param1;
gEndValue = info->param2;
gTime = 0.0f;
break;

}// switch(info->message)


return 1;

}// int ScriptMain(void)




----------------------------------------------------------------------------------------------------------
this is tdm, but with spawnsets that change from time to time/deaths

newtdm.c
Spoiler:
/*
Eric multiplayer script - CTF
*/

#include <inc\sc_global.h>
#include <inc\sc_def.h>


#define NORECOV_TIME 3.0f // disable time of recoverplace after recovering someone there

#define STEP_MAX 6 // maximum recoverplace couples
#define REC_MAX 32 // maximum of recovers on one recoverplace

#define STEP_TIME 120.0f // time before spawns change
#define MAX_KILLS 20 // number of kills before spawns change


#define GVAR_SIDE0FRAGS 500
#define GVAR_SIDE1FRAGS 501

#define GVAR_CURSTEP 502
#define GVAR_STEPS 503

#define GVAR_GAMERUNS 504



BOOL gMission_started = FALSE;
float gMission_afterstart_time = 0.0f;

float gStepTime = 0.0f;
dword gKills = 0;

float gMission_starting_timer = 0.0f;
dword gSteps = 0; // number of couples
dword gCurStep = 0;
dword gRecs[2][STEP_MAX]; // 0-US, 1-VC
s_SC_MP_Recover gRec[2][STEP_MAX][REC_MAX];
float gRecTimer[2][STEP_MAX][REC_MAX];

float gNextRecover = 0.0f;

int gSideFrags[2] = {0,0};

int gCLN_SideFrags[2];

dword gEndRule;
dword gEndValue;
float gTime;

dword abl_lists = 0;
dword abl_list[64];


#if _GE_VERSION_ >= 133
dword gRespawn_id[2][STEP_MAX] = {
{0,SC_MP_RESPAWN_TT_ATT_1,SC_MP_RESPAWN_TT_ATT_2,SC_MP_RESPAWN_TT_ATT_3,SC_MP_RESPAWN_TT_ATT_4,SC_MP_RESPAWN_TT_ATT_5},
{SC_MP_RESPAWN_TT_DEF_0,SC_MP_RESPAWN_TT_DEF_1,SC_MP_RESPAWN_TT_DEF_2,SC_MP_RESPAWN_TT_DEF_3,SC_MP_RESPAWN_TT_DEF_4,0}
};
#endif


BOOL SRV_CheckEndRule(float time){

switch(gEndRule){
case SC_MP_ENDRULE_TIME:

if (gMission_started) gTime += time;
SC_MP_EndRule_SetTimeLeft(gTime,gMission_started);

if (gTime>gEndValue){
SC_MP_LoadNextMap();
return TRUE;
}

break;

case SC_MP_ENDRULE_FRAGS:

if (((gSideFrags[0]>0)&&(gSideFrags[0]>=gEndValue))
||((gSideFrags[1]>1)&&(gSideFrags[1]>=gEndValue))){
SC_MP_LoadNextMap();
return TRUE;
}

break;

default:
SC_message("EndRule unsopported: %d",gEndRule);
break;

}// switch(gEndRule)

return FALSE;

}// void SRV_CheckEndRule(float time)


float GetRecovTime(void){
float val;
s_SC_MP_SRV_AtgSettings set;

SC_MP_SRV_GetAtgSettings(&set);

if (set.ctf_respawntime>1.0f){
return set.ctf_respawntime;
}

val = SC_ggf(400);
if (val==0) val = 30;
return val;
}

float GetRecovLimitTime(void){
float val;
s_SC_MP_SRV_AtgSettings set;

SC_MP_SRV_GetAtgSettings(&set);

if (set.ctf_respawntime>1.0f){
return set.ctf_respawntime / 4.0f;
}

val = SC_ggf(401);
if (val==0){
val = GetRecovTime()/4.0f;
}

return val;
}

void UpdateSideFrags(void){
SC_sgi(GVAR_SIDE0FRAGS,gSideFrags[0]);
SC_sgi(GVAR_SIDE1FRAGS,gSideFrags[1]);
}


void Check_ABL(dword pl_handle){
int val;
dword to_change;
s_SC_P_getinfo info;

if (!SC_MP_SRV_GetAutoTeamBalance()) return;

val = SC_MP_SRV_GetTeamsNrDifference(TRUE);

if ((val<3)&&(val>-3)) return; // no big difference

SC_P_GetInfo(pl_handle,&info);

if ((info.side==0)&&(val>0)) to_change = 1;
else
if ((info.side==1)&&(val<0)) to_change = 0;
else
return;

SC_MP_SRV_P_SetSideClass(pl_handle,to_change,1 + 20*to_change);

if (abl_lists<64){
abl_list[abl_lists] = pl_handle;
abl_lists++;
}

}// void Check_ABL(dword pl_handle)


int ChangeStep(void){
int result = rand()%gSteps;
if(result == gCurStep){
return ChangeStep();
}
return result;
}


int ScriptMain(s_SC_NET_info *info){
char txt[128];
ushort *witxt;
dword i,j,k,pl_id,pl_val,sideA,sideB;
s_SC_MP_Recover *precov;
s_SC_MP_hud hudinfo;
s_SC_P_getinfo plinfo;
float pl_dist;
s_SC_HUD_MP_icon icon[2];
s_SC_MP_EnumPlayers enum_pl[64];
BOOL side[2];
s_SC_MP_SRV_settings SRVset;
char side_char;
float val,valy;


switch(info->message){

case SC_NET_MES_SERVER_TICK:

if (SRV_CheckEndRule(info->elapsed_time)) break;



side[0] = side[1] = FALSE;
j = 64;

if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL)){

if ((j==0)&&((gSideFrags[0]+gSideFrags[1])!=0)){
gSideFrags[0] = 0;
gSideFrags[1] = 0;
UpdateSideFrags();
}// if ((side[0]+side[1])==0)

for (i=0;i<j;i++)
if (enum_pl[i].status!=SC_MP_P_STATUS_NOTINGAME){

if (enum_pl[i].side<2) side[enum_pl[i].side] = TRUE;

}// if (enum_pl[i].status==SC_MP_P_STATUS_INGAME)

gMission_starting_timer -= info->elapsed_time;

if ((side[0])&&(side[1])){

SC_MP_SetInstantRecovery(FALSE);

if (!gMission_started){
gMission_started = TRUE;
gMission_afterstart_time = 0.0f;
SC_sgi(GVAR_GAMERUNS,gMission_started);

gCurStep = ChangeStep();
SC_sgi(GVAR_CURSTEP,gCurStep);

gStepTime = 0;
gKills = 0;

SC_MP_SRV_InitGameAfterInactive();
SC_MP_RecoverAllNoAiPlayers();
gMission_starting_timer = 8.0f;
}
}// if ((side[0])&&(side[1]))
else{

if (gMission_starting_timer<=0.0f){

SC_MP_SetInstantRecovery(TRUE);

if (gMission_started){
gMission_started = FALSE;
gMission_afterstart_time = 0.0f;
SC_sgi(GVAR_GAMERUNS,gMission_started);
gStepTime = 0;
gKills = 0;
}

}

}// else if ((side[0])&&(side[1]))

}// if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL))


gStepTime += info->elapsed_time;
if (gStepTime >= STEP_TIME || gKills >= MAX_KILLS){
gCurStep = ChangeStep();
SC_sgi(GVAR_CURSTEP,gCurStep);
gStepTime = 0;
gKills = 0;
}


// update timers for respawn points
for (i=0;i<2;i++)
for (j=0;j<gSteps;j++)
for (k=0;k<gRecs[i][j];k++)
gRecTimer[i][j][k] -= info->elapsed_time;


gNextRecover -= info->elapsed_time;
if (gNextRecover<0.0f) gNextRecover = GetRecovTime();

if (gMission_started){
gMission_afterstart_time += info->elapsed_time;
}// if (gMission_started)

break;

case SC_NET_MES_CLIENT_TICK:

gCLN_SideFrags[0] = SC_ggi(GVAR_SIDE0FRAGS);
gCLN_SideFrags[1] = SC_ggi(GVAR_SIDE1FRAGS);

SC_MP_SetSideStats(0,gCLN_SideFrags[0],0);
SC_MP_SetSideStats(1,gCLN_SideFrags[1],0);

for (i=0;i<2;i++){
icon[i].type = SC_HUD_MP_ICON_TYPE_NUMBER;
icon[i].icon_id = 3*i;
icon[i].value = gCLN_SideFrags[i];
icon[i].color = 0xffffffff;
}

SC_MP_SetIconHUD(icon,2);

break;// SC_NET_MES_CLIENT_TICK


case SC_NET_MES_LEVELPREINIT:
SC_sgi(GVAR_MP_MISSIONTYPE,GVAR_MP_MISSIONTYPE_TDM);

gEndRule = info->param1;
gEndValue = info->param2;
gTime = 0.0f;


SC_MP_EnableBotsFromScene(FALSE);

break;// SC_NET_MES_LEVELPREINIT

case SC_NET_MES_LEVELINIT:

SC_MP_SRV_SetForceSide(0xffffffff);
SC_MP_SetChooseValidSides(3);


SC_MP_SRV_SetClassLimit(18,0);
SC_MP_SRV_SetClassLimit(19,0);
SC_MP_SRV_SetClassLimit(39,0);

SC_MP_GetSRVsettings(&SRVset);

for (i=0;i<6;i++){
SC_MP_SRV_SetClassLimit(i+1,SRVset.atg_class_limit[i]);
SC_MP_SRV_SetClassLimit(i+21,SRVset.atg_class_limit[i]);
}// for (i)


CLEAR(hudinfo);
hudinfo.title = 1051;

hudinfo.sort_by[0] = SC_HUD_MP_SORTBY_FRAGS;
hudinfo.sort_by[1] = SC_HUD_MP_SORTBY_KILLS;
hudinfo.sort_by[2] = SC_HUD_MP_SORTBY_DEATHS | SC_HUD_MP_SORT_DOWNUP;
hudinfo.sort_by[3] = SC_HUD_MP_SORTBY_PINGS | SC_HUD_MP_SORT_DOWNUP;


hudinfo.pl_mask = SC_HUD_MP_PL_MASK_FRAGS | SC_HUD_MP_PL_MASK_KILLS | SC_HUD_MP_PL_MASK_DEATHS;
hudinfo.use_sides = TRUE;
hudinfo.side_name[0] = 1010;
hudinfo.side_color[0] = 0x443538b9;
hudinfo.side_name[1] = 1011;
hudinfo.side_color[1] = 0x44b93535;

hudinfo.side_mask = SC_HUD_MP_SIDE_MASK_FRAGS;


SC_MP_HUD_SetTabInfo(&hudinfo);

SC_MP_AllowStPwD(TRUE);
SC_MP_AllowFriendlyFireOFF(TRUE);

SC_MP_SetItemsNoDisappear(FALSE);

gMission_started = FALSE;

if (info->param2){

if (info->param1){
// it's server

SC_MP_Gvar_SetSynchro(GVAR_SIDE0FRAGS);
SC_MP_Gvar_SetSynchro(GVAR_SIDE1FRAGS);
UpdateSideFrags();

SC_MP_Gvar_SetSynchro(GVAR_CURSTEP);
SC_sgi(GVAR_CURSTEP,0);

SC_MP_Gvar_SetSynchro(GVAR_STEPS);

SC_MP_Gvar_SetSynchro(GVAR_GAMERUNS);
SC_sgi(GVAR_GAMERUNS,0);


CLEAR(gRecs);



for (k=0;k<2;k++){

if (k) side_char = 'V';
else side_char = 'U';

for (j=0;j<STEP_MAX;j++){

for (i=0;i<REC_MAX;i++){

sprintf(txt,"TDM_%c_%d_%d",side_char,j,i); //bv "TDM_U_0_0" voor de eerste spawn uit het eerste couple vd US

if (SC_NET_FillRecover(&gRec[k][j][gRecs[k][j]],txt)){
gRecs[k][j]++;
}
}//for (i) - for all recovers on current step


#if _GE_VERSION_ >= 133
if (gRespawn_id[k][j]){
i = REC_MAX - gRecs[k][j];
SC_MP_GetRecovers(gRespawn_id[k][j],&gRec[k][j][gRecs[k][j]],&i);
gRecs[k][j] += i;
}
#endif


}// for (j) - steps

}// for (k)

gSteps = 0;

for (i=0;i<STEP_MAX;i++)
if (gRecs[0][i]) gSteps = i+1;


for (i=0;i<gSteps;i++)
SC_message("TDM recovers #%d: US:%d VC:%d",i,gRecs[0][i],gRecs[1][i]);


CLEAR(gRecTimer);


SC_sgi(GVAR_STEPS,gSteps);
sprintf(txt,"gSteps: %d",gSteps);
SC_message(txt);

}// if (info->param1)

}//if (info->param2)


break;// SC_NET_MES_LEVELINIT


case SC_NET_MES_RENDERHUD:

witxt = NULL;

if (!SC_ggi(GVAR_GAMERUNS)){
witxt = SC_Wtxt(101);
}

if (witxt){

SC_GetScreenRes(&val,&valy);

val -= SC_Fnt_GetWidthW(witxt,1);
valy = 15;

SC_Fnt_WriteW(val * 0.5f,valy,witxt,1,0xffffffff);

}//if (i)

break;

case SC_NET_MES_SERVER_RECOVER_TIME:


if (info->param2){
info->fval1 = 0.1f;
}
else{
// killed
if (gMission_started){

for (i=0;i<abl_lists;i++)
if (info->param1==abl_list[i]){
abl_lists--;
abl_list[i] = abl_list[abl_lists];
break;
}

if (i<abl_lists){
info->fval1 = 0.1f;
}
else{
if (gNextRecover>GetRecovLimitTime()) info->fval1 = gNextRecover;
else info->fval1 = gNextRecover + GetRecovTime();
}
}
else info->fval1 = 3.0f;

}

break;

case SC_NET_MES_SERVER_RECOVER_PLACE:

precov = (s_SC_MP_Recover*)info->param2;

j = info->param1; // side

k = gCurStep;

i = SC_MP_SRV_GetBestDMrecov(gRec[j][k],gRecs[j][k],gRecTimer[j][k],NORECOV_TIME);

gRecTimer[j][k][i] = NORECOV_TIME;
*precov = gRec[j][k][i];

break;


case SC_NET_MES_SERVER_KILL:

gKills++;

SC_P_GetInfo(info->param1,&plinfo);
sideA = plinfo.side;

if (info->param2){
SC_P_GetInfo(info->param2,&plinfo);
sideB = plinfo.side;
}
else sideB = 0xffffffff;

if (sideA==sideB){
gSideFrags[sideB]--;
}
else{
if (sideB!=0xffffffff) gSideFrags[sideB]++;
}

UpdateSideFrags();

Check_ABL(info->param1);

break;// SC_NET_MES_SERVER_KILL

case SC_NET_MES_RESTARTMAP:

CLEAR(gSideFrags);
UpdateSideFrags();

gMission_afterstart_time = 0.0f;
gMission_starting_timer = 0.0f;

gStepTime = 0;
gKills = 0;

gTime = 0;

SC_MP_SetInstantRecovery(TRUE);

if (gMission_started){
gMission_started = FALSE;
SC_sgi(GVAR_GAMERUNS,gMission_started);
}

SC_MP_SRV_ClearPlsStats();

break;// SC_NET_MES_RESTARTMAP

case SC_NET_MES_RULESCHANGED:
gEndRule = info->param1;
gEndValue = info->param2;
gTime = 0.0f;
break;

}// switch(info->message)


return 1;

}// int ScriptMain(void)




-----------------------------------------------------


this is the same as above, but when you kill someone, he is swapped to your team.
newtdmswap4:
Spoiler:
/*
Eric multiplayer script - CTF
*/

#include <inc\sc_global.h>
#include <inc\sc_def.h>


#define NORECOV_TIME 3.0f // disable time of recoverplace after recovering someone there

#define STEP_MAX 6 // maximum recoverplace couples
#define REC_MAX 32 // maximum of recovers on one recoverplace

#define STEP_TIME 120.0f // time before spawns change
#define MAX_KILLS 20 // number of kills before spawns change

#define GVAR_GAMERUNS 504



BOOL gMission_started = FALSE;
float gMission_afterstart_time = 0.0f;

float starttimer = 0.0f;

float gStepTime = 0.0f;
dword gKills = 0;

float gMission_starting_timer = 0.0f;
dword gSteps = 0; // number of couples
dword gCurStep = 0;
dword gRecs[2][STEP_MAX]; // 0-US, 1-VC
s_SC_MP_Recover gRec[2][STEP_MAX][REC_MAX];
float gRecTimer[2][STEP_MAX][REC_MAX];

dword gEndRule;
dword gEndValue;
float gTime;


#if _GE_VERSION_ >= 133
dword gRespawn_id[2][STEP_MAX] = {
{0,SC_MP_RESPAWN_TT_ATT_1,SC_MP_RESPAWN_TT_ATT_2,SC_MP_RESPAWN_TT_ATT_3,SC_MP_RESPAWN_TT_ATT_4,SC_MP_RESPAWN_TT_ATT_5},
{SC_MP_RESPAWN_TT_DEF_0,SC_MP_RESPAWN_TT_DEF_1,SC_MP_RESPAWN_TT_DEF_2,SC_MP_RESPAWN_TT_DEF_3,SC_MP_RESPAWN_TT_DEF_4,0}
};
#endif


BOOL SRV_CheckEndRule(float time){

switch(gEndRule){
case SC_MP_ENDRULE_TIME:

if (gMission_started) gTime += time;
SC_MP_EndRule_SetTimeLeft(gTime,gMission_started);

if (gTime>gEndValue){
SC_MP_LoadNextMap();
return TRUE;
}

break;

default:
SC_message("EndRule unsopported: %d",gEndRule);
break;

}// switch(gEndRule)

return FALSE;

}// void SRV_CheckEndRule(float time)


int ChangeStep(void){
int result = rand()%gSteps;
if(result == gCurStep){
return ChangeStep();
}
return result;
}

void verdeelTeams(void){
char txt[128];
dword i;
dword team[2] = {0,0};
s_SC_MP_EnumPlayers enum_pl[64];
dword j = 64;

if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL)){
for (i=0;i<j;i++){
if(team[0]>team[1]){
if(enum_pl[i].side != 1){
dword recclass = SC_MP_P_GetAfterRecoverClass(enum_pl[i].id);
if(!(recclass >= 21&&recclass <=26)){
recclass += 20;
}
if(!(recclass >= 21&&recclass <=26)){
recclass = 21;
}
sprintf(txt,"teamverdeling\nspeler %d\nvan side %d naar 1\nvan class %d naar %d\nafter recover side %d\nafter recover class %d",
SC_MP_GetHandleofPl(enum_pl[i].id),
enum_pl[i].side,
SC_MP_P_GetClass(enum_pl[i].id),
recclass,
SC_MP_P_GetAfterRecoverSide(enum_pl[i].id),
SC_MP_P_GetAfterRecoverClass(enum_pl[i].id)
);
SC_message(txt);
SC_MP_SRV_P_SetSideClass(enum_pl[i].id,1,recclass);
}
team[1] ++;
}else if(team[1]>team[0]){
if(enum_pl[i].side != 0){
dword recclass = SC_MP_P_GetAfterRecoverClass(enum_pl[i].id);
if(!(recclass >= 1&&recclass <=6)){
recclass -= 20;
}
if(!(recclass >= 1&&recclass <=6)){
recclass = 1;
}
sprintf(txt,"teamverdeling\nspeler %d\nvan side %d naar 0\nvan class %d naar %d\nafter recover side %d\nafter recover class %d",
SC_MP_GetHandleofPl(enum_pl[i].id),
enum_pl[i].side,
SC_MP_P_GetClass(enum_pl[i].id),
recclass,
SC_MP_P_GetAfterRecoverSide(enum_pl[i].id),
SC_MP_P_GetAfterRecoverClass(enum_pl[i].id)
);
SC_message(txt);
SC_MP_SRV_P_SetSideClass(enum_pl[i].id,0,recclass);
}
team[0] ++;
}else{
int side = rand()%2;
if(enum_pl[i].side != side){
dword recclass = SC_MP_P_GetAfterRecoverClass(enum_pl[i].id);
if(side==1&&!(recclass >= 21&&recclass <=26)){
recclass += 20;
}
if(side==1&&!(recclass >= 21&&recclass <=26)){
recclass = 21;
}
if(side==0&&!(recclass >= 1&&recclass <=6)){
recclass -= 20;
}
if(side==0&&!(recclass >= 1&&recclass <=6)){
recclass = 1;
}
sprintf(txt,"teamverdeling\nspeler %d\nvan side %d naar %d\nvan class %d naar %d\nafter recover side %d\nafter recover class %d",
SC_MP_GetHandleofPl(enum_pl[i].id),
enum_pl[i].side,
side,
SC_MP_P_GetClass(enum_pl[i].id),
recclass,
SC_MP_P_GetAfterRecoverSide(enum_pl[i].id),
SC_MP_P_GetAfterRecoverClass(enum_pl[i].id)
);
SC_message(txt);
SC_MP_SRV_P_SetSideClass(enum_pl[i].id,side,recclass);
}
team[side] ++;
}
}
}
}
/*
void killEverybody(void){
dword i;
s_SC_MP_EnumPlayers enum_pl[64];
dword j = 64;

if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL)){
for (i=0;i<j;i++){
SC_P_DoKill(enum_pl[i].id);
}
}
}
*/
int ScriptMain(s_SC_NET_info *info){
char txt[128];
ushort *witxt;
dword i,j,k,pl_id,pl_val,sideA,sideB;
s_SC_MP_Recover *precov;
s_SC_MP_hud hudinfo;
s_SC_P_getinfo plinfo;
float pl_dist;
s_SC_HUD_MP_icon icon[2];
s_SC_MP_EnumPlayers enum_pl[64];
dword side[2];
s_SC_MP_SRV_settings SRVset;
char side_char;
float val,valy;
dword recclass;


switch(info->message){

case SC_NET_MES_SERVER_TICK:

if (SRV_CheckEndRule(info->elapsed_time)) break;



side[0] = side[1] = 0;
j = 64;

if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL)){

for (i=0;i<j;i++)
if (enum_pl[i].status!=SC_MP_P_STATUS_NOTINGAME){

if (enum_pl[i].side<2) side[enum_pl[i].side] ++;

}// if (enum_pl[i].status==SC_MP_P_STATUS_INGAME)

gMission_starting_timer -= info->elapsed_time;

starttimer += info->elapsed_time;

if ((side[0]+side[1]) > 1){

SC_MP_SetInstantRecovery(FALSE);

if (!gMission_started && starttimer>3.0f){

sprintf(txt,"Start missie");
SC_message(txt);

gMission_started = TRUE;
gMission_afterstart_time = 0.0f;
SC_sgi(GVAR_GAMERUNS,gMission_started);

gCurStep = ChangeStep();

gStepTime = 0;
gKills = 0;

SC_MP_SRV_InitGameAfterInactive();
SC_MP_RecoverAllNoAiPlayers();
//killEverybody();

gMission_starting_timer = 8.0f;

verdeelTeams();
}

if (gMission_started && gMission_afterstart_time>4.0f && (side[0]<1||side[1]<1)){

sprintf(txt,"Stop missie");
SC_message(txt);

gMission_afterstart_time = 0.0f;
gMission_starting_timer = 0.0f;

starttimer = 0.0f;

gStepTime = 0;
gKills = 0;

gTime = 0;

SC_MP_SetInstantRecovery(TRUE);

if (gMission_started){
gMission_started = FALSE;
SC_sgi(GVAR_GAMERUNS,gMission_started);
}
}
}// if ((side[0])&&(side[1]))
else{

if (gMission_starting_timer<=0.0f){

SC_MP_SetInstantRecovery(TRUE);

if (gMission_started){

sprintf(txt,"Stop missie, inactief");
SC_message(txt);

gMission_started = FALSE;
gMission_afterstart_time = 0.0f;
starttimer = 0.0f;
SC_sgi(GVAR_GAMERUNS,gMission_started);
gStepTime = 0;
gKills = 0;
}

}

}// else if ((side[0])&&(side[1]))

}// if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL))


gStepTime += info->elapsed_time;
if (gStepTime >= STEP_TIME || gKills >= MAX_KILLS){
gCurStep = ChangeStep();
gStepTime = 0;
gKills = 0;
}


// update timers for respawn points
for (i=0;i<2;i++)
for (j=0;j<gSteps;j++)
for (k=0;k<gRecs[i][j];k++)
gRecTimer[i][j][k] -= info->elapsed_time;


//gNextRecover -= info->elapsed_time;
//if (gNextRecover<0.0f) gNextRecover = GetRecovTime();

if (gMission_started){
gMission_afterstart_time += info->elapsed_time;
}// if (gMission_started)

break;

case SC_NET_MES_CLIENT_TICK:

break;// SC_NET_MES_CLIENT_TICK


case SC_NET_MES_LEVELPREINIT:
SC_sgi(GVAR_MP_MISSIONTYPE,10);

gEndRule = info->param1;
gEndValue = info->param2;
gTime = 0.0f;


SC_MP_EnableBotsFromScene(FALSE);

break;// SC_NET_MES_LEVELPREINIT

case SC_NET_MES_LEVELINIT:

SC_MP_SRV_SetForceSide(0xffffffff);
SC_MP_SetChooseValidSides(3);

SC_MP_SRV_SetClassLimit(18,0);
SC_MP_SRV_SetClassLimit(19,0);
SC_MP_SRV_SetClassLimit(39,0);

SC_MP_GetSRVsettings(&SRVset);

for (i=0;i<6;i++){
SC_MP_SRV_SetClassLimit(i+1,SRVset.atg_class_limit[i]);
SC_MP_SRV_SetClassLimit(i+21,SRVset.atg_class_limit[i]);
}// for (i)


CLEAR(hudinfo);
hudinfo.title = 1051;

hudinfo.sort_by[0] = SC_HUD_MP_SORTBY_KILLS;
hudinfo.sort_by[1] = SC_HUD_MP_SORTBY_DEATHS | SC_HUD_MP_SORT_DOWNUP;
hudinfo.sort_by[2] = SC_HUD_MP_SORTBY_PINGS | SC_HUD_MP_SORT_DOWNUP;


hudinfo.pl_mask = SC_HUD_MP_PL_MASK_CLASS | SC_HUD_MP_PL_MASK_KILLS | SC_HUD_MP_PL_MASK_DEATHS;

hudinfo.use_sides = TRUE;
hudinfo.side_name[0] = 1010;
hudinfo.side_color[0] = 0x443538b9;
hudinfo.side_name[1] = 1011;
hudinfo.side_color[1] = 0x44b93535;

SC_MP_HUD_SetTabInfo(&hudinfo);

SC_MP_AllowStPwD(TRUE);
SC_MP_AllowFriendlyFireOFF(TRUE);
SC_MP_SetItemsNoDisappear(FALSE);

gMission_started = FALSE;

if (info->param2){

if (info->param1){
// it's server

SC_MP_Gvar_SetSynchro(GVAR_GAMERUNS);
SC_sgi(GVAR_GAMERUNS,0);


CLEAR(gRecs);



for (k=0;k<2;k++){

if (k) side_char = 'V';
else side_char = 'U';

for (j=0;j<STEP_MAX;j++){

for (i=0;i<REC_MAX;i++){

sprintf(txt,"TDM_%c_%d_%d",side_char,j,i); //bv "TDM_U_0_0" voor de eerste spawn uit het eerste couple vd US

if (SC_NET_FillRecover(&gRec[k][j][gRecs[k][j]],txt)){
gRecs[k][j]++;
}
}//for (i) - for all recovers on current step


#if _GE_VERSION_ >= 133
if (gRespawn_id[k][j]){
i = REC_MAX - gRecs[k][j];
SC_MP_GetRecovers(gRespawn_id[k][j],&gRec[k][j][gRecs[k][j]],&i);
gRecs[k][j] += i;
}
#endif


}// for (j) - steps

}// for (k)

gSteps = 0;

for (i=0;i<STEP_MAX;i++)
if (gRecs[0][i]) gSteps = i+1;


for (i=0;i<gSteps;i++)
SC_message("TDM recovers #%d: US:%d VC:%d",i,gRecs[0][i],gRecs[1][i]);


CLEAR(gRecTimer);

sprintf(txt,"gSteps: %d",gSteps);
SC_message(txt);

}// if (info->param1)

}//if (info->param2)


break;// SC_NET_MES_LEVELINIT


case SC_NET_MES_RENDERHUD:

witxt = NULL;

if (!SC_ggi(GVAR_GAMERUNS)){
witxt = SC_Wtxt(101);
}

if (witxt){

SC_GetScreenRes(&val,&valy);

val -= SC_Fnt_GetWidthW(witxt,1);
valy = 15;

SC_Fnt_WriteW(val * 0.5f,valy,witxt,1,0xffffffff);

}//if (i)

break;

case SC_NET_MES_SERVER_RECOVER_TIME:
info->fval1 = 0.1f;

break;

case SC_NET_MES_SERVER_RECOVER_PLACE:

precov = (s_SC_MP_Recover*)info->param2;

j = info->param1; // side

k = gCurStep;

i = SC_MP_SRV_GetBestDMrecov(gRec[j][k],gRecs[j][k],gRecTimer[j][k],NORECOV_TIME);

gRecTimer[j][k][i] = NORECOV_TIME;
*precov = gRec[j][k][i];

break;


case SC_NET_MES_SERVER_KILL:

SC_P_GetInfo(info->param1,&plinfo);

if(gMission_started){
if(SC_MP_P_GetAfterRecoverSide(info->param1)==plinfo.side){
recclass = SC_MP_P_GetAfterRecoverClass(info->param1);
if(plinfo.side==0&&!(recclass >= 21&&recclass <=26)){
recclass += 20;
}
if(plinfo.side==0&&!(recclass >= 21&&recclass <=26)){
recclass = 21;
}
if(plinfo.side==1&&!(recclass >= 1&&recclass <=6)){
recclass -= 20;
}
if(plinfo.side==1&&!(recclass >= 1&&recclass <=6)){
recclass = 1;
}
sprintf(txt,"killswap\nspeler %d\nvan side %d naar %d\nvan class %d naar %d\nafter recover side %d\nafter recover class %d",
SC_MP_GetHandleofPl(info->param1),
plinfo.side,
1-plinfo.side,
SC_MP_P_GetClass(info->param1),
recclass,
SC_MP_P_GetAfterRecoverSide(info->param1),
SC_MP_P_GetAfterRecoverClass(info->param1)
);
SC_message(txt);
SC_MP_SRV_P_SetSideClass(info->param1,1-plinfo.side,recclass);
}
}

gKills++;

break;// SC_NET_MES_SERVER_KILL

case SC_NET_MES_RESTARTMAP:

gMission_afterstart_time = 0.0f;
gMission_starting_timer = 0.0f;

starttimer = 0.0f;

gStepTime = 0;
gKills = 0;

gTime = 0;

SC_MP_SetInstantRecovery(TRUE);

if (gMission_started){
gMission_started = FALSE;
SC_sgi(GVAR_GAMERUNS,gMission_started);
}

SC_MP_SRV_ClearPlsStats();

break;// SC_NET_MES_RESTARTMAP

case SC_NET_MES_RULESCHANGED:
gEndRule = info->param1;
gEndValue = info->param2;
gTime = 0.0f;
break;

}// switch(info->message)


return 1;

}// int ScriptMain(void)
Edited by Kermit on 28-06-2011 13:51
 
Ando
I tested niogianh1.2 RADIO mode with 2 x editor but I cant hear any song. Maybe its related with editor, don't know.
Cant test it alone with game.
Wasn't reading the script, maybe have more time later this week, then will read it.

But rest of it looks working.
 
Kermit
does it work after a restartmap? (warmup-round has no music, rounds after that)
 
Ando
Kermit wrote:
does it work after a restartmap? (warmup-round has no music, rounds after that)

Not for me with editors.
Will test more tomorrow.
 
Ando
Its working now Smile . Some files was blocking custom sound definitions on editor before.
Random song choice looks working too.

That warm up round looks bit strange. And maybe that 2 min. for securing radio is too long.
But you must ask that from other players because I play only coop.
 
Kermit
I would like some help with my radio and swap mode!
On DaisyTown2 the radiomode lags. I included the script below. It has 1 song for us and 1 for vc now, and 75 seconds instead of 2 min.
Maybe some people can help test/improve.

About the SWAP gamemode
Sometimes there is a round and people are swapped, but vietcong doesn't really execute it well, that means: Player is registered as a VC for next life, but is still a US. This shouldn't really give problems except that after a round is finished, you might spawn again, but all on the same team. Then automatically a new round starts and people are swapped.
If anyone knows a way to solve this, please help!

radio4nonade.c
Spoiler:
#include <inc\sc_MPglobal.h>
#include <inc\sc_global.h>
#include <inc\sc_def.h>



//Stel hier dingen in!!

#define IMTESTING FALSE //TRUE als je in je eentje vlagge wil kunnen stelen, anders FALSE (duh)

#define DISTANCETOFLAG 3.0f //je moet binnen deze afstand tot de vlag/sprayplek zijn om te sprayen //tijd die nodig is om te sprayen voordat vlag/sprayplek is veroverd


#define USMUSIC 49

#define VCMUSIC 33

//Tot hier!!


#define NORECOV_TIME 8.0f // disable time of recoverplace after recovering someone there


#define REC_WPNAME_US "USSpawn%d"
#define REC_WPNAME_VC "VCSpawn%d"
#define REC_MAX 64

#define FLAG_US 0
#define FLAG_VC 1
#define FLAG_NEUTRAL 2


#define PHASE_NONE 0
#define PHASE_RUNS 1
#define PHASE_USWIN 2
#define PHASE_VCWIN 3
#define PHASE_NEUTRAL 4

#define GVAR_SIDE0POINTS 500
#define GVAR_SIDE1POINTS 501

#define GVAR_FLAGSTATUS 510
#define GVAR_PHASE 520
#define GVAR_INFO 530
#define GVAR_INFOPLHANDLE 540
#define GVAR_OTIME 551
#define GVAR_WARMUP 552

#define TOWIN_OCCUPY_TIME 60.0f//5.0f

#define INFO_FL_NONE 0
#define INFO_FL_CAPT_US 1
#define INFO_FL_CAPT_VC 2

BOOL gestopt = FALSE;
dword warmupround = 0;
BOOL gespeeld = FALSE;

dword gInfo = INFO_FL_NONE;
dword gSend_Info;
dword gCLN_Info;

dword gInfoPlHandle = 0;
dword gSend_InfoPlHandle;
dword gCLN_InfoPlHandle;


float gCLN_HelpInfo_timer = 0.0f;
ushort gCLN_HelpInfo[256];

float gMission_afterstart_time = 0.0f;

float gMission_starting_timer = 0.0f;

dword gRecs[2] = {0,0};
s_SC_MP_Recover gRec[2][REC_MAX];
float gRecTimer[2][REC_MAX];


//dword gRecsFl;
//s_SC_MP_Recover gRecFl[REC_MAX];
//float gRecTimerFl[REC_MAX];

#if _GE_VERSION_ >= 138
dword g_FPV_UsFlag = 0;
dword g_FPV_VcFlag = 0;
dword g_FPV_NeFlag = 0;
#endif


float gNextRecover = 0.0f;

int gSidePoints[2] = {0,0};

int gCLN_SidePoints[2];

dword gPhase = PHASE_NONE;
float gPhaseTime = 0.0f;

dword gEndRule;
dword gEndValue;
float gTime;

float gOccupyTime = TOWIN_OCCUPY_TIME;


dword gRespawn_id = SC_MP_RESPAWN_WA;

BOOL SRV_CheckEndRule(float time){

switch(gEndRule){
case SC_MP_ENDRULE_TIME:

if (gPhase!=PHASE_NONE) gTime += time;
SC_MP_EndRule_SetTimeLeft(gTime,gPhase!=PHASE_NONE);

if (gTime>gEndValue){
SC_MP_LoadNextMap();
return TRUE;
}

break;

case SC_MP_ENDRULE_POINTS:

if ((gSidePoints[0]>=gEndValue)||(gSidePoints[1]>=gEndValue)){
SC_MP_LoadNextMap();
return TRUE;
}

break;

default:
SC_message("EndRule unsopported: %d",gEndRule);
break;

}// switch(gEndRule)

return FALSE;

}// void SRV_CheckEndRule(float time)


void setTowinOccupyTime(void) {
gOccupyTime = 75;
}



float GetRecovTime(void){
float val;
s_SC_MP_SRV_AtgSettings set;

SC_MP_SRV_GetAtgSettings(&set);

if (set.ctf_respawntime>1.0f){
return set.ctf_respawntime;
}

val = SC_ggf(400);
if (val==0) val = 30;
return val;
}

float GetRecovLimitTime(void){
float val;
s_SC_MP_SRV_AtgSettings set;

SC_MP_SRV_GetAtgSettings(&set);

if (set.ctf_respawntime>1.0f){
return set.ctf_respawntime / 4.0f;
}

val = SC_ggf(401);
if (val==0){
val = GetRecovTime()/4.0f;
}

return val;
}


void UpdateSidePoints(void){
SC_sgi(GVAR_SIDE0POINTS,gSidePoints[0]);
SC_sgi(GVAR_SIDE1POINTS,gSidePoints[1]);
}// void UpdateSidePoints(void)


//void *gFlagNod;
//dword gFlagIndex;
c_Vector3 gOrigFlagPos;
dword gFlagPhase = FLAG_NEUTRAL; // FLAG_PH_


dword gSend_FlagPhase;

dword gCLN_FlagPhase;

//dword gFlags = 0;

dword gSend_OccupyTime = 0;

dword gSend_warmup = 0;


void SRV_ChechSendStatus(void){
dword i;

if (gFlagPhase!=gSend_FlagPhase){
gSend_FlagPhase = gFlagPhase;
SC_sgi(GVAR_FLAGSTATUS,gSend_FlagPhase);
}

if (gSend_Info!=gInfo){
gSend_Info = gInfo;
SC_sgi(GVAR_INFO,gSend_Info);
}// if (gInfo[i]!=gSend_Info[i])

if (gSend_InfoPlHandle!=gInfoPlHandle){
gSend_InfoPlHandle = gInfoPlHandle;
SC_sgi(GVAR_INFOPLHANDLE,gSend_InfoPlHandle);
}// if (gInfo[i]!=gSend_Info[i])

if (gSend_OccupyTime!=gOccupyTime){
gSend_OccupyTime = gOccupyTime;
SC_sgi(GVAR_OTIME,gSend_OccupyTime);
}// if

if (gSend_warmup!=warmupround){
gSend_warmup = warmupround;
SC_sgi(GVAR_WARMUP,gSend_warmup);
}// if


}// void SRV_ChechSendStatus(void)



void ResetMission(void){
//dword i;

gFlagPhase = FLAG_NEUTRAL;
gInfo = INFO_FL_NONE;
gInfoPlHandle = 0;

}// void ResetMission(void)



void Check_ABL(dword pl_handle){
int val;
dword to_change;
s_SC_P_getinfo info;

if (!SC_MP_SRV_GetAutoTeamBalance()) return;

val = SC_MP_SRV_GetTeamsNrDifference(TRUE);

if ((val<3)&&(val>-3)) return; // no big difference

SC_P_GetInfo(pl_handle,&info);

if ((info.side==0)&&(val>0)) to_change = 1;
else
if ((info.side==1)&&(val<0)) to_change = 0;
else
return;

SC_MP_SRV_P_SetSideClass(pl_handle,to_change,1 + 20*to_change);

}// void Check_ABL(dword pl_handle)


void stopMusic(dword side) {
switch(side)
{
case 0:
SC_SND_MusicStop(USMUSIC);
break;
case 1:
SC_SND_MusicStop(VCMUSIC);
break;
}
//SC_SND_MusicPlay(0, 0);
//SC_SND_MusicStop(0);
}


void playMusic(dword side) {
switch(side)
{
case 0:
stopMusic(1);
SC_SND_MusicPlay(USMUSIC, 100);
break;
case 1:
stopMusic(0);
SC_SND_MusicPlay(VCMUSIC, 100);
break;
}
}




int ScriptMain(s_SC_NET_info *info){
char txt[128],*itxt;
ushort wtxt[128],wtxt2[64],*iwtxt;
dword i,j,pl_id,k,txt_id,middle;
s_SC_MP_Recover *precov;
s_SC_MP_hud hudinfo;
s_SC_P_getinfo plinfo;
void *nod;
c_Vector3 vec,vec2,pos;
BOOL valid;
float pl_dist,yres;
s_SC_HUD_MP_icon icon[2];
s_SC_MP_EnumPlayers enum_pl[64];
BOOL side[2];
s_SC_MP_SRV_settings SRVset;
dword index_rec[2];
#if _GE_VERSION_ >= 138
s_SC_FpvMapSign fpv_list[1];
#endif

switch(info->message){

case SC_NET_MES_SERVER_TICK:

if (SRV_CheckEndRule(info->elapsed_time)) break;


side[0] = side[1] = IMTESTING;//FALSE;
j = 64;

if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL)){


if ((j==0)&&((gSidePoints[0]+gSidePoints[1])!=0)){
gSidePoints[0] = 0;
gSidePoints[1] = 0;
UpdateSidePoints();
}// if ((side[0]+side[1])==0)

for (i=0;i<j;i++)
if (enum_pl[i].status!=SC_MP_P_STATUS_NOTINGAME){

if (enum_pl[i].side<2) side[enum_pl[i].side] = TRUE;

}// if (enum_pl[i].status==SC_MP_P_STATUS_INGAME)

gMission_starting_timer -= info->elapsed_time;

if ((side[0])&&(side[1])){

SC_MP_SetInstantRecovery(FALSE);

if ((gPhase==PHASE_NONE)&&(gPhaseTime>2.0f)){
gPhase = PHASE_RUNS;
gMission_afterstart_time = 0.0f;
SC_sgi(GVAR_PHASE,gPhase);

if (gPhaseTime>5.0f){
SC_MP_SRV_InitGameAfterInactive();
ResetMission();
SC_MP_RecoverAllNoAiPlayers();
}
gMission_starting_timer = 8.0f;
}
}// if ((side[0])&&(side[1]))
else{

if (gMission_starting_timer<=0.0f){

SC_MP_SetInstantRecovery(TRUE);

if (gPhase==PHASE_RUNS){
gPhase = PHASE_NONE;
gMission_afterstart_time = 0.0f;
SC_sgi(GVAR_PHASE,gPhase);
ResetMission();
}

}

}// else if ((side[0])&&(side[1]))

}// if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL))



for (j=0;j<2;j++)
for (i=0;i<gRecs[j];i++)
gRecTimer[j][i] -= info->elapsed_time;

//for (i=0;i<gRecsFl;i++)
// gRecTimerFl[i] -= info->elapsed_time;

gNextRecover -= info->elapsed_time;
if (gNextRecover<0.0f) gNextRecover = GetRecovTime();

switch(gPhase){

case PHASE_NONE:
gPhaseTime += info->elapsed_time;
break;

case PHASE_RUNS:

vec = gOrigFlagPos;

gMission_afterstart_time += info->elapsed_time;

if (warmupround==1){

if (gMission_afterstart_time>10.0f){

j = SC_GetNearestPlayer(&vec,&pl_dist);

if ((j)&&(pl_dist<DISTANCETOFLAG)){

SC_P_GetInfo(j,&plinfo);

if ((plinfo.side!=gFlagPhase)) {
gFlagPhase = plinfo.side;
gInfoPlHandle = SC_MP_GetHandleofPl(j);
switch(plinfo.side){
case 0:
gInfo = INFO_FL_CAPT_US;
gOccupyTime = 0.0f;//TOWIN_OCCUPY_TIME;
break;
case 1:
gInfo = INFO_FL_CAPT_VC;
gOccupyTime = 0.0f;//TOWIN_OCCUPY_TIME;
break;
}// switch(plinfo.side)
//gMusic = (rand()%AANTALMUZIEKJES)+1;
}// if (plinfo.side!=gFlagPhase[i])

}// if ((j)&&(pl_dist<1.0f))

}// if (valid)


if (gFlagPhase!=FLAG_NEUTRAL){

gOccupyTime -= info->elapsed_time;

if (gOccupyTime<=0.0f){

switch(gFlagPhase){
case FLAG_US:
gPhase = PHASE_USWIN;
gPhaseTime = 5.0f;
SC_sgi(GVAR_PHASE,gPhase);
warmupround = 0;
break;
case FLAG_VC:
gPhase = PHASE_VCWIN;
gPhaseTime = 5.0f;
SC_sgi(GVAR_PHASE,gPhase);
warmupround = 0;
break;
}// switch(j)

}// gOccupyTime

}// if (i==gFlags)
else gOccupyTime = 0.0f;//TOWIN_OCCUPY_TIME;

} else {

if (gMission_afterstart_time>10.0f){

j = SC_GetNearestPlayer(&vec,&pl_dist);

if ((j)&&(pl_dist<DISTANCETOFLAG)){

SC_P_GetInfo(j,&plinfo);

if ((plinfo.side!=gFlagPhase)) {
gFlagPhase = plinfo.side;
gInfoPlHandle = SC_MP_GetHandleofPl(j);
switch(plinfo.side){
case 0:
gInfo = INFO_FL_CAPT_US;
setTowinOccupyTime();//TOWIN_OCCUPY_TIME;
break;
case 1:
gInfo = INFO_FL_CAPT_VC;
setTowinOccupyTime();//TOWIN_OCCUPY_TIME;
break;
}// switch(plinfo.side)
//gMusic = (rand()%AANTALMUZIEKJES)+1;
}// if (plinfo.side!=gFlagPhase[i])

}// if ((j)&&(pl_dist<1.0f))

}// if (valid)


if (gFlagPhase!=FLAG_NEUTRAL){

gOccupyTime -= info->elapsed_time;

if (gOccupyTime<=0.0f){

switch(gFlagPhase){
case FLAG_US:
gSidePoints[0]++;
UpdateSidePoints();

gPhase = PHASE_USWIN;
gPhaseTime = 10.0f;
SC_sgi(GVAR_PHASE,gPhase);
break;
case FLAG_VC:
gSidePoints[1]++;
UpdateSidePoints();

gPhase = PHASE_VCWIN;
gPhaseTime = 10.0f;
SC_sgi(GVAR_PHASE,gPhase);
break;
}// switch(j)

}// gOccupyTime

}// if (i==gFlags)
else setTowinOccupyTime();//TOWIN_OCCUPY_TIME;
}
break;

case PHASE_USWIN:
case PHASE_VCWIN:

gPhaseTime -= info->elapsed_time;

if (gPhaseTime<=0.0f){

gPhase = PHASE_NONE;
gPhaseTime = 0.0f;
SC_sgi(GVAR_PHASE,gPhase);

ResetMission();
SC_MP_RestartMission();

}// if (gPhaseTime<=0.0f)

break;

}// switch(gPhase)


SRV_ChechSendStatus();

break;

case SC_NET_MES_MESSAGE:
break;

case SC_NET_MES_CLIENT_TICK:


//weg met die nades, wanneer dan ook
if (SC_P_IsReady(SC_PC_Get())){

if(SC_P_HasWeapon(SC_PC_Get(), 59)){ // nade
SC_P_ChangeWeapon(SC_PC_Get(),4,0);
}

if(SC_P_HasWeapon(SC_PC_Get(), 50)){ // vc nade
SC_P_ChangeWeapon(SC_PC_Get(),5,0);
}

}




if (SC_ggi(GVAR_WARMUP)==1) {
if (SC_P_IsReady(SC_PC_Get())){
switch(SC_P_GetCurWeap(SC_PC_Get()))
{
case 7:
case 8:
case 9:
case 10:
case 22:
break;
default:
SC_P_SetSelWeapon(SC_PC_Get(), 1);
break;
}
}
}

if (gCLN_HelpInfo_timer>0.0f){
gCLN_HelpInfo_timer -= info->elapsed_time;
}

pl_id = SC_PC_Get();

for (i=0;i<2;i++){

gCLN_SidePoints[i] = SC_ggi(GVAR_SIDE0POINTS+i);
SC_MP_SetSideStats(i,0,gCLN_SidePoints[i]);

}// for (i=0;i<2;i++)


gCLN_FlagPhase = SC_ggi(GVAR_FLAGSTATUS);

switch(SC_ggi(GVAR_PHASE)){
case PHASE_NONE:
case PHASE_USWIN:
stopMusic(0);
stopMusic(1);
if (!gespeeld){
//SC_SND_PlaySound2D(5117);
gespeeld = TRUE;
}
break;
case PHASE_VCWIN:
stopMusic(0);
stopMusic(1);
if (!gespeeld){
SC_SND_PlaySound2D(5119);
gespeeld = TRUE;
}
break;
case PHASE_RUNS:
if (gespeeld) {
gespeeld = FALSE;
}
if (!gestopt) {
//if (gCLN_FlagPhase == FLAG_NEUTRAL) {
stopMusic(0);
stopMusic(1);
gestopt = TRUE;
//SC_SND_MusicPlay(13, 100);
//}
}
/*if (SC_ggi(GVAR_MTIME) > 3) {
SC_SND_MusicStop(13);
}*/
break;
}// switch(SC_ggi(GVAR_PHASE))

fpv_list[0].color = 0xffffffff;
fpv_list[0].pos = gOrigFlagPos;
fpv_list[0].scale = 1.0f;

icon[0].color = 0xffffffff;
icon[0].type = SC_HUD_MP_ICON_TYPE_NONE;


icon[1].color = 0xbbffffff;
icon[1].icon_id = 6;
icon[1].value = (int)(SC_ggi(GVAR_OTIME));//(int)(gOccupyTime);
icon[1].type = SC_HUD_MP_ICON_TYPE_TIME;


switch(gCLN_FlagPhase){

case FLAG_US:
fpv_list[0].id = g_FPV_UsFlag;
icon[0].icon_id = 0;
break;

case FLAG_VC:
fpv_list[0].id = g_FPV_VcFlag;
icon[0].icon_id = 3;
break;

case FLAG_NEUTRAL:
fpv_list[0].id = g_FPV_NeFlag;
icon[0].icon_id = 12;
break;
}


j = SC_ggi(GVAR_INFO);
if (j!=gCLN_Info){
gCLN_Info = j;
gCLN_InfoPlHandle = SC_ggi(GVAR_INFOPLHANDLE);

pl_id = SC_MP_GetPlofHandle(gCLN_InfoPlHandle);


switch(j){

case INFO_FL_CAPT_US:
if (pl_id){
swprintf(gCLN_HelpInfo,SC_Wtxt(5121),SC_P_GetName(pl_id),SC_Wtxt(5118));
gCLN_HelpInfo_timer = 10.0f;
}
playMusic(0);
break;
case INFO_FL_CAPT_VC:
if (pl_id){
swprintf(gCLN_HelpInfo,SC_Wtxt(5121),SC_P_GetName(pl_id),SC_Wtxt(5117));
gCLN_HelpInfo_timer = 10.0f;
}
playMusic(1);
break;

}// switch(j)


}// if (j!=gCLNd_Info[i])




if (gCLN_FlagPhase!=FLAG_NEUTRAL) {
SC_MP_SetIconHUD(icon,2);
}
else {
SC_MP_SetIconHUD(icon,1);
}

SC_MP_FpvMapSign_Set(1,fpv_list);

break;// SC_NET_MES_CLIENT_TICK


case SC_NET_MES_LEVELPREINIT:
SC_sgi(GVAR_MP_MISSIONTYPE,GVAR_MP_MISSIONTYPE_RW);

gEndRule = info->param1;
gEndValue = info->param2;
gTime = 0.0f;

SC_MP_EnableC4weapon(FALSE);

SC_MP_EnableBotsFromScene(FALSE);

break;// SC_NET_MES_LEVELPREINIT

case SC_NET_MES_LEVELINIT:

#if _GE_VERSION_ >= 138
g_FPV_UsFlag = SC_MP_FpvMapSign_Load("g\\weapons\\Vvh_map\\icons\\MPIC_USflag.BES");
g_FPV_VcFlag = SC_MP_FpvMapSign_Load("g\\weapons\\Vvh_map\\icons\\MPIC_VCflag.BES");
g_FPV_NeFlag = SC_MP_FpvMapSign_Load("g\\weapons\\Vvh_map\\icons\\MPIC_emptyflag.BES");
#endif


SC_MP_SRV_SetForceSide(0xffffffff);
SC_MP_SetChooseValidSides(3);

SC_MP_SRV_SetClassLimit(18,0);
SC_MP_SRV_SetClassLimit(19,0);
SC_MP_SRV_SetClassLimit(39,0);

SC_MP_GetSRVsettings(&SRVset);

for (i=0;i<6;i++){
SC_MP_SRV_SetClassLimit(i+1,SRVset.atg_class_limit[i]);
SC_MP_SRV_SetClassLimit(i+21,SRVset.atg_class_limit[i]);
}// for (i)


CLEAR(hudinfo);
hudinfo.title = 5119;

hudinfo.sort_by[0] = SC_HUD_MP_SORTBY_KILLS;
hudinfo.sort_by[1] = SC_HUD_MP_SORTBY_DEATHS | SC_HUD_MP_SORT_DOWNUP;
hudinfo.sort_by[2] = SC_HUD_MP_SORTBY_PINGS | SC_HUD_MP_SORT_DOWNUP;

hudinfo.pl_mask = SC_HUD_MP_PL_MASK_CLASS | SC_HUD_MP_PL_MASK_KILLS | SC_HUD_MP_PL_MASK_DEATHS;
hudinfo.use_sides = TRUE;
hudinfo.side_name[0] = 5118;
hudinfo.side_color[0] = 0x440000ff;
hudinfo.side_name[1] = 5117;
hudinfo.side_color[1] = 0x44ff0000;

hudinfo.side_mask = SC_HUD_MP_SIDE_MASK_POINTS;

SC_MP_HUD_SetTabInfo(&hudinfo);

SC_MP_AllowStPwD(TRUE);
SC_MP_AllowFriendlyFireOFF(TRUE);

SC_MP_SetItemsNoDisappear(FALSE);

gPhase = PHASE_NONE;

if (info->param2){

// preload flag items
//SC_Item_Preload(145);
//SC_Item_Preload(146);


//gFlags = 0;

nod = SC_NOD_GetNoMessage(NULL,"radio");
if (nod){
SC_NOD_GetWorldPos(nod,&gOrigFlagPos);

}// if (nod)
else {
SC_message("Radio not found");
}



if (info->param1){
// it's server

SC_MP_Gvar_SetSynchro(GVAR_SIDE0POINTS);
SC_MP_Gvar_SetSynchro(GVAR_SIDE1POINTS);
UpdateSidePoints();

SC_MP_Gvar_SetSynchro(GVAR_PHASE);
SC_sgi(GVAR_PHASE,0);

SC_MP_Gvar_SetSynchro(GVAR_FLAGSTATUS);
SC_sgi(GVAR_FLAGSTATUS,FLAG_NEUTRAL);

SC_MP_Gvar_SetSynchro(GVAR_INFO);
SC_sgi(GVAR_INFO,INFO_FL_NONE);

SC_MP_Gvar_SetSynchro(GVAR_INFOPLHANDLE);
SC_sgi(GVAR_INFOPLHANDLE,0);

SC_MP_Gvar_SetSynchro(GVAR_OTIME);
SC_sgi(GVAR_OTIME,0);

SC_MP_Gvar_SetSynchro(GVAR_WARMUP);
SC_sgi(GVAR_WARMUP,0);


// recovers for sides

CLEAR(gRecs);

for (i=0;i<REC_MAX;i++){
sprintf(txt,REC_WPNAME_US,i);
if (SC_NET_FillRecover(&gRec[0][gRecs[0]],txt)) gRecs[0]++;
}

#if _GE_VERSION_ >= 133
i = REC_MAX - gRecs[0];
SC_MP_GetRecovers(SC_MP_RESPAWN_CTF_US,&gRec[0][gRecs[0]],&i);
gRecs[0] += i;
#endif

SC_Log(3,"RW respawns us: %d",gRecs[0]);


if (gRecs[0]==0) SC_message("no US recover place defined!");

for (i=0;i<REC_MAX;i++){
sprintf(txt,REC_WPNAME_VC,i);
if (SC_NET_FillRecover(&gRec[1][gRecs[1]],txt)) gRecs[1]++;
}

#if _GE_VERSION_ >= 133
i = REC_MAX - gRecs[1];
SC_MP_GetRecovers(SC_MP_RESPAWN_CTF_VC,&gRec[1][gRecs[1]],&i);
gRecs[1] += i;
#endif

SC_Log(3,"RW respawns vc: %d",gRecs[1]);


if (gRecs[1]==0) SC_message("no VC recover place defined!");

CLEAR(gRecTimer);

}// if (info->param1)

}//if (info->param2)


break;// SC_NET_MES_LEVELINIT


case SC_NET_MES_RENDERHUD:

txt_id = 0;

switch(SC_ggi(GVAR_PHASE)){

case PHASE_NONE:
middle = 0;
txt_id = 101;
break;

case PHASE_USWIN:
middle = 1;
txt_id = 5116;
break;

case PHASE_VCWIN:
middle = 1;
txt_id = 5115;
break;
}// switch(SC_ggi(GVAR_PHASE))



if ((txt_id)||(gCLN_HelpInfo_timer>0.0f)){

SC_GetScreenRes(&pl_dist,&yres);

/*if (gCLN_HelpInfo_timer<=0.0f)
iwtxt = SC_Wtxt(txt_id);
else{
//middle = 1;//0;
iwtxt = gCLN_HelpInfo;
}*/
if (txt_id){
iwtxt = SC_Wtxt(txt_id);
} else {
iwtxt = gCLN_HelpInfo;
}

pl_dist -= SC_Fnt_GetWidthW(iwtxt,1);

if (middle) yres = yres * 0.45f;
else yres = 15;

SC_Fnt_WriteW(pl_dist * 0.5f,yres,iwtxt,1,0xffffffff);

}// itxt

if (SC_ggi(GVAR_WARMUP)==1){
SC_GetScreenRes(&pl_dist,&yres);
iwtxt = SC_Wtxt(5114);
pl_dist -= SC_Fnt_GetWidthW(iwtxt,2);
SC_Fnt_WriteW(pl_dist * 0.5f,yres * 0.7f,iwtxt,2,0xffffffff);
}

break;

case SC_NET_MES_SERVER_RECOVER_TIME:

if (info->param2){
info->fval1 = 0.1f;
}
else{
// killed
switch(gPhase){
case PHASE_NONE:
info->fval1 = 3.0f;
break;
case PHASE_RUNS:
if (gNextRecover>GetRecovLimitTime()) info->fval1 = gNextRecover;
else info->fval1 = gNextRecover + GetRecovTime();
break;
default:
info->fval1 = -1.0f;
break;
}// switch(gPhase)


}

break;

case SC_NET_MES_SERVER_RECOVER_PLACE:

precov = (s_SC_MP_Recover*)info->param2;

// side recover
i = SC_MP_SRV_GetBestDMrecov(gRec[info->param1],gRecs[info->param1],gRecTimer[info->param1],NORECOV_TIME);
gRecTimer[info->param1][i] = NORECOV_TIME;
*precov = gRec[info->param1][i];

break;


case SC_NET_MES_SERVER_KILL:

Check_ABL(info->param1);

break;// SC_NET_MES_SERVER_KILL

case SC_NET_MES_RESTARTMAP:

gestopt = FALSE;
warmupround = 1;
gespeeld = FALSE;

CLEAR(gInfo);
CLEAR(gSend_Info);

gMission_afterstart_time = 0.0f;
gMission_starting_timer = 0.0f;

//CLEAR(gRecTimerFl);
CLEAR(gRecTimer);

gNextRecover = 0.0f;

CLEAR(gSidePoints);
UpdateSidePoints();

gPhase = PHASE_NONE;
gPhaseTime = 10.0f;

gTime = 0;

setTowinOccupyTime();//TOWIN_OCCUPY_TIME;

gFlagPhase = FLAG_NEUTRAL;
gSend_FlagPhase = 99;

gSend_OccupyTime = 99;
gSend_warmup = 99;

SC_MP_SetInstantRecovery(TRUE);

SC_MP_SRV_ClearPlsStats();

SC_MP_SRV_InitGameAfterInactive();
SC_MP_RecoverAllNoAiPlayers();

break;// SC_NET_MES_RESTARTMAP

case SC_NET_MES_RULESCHANGED:
gEndRule = info->param1;
gEndValue = info->param2;
gTime = 0.0f;
break;

}// switch(info->message)


return 1;

}// int ScriptMain(void)


----------------------------------------------

newtdmswap4nonadectfspawns2.c
Spoiler:
/*
Eric multiplayer script - CTF
*/

#include <inc\sc_global.h>
#include <inc\sc_def.h>


#define NORECOV_TIME 3.0f // disable time of recoverplace after recovering someone there

//#define STEP_MAX 7 // maximum recoverplace couples
#define REC_MAX 64 // maximum of recovers on one recoverplace

//#define STEP_TIME 120.0f // time before spawns change
//#define MAX_KILLS 20 // number of kills before spawns change

#define GVAR_GAMERUNS 504



BOOL gMission_started = FALSE;
float gMission_afterstart_time = 0.0f;

float starttimer = 0.0f;

//float gStepTime = 0.0f;
//dword gKills = 0;

float gMission_starting_timer = 0.0f;
//dword gSteps = 0; // number of couples
//dword gCurStep = 0;
dword gRecs[2] = {0,0}; // 0-US, 1-VC
s_SC_MP_Recover gRec[2][REC_MAX];
float gRecTimer[2][REC_MAX];

dword gEndRule;
dword gEndValue;
float gTime;


#if _GE_VERSION_ >= 133
dword gRespawn_id[2] = {SC_MP_RESPAWN_CTF_US, SC_MP_RESPAWN_CTF_VC};
#endif


BOOL SRV_CheckEndRule(float time){

switch(gEndRule){
case SC_MP_ENDRULE_TIME:

if (gMission_started) gTime += time;
SC_MP_EndRule_SetTimeLeft(gTime,gMission_started);

if (gTime>gEndValue){
SC_MP_LoadNextMap();
return TRUE;
}

break;

default:
SC_message("EndRule unsopported: %d",gEndRule);
break;

}// switch(gEndRule)

return FALSE;

}// void SRV_CheckEndRule(float time)


/*int ChangeStep(void){
int result = rand()%gSteps;
if(result == gCurStep){
return ChangeStep();
}
return result;
}*/

void verdeelTeams(void){
char txt[128];
dword i;
dword team[2] = {0,0};
s_SC_MP_EnumPlayers enum_pl[64];
dword j = 64;

if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL)){
for (i=0;i<j;i++){
if(team[0]>team[1]){
if(enum_pl[i].side != 1){
dword recclass = SC_MP_P_GetAfterRecoverClass(enum_pl[i].id);
if(!(recclass >= 21&&recclass <=26)){
recclass += 20;
}
if(!(recclass >= 21&&recclass <=26)){
recclass = 21;
}
sprintf(txt,"teamverdeling\nspeler %d\nvan side %d naar 1\nvan class %d naar %d\nafter recover side %d\nafter recover class %d",
SC_MP_GetHandleofPl(enum_pl[i].id),
enum_pl[i].side,
SC_MP_P_GetClass(enum_pl[i].id),
recclass,
SC_MP_P_GetAfterRecoverSide(enum_pl[i].id),
SC_MP_P_GetAfterRecoverClass(enum_pl[i].id)
);
SC_message(txt);
SC_MP_SRV_P_SetSideClass(enum_pl[i].id,1,recclass);
}
team[1] ++;
}else if(team[1]>team[0]){
if(enum_pl[i].side != 0){
dword recclass = SC_MP_P_GetAfterRecoverClass(enum_pl[i].id);
if(!(recclass >= 1&&recclass <=6)){
recclass -= 20;
}
if(!(recclass >= 1&&recclass <=6)){
recclass = 1;
}
sprintf(txt,"teamverdeling\nspeler %d\nvan side %d naar 0\nvan class %d naar %d\nafter recover side %d\nafter recover class %d",
SC_MP_GetHandleofPl(enum_pl[i].id),
enum_pl[i].side,
SC_MP_P_GetClass(enum_pl[i].id),
recclass,
SC_MP_P_GetAfterRecoverSide(enum_pl[i].id),
SC_MP_P_GetAfterRecoverClass(enum_pl[i].id)
);
SC_message(txt);
SC_MP_SRV_P_SetSideClass(enum_pl[i].id,0,recclass);
}
team[0] ++;
}else{
int side = rand()%2;
if(enum_pl[i].side != side){
dword recclass = SC_MP_P_GetAfterRecoverClass(enum_pl[i].id);
if(side==1&&!(recclass >= 21&&recclass <=26)){
recclass += 20;
}
if(side==1&&!(recclass >= 21&&recclass <=26)){
recclass = 21;
}
if(side==0&&!(recclass >= 1&&recclass <=6)){
recclass -= 20;
}
if(side==0&&!(recclass >= 1&&recclass <=6)){
recclass = 1;
}
sprintf(txt,"teamverdeling\nspeler %d\nvan side %d naar %d\nvan class %d naar %d\nafter recover side %d\nafter recover class %d",
SC_MP_GetHandleofPl(enum_pl[i].id),
enum_pl[i].side,
side,
SC_MP_P_GetClass(enum_pl[i].id),
recclass,
SC_MP_P_GetAfterRecoverSide(enum_pl[i].id),
SC_MP_P_GetAfterRecoverClass(enum_pl[i].id)
);
SC_message(txt);
SC_MP_SRV_P_SetSideClass(enum_pl[i].id,side,recclass);
}
team[side] ++;
}
}
}
}
/*
void killEverybody(void){
dword i;
s_SC_MP_EnumPlayers enum_pl[64];
dword j = 64;

if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL)){
for (i=0;i<j;i++){
SC_P_DoKill(enum_pl[i].id);
}
}
}
*/
int ScriptMain(s_SC_NET_info *info){
char txt[128];
ushort *witxt;
dword i,j,k,pl_id,pl_val,sideA,sideB;
s_SC_MP_Recover *precov;
s_SC_MP_hud hudinfo;
s_SC_P_getinfo plinfo;
float pl_dist;
s_SC_HUD_MP_icon icon[2];
s_SC_MP_EnumPlayers enum_pl[64];
dword side[2];
s_SC_MP_SRV_settings SRVset;
//char side_char;
float val,valy;
dword recclass;


switch(info->message){

case SC_NET_MES_SERVER_TICK:

if (SRV_CheckEndRule(info->elapsed_time)) break;



side[0] = side[1] = 0;
j = 64;

if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL)){

for (i=0;i<j;i++)
if (enum_pl[i].status!=SC_MP_P_STATUS_NOTINGAME){

if (enum_pl[i].side<2) side[enum_pl[i].side] ++;

}// if (enum_pl[i].status==SC_MP_P_STATUS_INGAME)

gMission_starting_timer -= info->elapsed_time;

starttimer += info->elapsed_time;

if ((side[0]+side[1]) > 1){

SC_MP_SetInstantRecovery(FALSE);

if (!gMission_started && starttimer>3.0f){

sprintf(txt,"Start missie");
SC_message(txt);

gMission_started = TRUE;
gMission_afterstart_time = 0.0f;
SC_sgi(GVAR_GAMERUNS,gMission_started);

//gCurStep = ChangeStep();

//gStepTime = 0;
//gKills = 0;

SC_MP_SRV_InitGameAfterInactive();
SC_MP_RecoverAllNoAiPlayers();
//killEverybody();

gMission_starting_timer = 8.0f;

verdeelTeams();
}

if (gMission_started && gMission_afterstart_time>4.0f && (side[0]<1||side[1]<1)){

sprintf(txt,"Stop missie");
SC_message(txt);

gMission_afterstart_time = 0.0f;
gMission_starting_timer = 0.0f;

starttimer = 0.0f;

//gStepTime = 0;
//gKills = 0;

gTime = 0;

SC_MP_SetInstantRecovery(TRUE);

if (gMission_started){
gMission_started = FALSE;
SC_sgi(GVAR_GAMERUNS,gMission_started);
}
}
}// if ((side[0])&&(side[1]))
else{

if (gMission_starting_timer<=0.0f){

SC_MP_SetInstantRecovery(TRUE);

if (gMission_started){

sprintf(txt,"Stop missie, inactief");
SC_message(txt);

gMission_started = FALSE;
gMission_afterstart_time = 0.0f;
starttimer = 0.0f;
SC_sgi(GVAR_GAMERUNS,gMission_started);
//gStepTime = 0;
//gKills = 0;
}

}

}// else if ((side[0])&&(side[1]))

}// if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL))


/*gStepTime += info->elapsed_time;
if (gStepTime >= STEP_TIME || gKills >= MAX_KILLS){
gCurStep = ChangeStep();
gStepTime = 0;
gKills = 0;
}*/


// update timers for respawn points
for (i=0;i<2;i++)
//for (j=0;j<gSteps;j++)
for (k=0;k<gRecs[i];k++)
gRecTimer[i][k] -= info->elapsed_time;


//gNextRecover -= info->elapsed_time;
//if (gNextRecover<0.0f) gNextRecover = GetRecovTime();

if (gMission_started){
gMission_afterstart_time += info->elapsed_time;
}// if (gMission_started)

break;

case SC_NET_MES_CLIENT_TICK:


//weg met die nades, wanneer dan ook
if (SC_P_IsReady(SC_PC_Get())){

if(SC_P_HasWeapon(SC_PC_Get(), 59)){ // nade
SC_P_ChangeWeapon(SC_PC_Get(),4,0);
}

if(SC_P_HasWeapon(SC_PC_Get(), 50)){ // vc nade
SC_P_ChangeWeapon(SC_PC_Get(),5,0);
}

}




break;// SC_NET_MES_CLIENT_TICK


case SC_NET_MES_LEVELPREINIT:
SC_sgi(GVAR_MP_MISSIONTYPE,10);

gEndRule = info->param1;
gEndValue = info->param2;
gTime = 0.0f;


SC_MP_EnableBotsFromScene(FALSE);

break;// SC_NET_MES_LEVELPREINIT

case SC_NET_MES_LEVELINIT:

SC_MP_SRV_SetForceSide(0xffffffff);
SC_MP_SetChooseValidSides(3);

SC_MP_SRV_SetClassLimit(18,0);
SC_MP_SRV_SetClassLimit(19,0);
SC_MP_SRV_SetClassLimit(39,0);

SC_MP_GetSRVsettings(&SRVset);

for (i=0;i<6;i++){
SC_MP_SRV_SetClassLimit(i+1,SRVset.atg_class_limit[i]);
SC_MP_SRV_SetClassLimit(i+21,SRVset.atg_class_limit[i]);
}// for (i)


CLEAR(hudinfo);
hudinfo.title = 1051;

hudinfo.sort_by[0] = SC_HUD_MP_SORTBY_KILLS;
hudinfo.sort_by[1] = SC_HUD_MP_SORTBY_DEATHS | SC_HUD_MP_SORT_DOWNUP;
hudinfo.sort_by[2] = SC_HUD_MP_SORTBY_PINGS | SC_HUD_MP_SORT_DOWNUP;


hudinfo.pl_mask = SC_HUD_MP_PL_MASK_CLASS | SC_HUD_MP_PL_MASK_KILLS | SC_HUD_MP_PL_MASK_DEATHS;

hudinfo.use_sides = TRUE;
hudinfo.side_name[0] = 1010;
hudinfo.side_color[0] = 0x443538b9;
hudinfo.side_name[1] = 1011;
hudinfo.side_color[1] = 0x44b93535;

SC_MP_HUD_SetTabInfo(&hudinfo);

SC_MP_AllowStPwD(TRUE);
SC_MP_AllowFriendlyFireOFF(TRUE);
SC_MP_SetItemsNoDisappear(FALSE);

gMission_started = FALSE;

if (info->param2){

if (info->param1){
// it's server

SC_MP_Gvar_SetSynchro(GVAR_GAMERUNS);
SC_sgi(GVAR_GAMERUNS,0);


CLEAR(gRecs);



for (k=0;k<2;k++){

for (i=0;i<REC_MAX;i++){

if(k){
sprintf(txt,"VCSpawn%d",i);
}else{
sprintf(txt,"USSpawn%d",i);
}

if (SC_NET_FillRecover(&gRec[k][gRecs[k]],txt)){
gRecs[k]++;
}
}//for (i) - for all recovers on current step


#if _GE_VERSION_ >= 133
//if (gRespawn_id[k]){
i = REC_MAX - gRecs[k];
SC_MP_GetRecovers(gRespawn_id[k],&gRec[k][gRecs[k]],&i);
gRecs[k] += i;
//}
#endif

}// for (k)


SC_message("CTF recovers: US:%d VC:%d",gRecs[0],gRecs[1]);


CLEAR(gRecTimer);


}// if (info->param1)

}//if (info->param2)


break;// SC_NET_MES_LEVELINIT


case SC_NET_MES_RENDERHUD:

witxt = NULL;

if (!SC_ggi(GVAR_GAMERUNS)){
witxt = SC_Wtxt(101);
}

if (witxt){

SC_GetScreenRes(&val,&valy);

val -= SC_Fnt_GetWidthW(witxt,1);
valy = 15;

SC_Fnt_WriteW(val * 0.5f,valy,witxt,1,0xffffffff);

}//if (i)

break;

case SC_NET_MES_SERVER_RECOVER_TIME:
info->fval1 = 0.1f;

break;

case SC_NET_MES_SERVER_RECOVER_PLACE:

precov = (s_SC_MP_Recover*)info->param2;

j = info->param1; // side

//k = gCurStep;

i = SC_MP_SRV_GetBestDMrecov(gRec[j],gRecs[j],gRecTimer[j],NORECOV_TIME);

gRecTimer[j][i] = NORECOV_TIME;
*precov = gRec[j][i];

break;


case SC_NET_MES_SERVER_KILL:

SC_P_GetInfo(info->param1,&plinfo);

if(gMission_started){
if(SC_MP_P_GetAfterRecoverSide(info->param1)==plinfo.side){
recclass = SC_MP_P_GetAfterRecoverClass(info->param1);
if(plinfo.side==0&&!(recclass >= 21&&recclass <=26)){
recclass += 20;
}
if(plinfo.side==0&&!(recclass >= 21&&recclass <=26)){
recclass = 21;
}
if(plinfo.side==1&&!(recclass >= 1&&recclass <=6)){
recclass -= 20;
}
if(plinfo.side==1&&!(recclass >= 1&&recclass <=6)){
recclass = 1;
}
sprintf(txt,"killswap\nspeler %d\nvan side %d naar %d\nvan class %d naar %d\nafter recover side %d\nafter recover class %d",
SC_MP_GetHandleofPl(info->param1),
plinfo.side,
1-plinfo.side,
SC_MP_P_GetClass(info->param1),
recclass,
SC_MP_P_GetAfterRecoverSide(info->param1),
SC_MP_P_GetAfterRecoverClass(info->param1)
);
SC_message(txt);
SC_MP_SRV_P_SetSideClass(info->param1,1-plinfo.side,recclass);
}
}

//gKills++;

break;// SC_NET_MES_SERVER_KILL

case SC_NET_MES_RESTARTMAP:

gMission_afterstart_time = 0.0f;
gMission_starting_timer = 0.0f;

starttimer = 0.0f;

//gStepTime = 0;
//gKills = 0;

gTime = 0;

SC_MP_SetInstantRecovery(TRUE);

if (gMission_started){
gMission_started = FALSE;
SC_sgi(GVAR_GAMERUNS,gMission_started);
}

SC_MP_SRV_ClearPlsStats();

break;// SC_NET_MES_RESTARTMAP

case SC_NET_MES_RULESCHANGED:
gEndRule = info->param1;
gEndValue = info->param2;
gTime = 0.0f;
break;

}// switch(info->message)


return 1;

}// int ScriptMain(void)
Edited by Silent Bob on 18-11-2011 12:19
 
Jump to Forum:
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Render time: 0.26 seconds - 56 Queries 4,938,771 unique visits