March 29 2024 15:45:16
Navigation
· Home
· Articles
· Downloads
· FAQ
· Discussion Forum
· Web Links
· News Categories
· Contact Me
· Photo Gallery
· Search
· Gameservers
Languages
Users Online
· Guests Online: 3

· Members Online: 0

· Total Members: 1,127
· Newest Member: Highl@nder
Teamspeak 3
Last Seen Users
· gus01:20:17
· Intruder12:25:11
· desintegrator22:08:02
· Highl@nder 1 day
· Silent Bob 2 days
· Jerry 3 days
· forrest747 4 days
· WEZ 4 days
· Sully 5 days
· doomed 1 week
· Terminator 1 week
· The ACE 1 week
· GONZO 2 weeks
· VictorMyson 3 weeks
· Don Turtuma 4 weeks

View Thread: ADM script
Vietcong.Info » Vietcong General Discussion » Maps & Mapping
Who is here? 1 Guest
Current Rating: (Total: 1 rating)  
 Print Thread
ADM script
VCG john
Hey guys,

I lost my #ADM_script and google can't find it.

Maybe somebody can upload it again...

Thanx,
#VCG_freddy
Signature#VCG_freddy
Mail: vietcongguys@gmail.com
Facebook: fb.com/vcgfreddy
VCG_Page: fb.com/vcg31
Vietcong Guild: https://discord.gg/mXaXG2P
Vietcong Messenger: https://vietcongmessenger.mn.co
 
https://vietcongmessenger.mn.co
Silent Bob
Download source  Code
/*
   Eric multiplayer script - ATG - kill the others
*/

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


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

#define REC_WPNAME_US   "USSpawn_atg_%d"
#define REC_WPNAME_VC   "VCSpawn_atg_%d"
#define REC_MAX         64


//#define GMISSION_TIME               300.0f

#define GVAR_SIDE0POINTS            500
#define GVAR_SIDE1POINTS            501

#define GVAR_PHASE                  502

#define GVAR_MISSIONTIME            503
#define GVAR_MISSIONTIME_UPDATE         504

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

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

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


#define GPHASE_BEGIN            1
#define GPHASE_GAME               2
#define GPHASE_VCKILLED            3
#define GPHASE_USKILLED            4
#define GPHASE_TIMEDONE            5

dword gPhase = GPHASE_BEGIN;
float gPhaseTimer = 0.0f;

dword gSend_Phase;


dword gEndRule;
dword gEndValue;
float gTime;
float gMissionTime = 0;
float gMissionTime_update;

float gCLN_MissionTime;
dword gCLN_MissionTimePrevID;


