Raised This Month: $ Target: $400
 0% 

View Poll Results: Do you like a mod like what i say?..
Yes 5 100.00%
No 0 0%
I don't understand 0 0%
Voters: 5. You may not vote on this poll

Csdm mod


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
raducubex
Junior Member
Join Date: Feb 2009
Old 04-14-2009 , 08:00   Re: Csdm mod
Reply With Quote #1

SRy of double post...PoSiTiOn Of PoWeR do this for me..if you like it +karma me
Copyright of PoSiTiOn Of PoWeR and Alka


Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Only One Team"
#define VERSION "1.0"
#define AUTHOR "Alka"

enum {
   Yes = 1,
   No = 0,
   
   T = 1,
   CT = 2
}

//Select what team can only have spawn points
//T - Terrorist , CT - Counter_Terrorist
new OnlyTeamId = CT;

//If you think that current map doesn't have enaugh
//spawn points, set this to "Yes", and the spawn points for
//specified team will be doubled.
new DoubleSpawnPoints = No;

//If you want to see where are empty/ not empty spots, while
//spawning the ents points, set this to "Yes".
new Debug = No;

new const TsSpawnClassname[] = "info_player_deathmatch";
new const CtSpawnClassname[] = "info_player_start";

new const SpawnModel[] = "models/player/vip/vip.mdl";

new FwdSpawnId;

#define OFFSET_TEAM   114
#define fm_cs_get_user_team(%1) get_pdata_int(%1, OFFSET_TEAM)

#define MAX_CLIENTS 32
new bool:TeamKill[MAX_CLIENTS + 1]

public plugin_init() {
   
   register_plugin(PLUGIN, VERSION, AUTHOR);
   
   unregister_forward(FM_Spawn, FwdSpawnId, 0);
   
   register_clcmd("say /drawspawns", "DrawSpawnPoints");
   
   register_event("DeathMsg", "EventDeathMsg", "a")
   register_message(get_user_msgid("TextMsg"), "Block_TextMsg")
   register_message(get_user_msgid("ScoreInfo"), "ScoreInfo")
}

public plugin_precache()
{
   FwdSpawnId = register_forward(FM_Spawn, "Fwd_Spawn", 0);
   
   precache_model(SpawnModel);
   
   set_task(3.0, "ShowSpawnPointsNum", 3355910);
}

public Fwd_Spawn(Ent)
{
   if(!pev_valid(Ent))
      return FMRES_IGNORED;
   
   static szClassname[32];
   pev(Ent, pev_classname, szClassname, sizeof szClassname - 1);
   
   switch(OnlyTeamId)
   {
      case 0 : { return FMRES_IGNORED; }
      case 1 :
      {
         if(equali(szClassname, CtSpawnClassname))
         {
            set_pev(Ent, pev_flags, pev(Ent, pev_flags) | FL_KILLME);
            return FMRES_OVERRIDE;
         }
         else if(equali(szClassname, TsSpawnClassname) && DoubleSpawnPoints)
         {
            for(new i = 0 ; i < 10 ; i++)
            {
               static Float:Origin[3];
               
               if(FindEmptySpot(Ent, Origin))
               {
                  static Float:Angles[3];
                  pev(Ent, pev_angles, Angles);
                  
                  new SpEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, TsSpawnClassname));
                  
                  if(!SpEnt)
                     return FMRES_IGNORED;
                  
                  engfunc(EngFunc_SetOrigin, SpEnt, Origin);
                  set_pev(SpEnt, pev_angles, Angles);
                  
                  dllfunc(DLLFunc_Spawn, SpEnt);
                  
                  break;
               }
            }
         }
      }
      case 2 :
      {
         if(equali(szClassname, TsSpawnClassname))
         {
            set_pev(Ent, pev_flags, pev(Ent, pev_flags) | FL_KILLME);
            return FMRES_OVERRIDE;
         }
         else if(equali(szClassname, CtSpawnClassname) && DoubleSpawnPoints)
         {
            for(new i = 0 ; i < 10 ; i++)
            {
               static Float:Origin[3];
               
               if(FindEmptySpot(Ent, Origin))
               {
                  static Float:Angles[3];
                  pev(Ent, pev_angles, Angles);
                  
                  new SpEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, CtSpawnClassname));
                  
                  if(!SpEnt)
                     return FMRES_IGNORED;
                  
                  engfunc(EngFunc_SetOrigin, SpEnt, Origin);
                  set_pev(SpEnt, pev_angles, Angles);
                  
                  dllfunc(DLLFunc_Spawn, SpEnt);
                  
                  break;
               }
            }
         }
      }
      case 3 : { return FMRES_IGNORED; }
   }
   return FMRES_IGNORED;
}

public ShowSpawnPointsNum()
{
   static Ent = -1;
   static EntsNum[2];
   
   while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", TsSpawnClassname)) != 0)
      EntsNum[0]++;
   
   while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", CtSpawnClassname)) != 0)
      EntsNum[1]++;
   
   server_print("[Spawn Points]In server there are %d T's | %d CT's spawn points. (Double Spawn Points : %s)", EntsNum[0], EntsNum[1], DoubleSpawnPoints ? "Enabled" : "Disabled");
}

public DrawSpawnPoints(id)
{
   if(!(get_user_flags(id) & ADMIN_IMMUNITY))
      return 1;
   
   static bool:HasTyped;
   
   if(!HasTyped)
   {
      static Ent = -1;
      
      while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", TsSpawnClassname)) != 0)
      {
         engfunc(EngFunc_SetModel, Ent, SpawnModel);
         set_pev(Ent, pev_effects, pev(Ent, pev_effects) & ~EF_NODRAW);
      }
      
      while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", CtSpawnClassname)) != 0)
      {
         engfunc(EngFunc_SetModel, Ent, SpawnModel);
         set_pev(Ent, pev_effects, pev(Ent, pev_effects) & ~EF_NODRAW);
      }
      HasTyped = true;
   }
   else
   {
      static Ent = -1;
      
      while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", TsSpawnClassname)) != 0)
         set_pev(Ent, pev_effects, pev(Ent, pev_effects) | EF_NODRAW);
      
      while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", CtSpawnClassname)) != 0)
         set_pev(Ent, pev_effects, pev(Ent, pev_effects) | EF_NODRAW);
      
      HasTyped = false;
   }
   return 1;
}

public client_putinserver(id)
{
   TeamKill[id] = false;
}
public EventDeathMsg()
{
   new Killer = read_data(1);
   new Victim = read_data(2);
        
   if(get_user_team(Killer) == get_user_team(Victim))
   {
      TeamKill[Killer] = true;
   }
}

public Block_TextMsg(msg_id, msg_type, msg_idd)
{
        if(get_msg_arg_int(1) == print_notify)
        {
            return PLUGIN_CONTINUE;
        }
    
        static s_Message[22];
        get_msg_arg_string(2, s_Message, charsmax(s_Message));
        
        if(equal(s_Message, "#Game_teammate_attack") || equal(s_Message, "#Killed_Teammate") || equal(s_Message, "#Game_teammate_kills"))
        {
            return PLUGIN_HANDLED;
        }
        
        return PLUGIN_CONTINUE;
}

public ScoreInfo(msg_id, msg_type, msg_idd)
{
   new id = get_msg_arg_int(1);
 
   if(TeamKill[id])
   {
      TeamKill[id] = false;
      new CurrentFrag = get_msg_arg_int(2);
            
      CurrentFrag += 1 + 1;
            
      set_pev(id, pev_frags, CurrentFrag * 1.0);
      set_msg_arg_int(2, ARG_SHORT, CurrentFrag);
   }
}
   
stock bool:HullVacant(Float:Origin[3], Ent)
{
   new tr;
   engfunc(EngFunc_TraceHull, Origin, Origin, 0, HULL_HUMAN, Ent, tr);
   
   if(!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid))
      return true;
   
   return false;
}

stock FindEmptySpot(EntIndex, Float:Origin[3])
{
   static Float:EntOrigin[3];
   pev(EntIndex, pev_origin, EntOrigin);
   
   static Float:Num = 100.0;
   
   for(new x = 0 ; x < 2 ; x++)
   {
      EntOrigin[x] += random_float(-Num, Num);
   }
   
   if(HullVacant(EntOrigin, EntIndex))
   {
      if(Debug)
         server_print("[Spawn Points]Fined an empty spot at (%.1f %.1f %.1f), spawning ent.", EntOrigin[0], EntOrigin[1], EntOrigin[2]);
      
      Origin = EntOrigin;
      return 1;
   }
   else
   {
      if(Debug)
         server_print("[Spawn Points]Not an empty spot at (%.1f %.1f %.1f), researching.", EntOrigin[0], EntOrigin[1], EntOrigin[2]);
   }
   
   return 0;
}
10x

Last edited by raducubex; 04-14-2009 at 14:58.
raducubex is offline
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 04-14-2009 , 14:55   Re: Csdm mod
Reply With Quote #2