BOOL SRV_CheckEndRule(float time){

   switch(gEndRule){
      case SC_MP_ENDRULE_TIME:


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

         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 UpdateSidePoints(void){
   SC_sgi(GVAR_SIDE0POINTS,gSidePoints[0]);
   SC_sgi(GVAR_SIDE1POINTS,gSidePoints[1]);
}// void UpdateSidePoints(void)


void SRV_CheckUpdate(void){

   if (gSend_Phase != gPhase){      
      gSend_Phase = gPhase;
      SC_sgi(GVAR_PHASE,gPhase);      
   }

}// void SRV_CheckUpdate(void)


void SRV_UpdateMissionTime(float time){

   gMissionTime_update -= time;
   if (gMissionTime_update<0.0f){

      gMissionTime_update = 10.0f;

      SC_sgf(GVAR_MISSIONTIME,gMissionTime);
      SC_sgi(GVAR_MISSIONTIME_UPDATE,SC_ggi(GVAR_MISSIONTIME_UPDATE)+1);      
   }// if (gMissionTime_update<0.0f)
}


void Check_ABL(void){
   int val;
   dword side,nr_to_change;
   s_SC_P_getinfo info;
   s_SC_MP_EnumPlayers enum_pl[64];
   dword i,j,k;


   if (!SC_MP_SRV_GetAutoTeamBalance()) return;

   val = SC_MP_SRV_GetTeamsNrDifference(TRUE);

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

   if (val>0){
      side = 0;
      nr_to_change = val/2;
   }
   else{
      side = 1;
      nr_to_change = -val/2;
   }
   

   // find nr_to_change players of beste players of side 0
   

   j = 64;

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

      if (!j) return;
      
      while(nr_to_change!=0){

         k = rand()%j;
         i = k;

         while(
            (enum_pl[i].id==0)
            ||(enum_pl[i].status==SC_MP_P_STATUS_NOTINGAME)){

            i++;
            if (i==j) i = 0;
            if (i==k) return;   // no valid found
         }                  

         SC_MP_SRV_P_SetSideClass(enum_pl[i].id,1-side,1 + 20*(1-side));
         enum_pl[i].id = 0;

         nr_to_change--;

      }// while(nr_to_change!=0)
                     
   }// if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL))



}// void Check_ABL(dword pl_handle)




int ScriptMain(s_SC_NET_info *info){
   char txt[32],*itxt;
   ushort *witxt;
   dword i,j;
   s_SC_MP_Recover *precov;
   s_SC_MP_hud hudinfo;
   s_SC_P_getinfo plinfo;
   float val,valy;
   void *nod;
   s_SC_MP_EnumPlayers enum_pl[64];
   int valid[2],active;
   dword pilot_pl_id;
   c_Vector3 pl_pos;
   s_SC_MP_SRV_settings SRVset;
   s_SC_HUD_MP_icon icon[3];
   dword icons;
   BOOL in_middle;
   s_SC_MP_SRV_AtgSettings atgset;

   switch(info->message){
      
      case SC_NET_MES_SERVER_TICK:         

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

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


         CLEAR(valid);
         j = 64;

         pilot_pl_id = 0;

         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_INGAME){
                  
                  if (enum_pl[i].side<2) valid[enum_pl[i].side] = TRUE;

               }// if (enum_pl[i].status==SC_MP_P_STATUS_INGAME)
                  
               
         }// if (SC_MP_EnumPlayers(enum_pl,&j,SC_MP_ENUMPLAYER_SIDE_ALL))
         

         switch(gPhase){
            case GPHASE_BEGIN:

               SC_MP_SetInstantRecovery(TRUE);

               gPhaseTimer += info->elapsed_time;

               if (gPhaseTimer<3.0f) break;

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

                  if (gPhaseTimer>10.0f){
                     Check_ABL();
                     SC_MP_SRV_InitGameAfterInactive();
                     SC_MP_RestartMission();                     
                  }
                  else{                     
                     gPhase = GPHASE_GAME;

                     SC_MP_SRV_GetAtgSettings(&atgset);
                     if (atgset.ATG_round_time>29.0f)
                        gMissionTime = atgset.ATG_round_time;                        
                     else
                        gMissionTime = 240.0f;

                     SRV_UpdateMissionTime(1000);
                  }

                  gPhaseTimer = 0.0f;

               }// switch(valid[0])               

               break;// GPHASE_BEGIN

            case GPHASE_GAME:

               SC_MP_SetInstantRecovery(FALSE);

               gPhaseTimer += info->elapsed_time;

               if (gPhaseTimer<4.0f) break;

               if (!valid[0]){
                  gSidePoints[1]++;
                  UpdateSidePoints();
                  gPhase = GPHASE_USKILLED;
                  gPhaseTimer = 5.0f;
               }
               else
               if (!valid[1]){
                  gSidePoints[0]++;
                  UpdateSidePoints();
                  gPhase = GPHASE_VCKILLED;
                  gPhaseTimer = 5.0f;
               }
               else{
                  // check pilot distance

                  gMissionTime -= info->elapsed_time;
                  SRV_UpdateMissionTime(info->elapsed_time);

                  if (gMissionTime<0.0f){                                                
                     gPhase = GPHASE_TIMEDONE;
                     gPhaseTimer = 5.0f;
                     gMissionTime = 0.0f;
                     SRV_UpdateMissionTime(1000);
                  }// if (gMissionTime<0.0f)
                     
               }

               break;// GPHASE_GAME

            default:

               
               SC_MP_SetInstantRecovery(FALSE);

               gPhaseTimer -= info->elapsed_time;

               if (gPhaseTimer<0){
                  Check_ABL();
                  SC_MP_RestartMission();
                  gPhase = GPHASE_BEGIN;
                  gPhaseTimer = 0.0f;
               }

               break;

         }// switch(gPhase)


         SRV_CheckUpdate();

         break;

      case SC_NET_MES_CLIENT_TICK:

         gCLN_SidePoints[0] = SC_ggi(GVAR_SIDE0POINTS);
         gCLN_SidePoints[1] = SC_ggi(GVAR_SIDE1POINTS);

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


         if (gCLN_MissionTimePrevID!=SC_ggi(GVAR_MISSIONTIME_UPDATE)){
            gCLN_MissionTimePrevID = SC_ggi(GVAR_MISSIONTIME_UPDATE);
            gCLN_MissionTime = SC_ggf(GVAR_MISSIONTIME);
         }
         else{
            gCLN_MissionTime -= info->elapsed_time;
         }


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



         icons = 2;

      
         if ((gCLN_MissionTime>0.0f)&&(SC_ggi(GVAR_PHASE)==GPHASE_GAME)){

            icon[icons].color = 0xbbffffff;
            icon[icons].icon_id = 6;
            icon[icons].value = (int)(gCLN_MissionTime+0.99f);               
            icon[icons].type = SC_HUD_MP_ICON_TYPE_TIME;
            icons++;
         }

         SC_MP_SetIconHUD(icon,icons);

         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_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)

         SC_MP_SRV_SetForceSide(0xffffffff);
         SC_MP_SetChooseValidSides(3);

         SC_MP_SRV_SetClassLimitsForDM();



         CLEAR(hudinfo);
         hudinfo.title = 1048;

         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] = 0x440000ff;
         hudinfo.side_name[1] = 1011;
         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);

         if (info->param2){

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


               SC_MP_SRV_InitWeaponsRecovery((float)SRVset.dm_weap_resp_time);
               SC_MP_Gvar_SetSynchro(GVAR_SIDE0POINTS);
               SC_MP_Gvar_SetSynchro(GVAR_SIDE1POINTS);
               UpdateSidePoints();

               SC_MP_Gvar_SetSynchro(GVAR_MISSIONTIME);
               SC_MP_Gvar_SetSynchro(GVAR_MISSIONTIME_UPDATE);


               SC_sgf(GVAR_MISSIONTIME,0.0f);
               SC_sgi(GVAR_MISSIONTIME_UPDATE,0);      

               SC_MP_Gvar_SetSynchro(GVAR_PHASE);
                                       
               
               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_ATG_US,&gRec[0][gRecs[0]],&i);
               gRecs[0] += i;