It's hard to read Your code above. Use tags [ c o d e ] and [ / c o d e ] (without spaces) - at beginning and at the end of it - to make it more readable.
Quote:
Originally Posted by raducubex View Post
SRy of double post...PoSiTiOn Of PoWeR do this for me..if you like it +karma me
Copyright of PoSiTiOn Of PoWeR and Alka

Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Only One Team"
#define VERSION "1.0"
#define AUTHOR "Alka"

enum {
   Yes = 1,
   No = 0,
   
   T = 1,
   CT = 2
}

//Select what team can only have spawn points
//T - Terrorist , CT - Counter_Terrorist
new OnlyTeamId = CT;

//If you think that current map doesn't have enaugh
//spawn points, set this to "Yes", and the spawn points for
//specified team will be doubled.
new DoubleSpawnPoints = No;

//If you want to see where are empty/ not empty spots, while
//spawning the ents points, set this to "Yes".
new Debug = No;

new const TsSpawnClassname[] = "info_player_deathmatch";
new const CtSpawnClassname[] = "info_player_start";

new const SpawnModel[] = "models/player/vip/vip.mdl";

new FwdSpawnId;

#define OFFSET_TEAM   114
#define fm_cs_get_user_team(%1) get_pdata_int(%1, OFFSET_TEAM)

#define MAX_CLIENTS 32
new bool:TeamKill[MAX_CLIENTS + 1]

public plugin_init() {
   
   register_plugin(PLUGIN, VERSION, AUTHOR);
   
   unregister_forward(FM_Spawn, FwdSpawnId, 0);
   
   register_clcmd("say /drawspawns", "DrawSpawnPoints");
   
   register_event("DeathMsg", "EventDeathMsg", "a")
   register_message(get_user_msgid("TextMsg"), "Block_TextMsg")
   register_message(get_user_msgid("ScoreInfo"), "ScoreInfo")
}

public plugin_precache()
{
   FwdSpawnId = register_forward(FM_Spawn, "Fwd_Spawn", 0);
   
   precache_model(SpawnModel);
   
   set_task(3.0, "ShowSpawnPointsNum", 3355910);
}

public Fwd_Spawn(Ent)
{
   if(!pev_valid(Ent))
      return FMRES_IGNORED;
   
   static szClassname[32];
   pev(Ent, pev_classname, szClassname, sizeof szClassname - 1);
   
   switch(OnlyTeamId)
   {
      case 0 : { return FMRES_IGNORED; }
      case 1 :
      {
         if(equali(szClassname, CtSpawnClassname))
         {
            set_pev(Ent, pev_flags, pev(Ent, pev_flags) | FL_KILLME);
            return FMRES_OVERRIDE;
         }
         else if(equali(szClassname, TsSpawnClassname) && DoubleSpawnPoints)
         {
            for(new i = 0 ; i < 10 ; i++)
            {
               static Float:Origin[3];
               
               if(FindEmptySpot(Ent, Origin))
               {
                  static Float:Angles[3];
                  pev(Ent, pev_angles, Angles);
                  
                  new SpEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, TsSpawnClassname));
                  
                  if(!SpEnt)
                     return FMRES_IGNORED;
                  
                  engfunc(EngFunc_SetOrigin, SpEnt, Origin);
                  set_pev(SpEnt, pev_angles, Angles);
                  
                  dllfunc(DLLFunc_Spawn, SpEnt);
                  
                  break;
               }
            }
         }
      }
      case 2 :
      {
         if(equali(szClassname, TsSpawnClassname))
         {
            set_pev(Ent, pev_flags, pev(Ent, pev_flags) | FL_KILLME);
            return FMRES_OVERRIDE;
         }
         else if(equali(szClassname, CtSpawnClassname) && DoubleSpawnPoints)
         {
            for(new i = 0 ; i < 10 ; i++)
            {
               static Float:Origin[3];
               
               if(FindEmptySpot(Ent, Origin))
               {
                  static Float:Angles[3];
                  pev(Ent, pev_angles, Angles);
                  
                  new SpEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, CtSpawnClassname));
                  
                  if(!SpEnt)
                     return FMRES_IGNORED;
                  
                  engfunc(EngFunc_SetOrigin, SpEnt, Origin);
                  set_pev(SpEnt, pev_angles, Angles);
                  
                  dllfunc(DLLFunc_Spawn, SpEnt);
                  
                  break;
               }
            }
         }
      }
      case 3 : { return FMRES_IGNORED; }
   }
   return FMRES_IGNORED;
}