#endif
               SC_Log(3,"ATG S&D 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_ATG_VC,&gRec[1][gRecs[1]],&i);
               gRecs[1] += i;
#endif
               SC_Log(3,"ATG S&D respawns vc: %d",gRecs[0]);


               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:

         i = 0;

         in_middle = FALSE;
         switch(SC_ggi(GVAR_PHASE)){
            case GPHASE_BEGIN:i = 1076;break;            
            case GPHASE_VCKILLED:i = 1096;in_middle = TRUE;break;
            case GPHASE_USKILLED:i = 1047;in_middle = TRUE;break;
            case GPHASE_TIMEDONE:i = 1046;in_middle = TRUE;break;
         }// switch(SC_ggi(GVAR_PHASE))

         if (i){

            witxt = SC_Wtxt(i);
            SC_GetScreenRes(&val,&valy);

            val -= SC_Fnt_GetWidthW(witxt,1);

            if (in_middle) valy = 0.5f * valy - 40.0f;
               else valy = 15;

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

         }//if (i)

               
         break;

      case SC_NET_MES_SERVER_RECOVER_TIME:

         SC_MP_SRV_GetAtgSettings(&atgset);
                  
         
         if ((gPhase==GPHASE_GAME)
               &&((gMissionTime+10.0f)<atgset.ATG_round_time)){
            info->fval1 = SC_NET_SERVER_RECTIME_ENDOFROUND;
         }
         else
         if (gPhase==GPHASE_BEGIN){
            info->fval1 = 0.1f;
         }
         else
         if (info->param2){
               info->fval1 = 0.1f;
         }
         else{
            // killed
            info->fval1 = -1.0f;
         }

         break;

      case SC_NET_MES_SERVER_RECOVER_PLACE:

         precov = (s_SC_MP_Recover*)info->param2;

         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:


         break;// SC_NET_MES_SERVER_KILL

      case SC_NET_MES_MESSAGE:

         break;

      case SC_NET_MES_RESTARTMAP:

         CLEAR(gSidePoints);         
         UpdateSidePoints();

         gPhase = GPHASE_BEGIN;
         gPhaseTimer = 0.0f;

         gTime = 0;

         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)





Credits: "={VFG}= Snake" for developing this gamemode
Edited by Silent Bob on 03-12-2014 10:23
  x 1
 
www.vietcong.info
VCG john
Vielen lieben Dank Bob Smile
Signature#VCG_freddy
Mail: vietcongguys@gmail.com
Facebook: fb.com/vcgfreddy
VCG_Page: fb.com/vcg31
Vietcong Guild: https://discord.gg/mXaXG2P
Vietcong Messenger: https://vietcongmessenger.mn.co
 
https://vietcongmessenger.mn.co
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
Multiplayer Game Script Vietcong Tech Talk 4 22-06-2019 19:31
MP sync. script discussion Maps & Mapping 89 26-04-2016 09:40
Ando door script Maps & Mapping 4 25-10-2015 19:50
Waterstation - DM script Maps & Mapping 5 20-07-2013 02:18
Script troubles Maps & Mapping 4 02-02-2013 11:44
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Render time: 0.20 seconds - 51 Queries 4,883,104 unique visits