public ShowSpawnPointsNum()
{
   static Ent = -1;
   static EntsNum[2];
   
   while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", TsSpawnClassname)) != 0)
      EntsNum[0]++;
   
   while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", CtSpawnClassname)) != 0)
      EntsNum[1]++;
   
   server_print("[Spawn Points]In server there are %d T's | %d CT's spawn points. (Double Spawn Points : %s)", EntsNum[0], EntsNum[1], DoubleSpawnPoints ? "Enabled" : "Disabled");
}

public DrawSpawnPoints(id)
{
   if(!(get_user_flags(id) & ADMIN_IMMUNITY))
      return 1;
   
   static bool:HasTyped;
   
   if(!HasTyped)
   {
      static Ent = -1;
      
      while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", TsSpawnClassname)) != 0)
      {
         engfunc(EngFunc_SetModel, Ent, SpawnModel);
         set_pev(Ent, pev_effects, pev(Ent, pev_effects) & ~EF_NODRAW);
      }
      
      while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", CtSpawnClassname)) != 0)
      {
         engfunc(EngFunc_SetModel, Ent, SpawnModel);
         set_pev(Ent, pev_effects, pev(Ent, pev_effects) & ~EF_NODRAW);
      }
      HasTyped = true;
   }
   else
   {
      static Ent = -1;
      
      while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", TsSpawnClassname)) != 0)
         set_pev(Ent, pev_effects, pev(Ent, pev_effects) | EF_NODRAW);
      
      while((Ent = engfunc(EngFunc_FindEntityByString, Ent, "classname", CtSpawnClassname)) != 0)
         set_pev(Ent, pev_effects, pev(Ent, pev_effects) | EF_NODRAW);
      
      HasTyped = false;
   }
   return 1;
}

public client_putinserver(id)
{
   TeamKill[id] = false;
}
public EventDeathMsg()
{
   new Killer = read_data(1);
   new Victim = read_data(2);
        
   if(get_user_team(Killer) == get_user_team(Victim))
   {
      TeamKill[Killer] = true;
   }
}

public Block_TextMsg(msg_id, msg_type, msg_idd)
{
        if(get_msg_arg_int(1) == print_notify)
        {
            return PLUGIN_CONTINUE;
        }
    
        static s_Message[22];
        get_msg_arg_string(2, s_Message, charsmax(s_Message));
        
        if(equal(s_Message, "#Game_teammate_attack") || equal(s_Message, "#Killed_Teammate") || equal(s_Message, "#Game_teammate_kills"))
        {
            return PLUGIN_HANDLED;
        }
        
        return PLUGIN_CONTINUE;
}

public ScoreInfo(msg_id, msg_type, msg_idd)
{
   new id = get_msg_arg_int(1);
 
   if(TeamKill[id])
   {
      TeamKill[id] = false;
      new CurrentFrag = get_msg_arg_int(2);
            
      CurrentFrag += 1 + 1;
            
      set_pev(id, pev_frags, CurrentFrag * 1.0);
      set_msg_arg_int(2, ARG_SHORT, CurrentFrag);
   }
}
   
stock bool:HullVacant(Float:Origin[3], Ent)
{
   new tr;
   engfunc(EngFunc_TraceHull, Origin, Origin, 0, HULL_HUMAN, Ent, tr);
   
   if(!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid))
      return true;
   
   return false;
}

stock FindEmptySpot(EntIndex, Float:Origin[3])
{
   static Float:EntOrigin[3];
   pev(EntIndex, pev_origin, EntOrigin);
   
   static Float:Num = 100.0;
   
   for(new x = 0 ; x < 2 ; x++)
   {
      EntOrigin[x] += random_float(-Num, Num);
   }
   
   if(HullVacant(EntOrigin, EntIndex))
   {
      if(Debug)
         server_print("[Spawn Points]Fined an empty spot at (%.1f %.1f %.1f), spawning ent.", EntOrigin[0], EntOrigin[1], EntOrigin[2]);
      
      Origin = EntOrigin;
      return 1;
   }
   else
   {
      if(Debug)
         server_print("[Spawn Points]Not an empty spot at (%.1f %.1f %.1f), researching.", EntOrigin[0], EntOrigin[1], EntOrigin[2]);
   }
   
   return 0;
}
10x
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.
KWo is offline
raducubex
Junior Member
Join Date: Feb 2009
Old 04-14-2009 , 14:58   Re: Csdm mod
Reply With Quote #3

OK...how you say
raducubex is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:35.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode