Page 1 of 1

[Cerere Plugin] CT vs T

Posted: 09 Feb 2019, 03:31
by goeslegendary
Plugin Cerut: 1CT vs 1T
Descriere (adica ce face el mai exact): odata pe mapa, se va alege aleatoriu cineva din echipa CT si cineva din echipa T care sa fie "CT = Predator" vs "T =Alien", la T sa dea +5000 HP si la CT sa dea unlimited ammo clip, si totodata la T sa dea glow rosu si la CT albastru, daca se poate, multumesc!
Serverul ruleaza (HLDS/ReHLDS): -
Versiune AMX Mod X: -
Modul Serverului: -

Re: [Cerere Plugin] CT vs T

Posted: 09 Feb 2019, 15:36
by levin
| Afiseaza codul
[code]
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <hamsandwich>

#pragma tabsize 0

#define PLUGIN "Alien vs Predator"
#define VERSION "3.0.6"//parc
#define AUTHOR "Aragon*"//+

#define _random(%1) random_num(0, %1 - 1)

new bool:IsAlien[33];
new bool:IsPredator[33];
new bool:played=true

new cvar_alien_health

// weapons offsets
#define OFFSET_CLIPAMMO        51
#define OFFSET_LINUX_WEAPONS    4
#define fm_cs_set_weapon_ammo(%1,%2)    set_pdata_int(%1, OFFSET_CLIPAMMO, %2, OFFSET_LINUX_WEAPONS)

// players offsets
#define m_pActiveItem 373

const NOCLIP_WPN_BS    = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))

new const g_MaxClipAmmo[] = 
{
    0,
    13, //CSW_P228
    0,
    10, //CSW_SCOUT
    0,  //CSW_HEGRENADE
    7,  //CSW_XM1014
    0,  //CSW_C4
    30,//CSW_MAC10
    30, //CSW_AUG
    0,  //CSW_SMOKEGRENADE
    15,//CSW_ELITE
    20,//CSW_FIVESEVEN
    25,//CSW_UMP45
    30, //CSW_SG550
    35, //CSW_GALIL
    25, //CSW_FAMAS
    12,//CSW_USP
    20,//CSW_GLOCK18
    10, //CSW_AWP
    30,//CSW_MP5NAVY
    100,//CSW_M249
    8,  //CSW_M3
    30, //CSW_M4A1
    30,//CSW_TMP
    20, //CSW_G3SG1
    0,  //CSW_FLASHBANG
    7,  //CSW_DEAGLE
    30, //CSW_SG552
    30, //CSW_AK47
    0,  //CSW_KNIFE
    50//CSW_P90
}

new bool:uac[33]

public plugin_init() {	
	register_logevent("LOGEVENT_RoundStart", 2, "1=Round_Start");
	
	register_event("DeathMsg", "EVENT_DeathMsg", "a");
	register_event("CurWeapon" , "Event_CurWeapon" , "be" , "1=1" );
	
	RegisterHam(Ham_Spawn, "player", "HAM_Spawn_Post", 1);
	
	cvar_alien_health = register_cvar("furien30_alien_health", "5000");		//| Alien Health |//
}

public Event_CurWeapon( id )
{
if(is_user_alive(id)&&get_user_team(id)==2&&played&&IsPredator[id]&&uac[id])
{
    new iWeapon = read_data(2)
    if( !( NOCLIP_WPN_BS & (1<<iWeapon) ) )	fm_cs_set_weapon_ammo( get_pdata_cbase(id, m_pActiveItem) , g_MaxClipAmmo[ iWeapon ] )
}
}

public client_disconnect(id) {
	IsAlien[id] = false;
	IsPredator[id] = false;
	uac[id]=false
}

public LOGEVENT_RoundStart() {
	static id;
	for(id = 1; id <= get_maxplayers(); id++) {
		if(is_user_connected(id)) {
			IsAlien[id] = false;
			IsPredator[id] = false;
			uac[id]=false
		}
	}
	if(get_playersnum()>=2&&played)
	{
	SearchForAlien();
	SearchForPredator();

	played=false
	}
}

public EVENT_DeathMsg() {
	new victim = read_data(2)
	
	if(is_user_connected(victim)) {
		IsAlien[victim] = false;
		IsPredator[victim] = false;
		uac[victim]=false
	}
}

public HAM_Spawn_Post(id) {
	IsAlien[id] = false;
	IsPredator[id] = false;
	uac[id]=false
}

public SearchForAlien() {
	static Players[32], Num
	get_players(Players, Num, "ace", "TERRORIST")
	new id = Players[random_num(0, Num)]
	
	if(is_user_alive(id) && get_user_team(id) == 1) {

		IsAlien[id] = true;
		
		set_hudmessage(0, 0, 255, 0.0, 0.0, 0, 6.0, 12.0)
		show_hudmessage(id, "")
		ColorChat(0,"!t%s!g s-a transformat in!t Alien.", get_name(id));
		
		new Message[256];
		format(Message,sizeof(Message)-1,"%s s-a transformat in Alien!", get_name(id));
		HudMessage(0, Message)
		
		set_user_health(id, get_user_health(id)+get_pcvar_num(cvar_alien_health))
		
		set_user_rendering(id,kRenderFxGlowShell,255, 0, 0,kRenderNormal,16)
	}
}
public SearchForPredator() {
	static Players[32], Num
	get_players(Players, Num, "ace", "CT")
	new id = Players[random_num(0, Num)]
	
	if( is_user_alive(id) && get_user_team(id) == 2) {

		IsPredator[id] = true;
		
		ColorChat(0,"!t%s!g s-a transformat in!t Predator.", get_name(id));
		
		new Message[256];
		format(Message,sizeof(Message)-1,"%s s-a transformat in Predator!", get_name(id));
		HudMessage(0, Message, _, _, _, _, 0.60)
		
		set_user_rendering(id,kRenderFxGlowShell,0, 0 ,255,kRenderNormal,16)
		
		uac[id]=false
	}
}

stock get_name(id) {
	new name[32];
	get_user_name(id, name, sizeof (name) -1);
	
	return name;
}

#define clamp_byte(%1)       (clamp(%1, 0, 255))
#define pack_color(%1,%2,%3) (%3 + (%2 << 8) + (%1 << 16))

stock HudMessage(const id, const message[], red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 0.01, Float:holdtime = 3.0, Float:fadeintime = 0.01, Float:fadeouttime = 0.01) {
	new count = 1, players[32];
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
		for(new i = 0; i < count; i++) {
			if(is_user_connected(players)) {	
				new color = pack_color(clamp_byte(red), clamp_byte(green), clamp_byte(blue))
				
				message_begin(MSG_ONE_UNRELIABLE, SVC_DIRECTOR, _, players);
				write_byte(strlen(message) + 31);
				write_byte(DRC_CMD_MESSAGE);
				write_byte(effects);
				write_long(color);
				write_long(_:x);
				write_long(_:y);
				write_long(_:fadeintime);
				write_long(_:fadeouttime);
				write_long(_:holdtime);
				write_long(_:fxtime);
				write_string(message);
				message_end();
			}
		}
	}
}

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4");
	replace_all(msg, 190, "!y", "^1");
	replace_all(msg, 190, "!t", "^3");
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
		for(new i = 0; i < count; i++) {
			if(is_user_connected(players)) {
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
				write_byte(players);
				write_string(msg);
				message_end();
			}
		}
	} 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/[/code]

Re: [Cerere Plugin] CT vs T

Posted: 12 Feb 2019, 02:14
by LondoN eXtream
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <hamsandwich>

#define is_user_valid(%1) (1 <= %1 <= get_maxplayers())
#define is_user_ok(%1) (is_user_valid(%1) && is_user_alive(%1))

#if cellbits == 32
const OFFSET_CLIPAMMO = 51;
#else
const OFFSET_CLIPAMMO = 65;
#endif
const OFFSET_LINUX_WEAPONS = 4;

new Players[32], iNum;
new g_name[33][32];
new bool: g_unlimited[33], bool: has_glow[33];

new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
			10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

public plugin_init()
{
	register_logevent("RoundStart", 2, "1=Round_Start");
	RegisterHam(Ham_Spawn, "player", "HamPlayerSpawn_Post", 1);
	register_message(get_user_msgid("CurWeapon"), "user_unlimited");
}

public user_unlimited(msg_id, msg_dest, msg_entity)
{
	if(!g_unlimited[msg_entity] || !is_user_ok(msg_entity) || get_msg_arg_int(1) != 1)
		return;

	static weapon; weapon = get_msg_arg_int(2);
	static clip;	clip = get_msg_arg_int(3);

	if(MAXCLIP[weapon] > 2)
	{
		set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]);
		
		if(clip < 2)
		{
			static wname[32], weapon_ent;
			get_weaponname(weapon, wname, charsmax(wname));
			weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity);

			set_pdata_int(weapon_ent, OFFSET_CLIPAMMO, MAXCLIP[weapon], OFFSET_LINUX_WEAPONS);
		}
	}
}

public HamPlayerSpawn_Post(Player)
{
	if(!is_user_ok(Player))
		return;

	if(has_glow[Player])
	{
		has_glow[Player] = false;
		set_user_rendering(Player, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25);
	}

	if(g_unlimited[Player])
	{
		g_unlimited[Player] = false;
	}
}

public client_connect(Player)
{
	if(is_user_bot(Player) || is_user_hltv(Player))
		return;

	get_user_name(Player, g_name[Player], charsmax(g_name));
}

public RoundStart()
{
	GetRandomTero();
	GetRandomCT();
}

public GetRandomTero()
{
	get_players(Players, iNum, "ace", "TERRORIST");
	new Player = Players[random_num(0, iNum)];

	if(is_user_ok(Player))
	{
		has_glow[Player] = true;
		set_user_health(Player, get_user_health(Player) + 5000);
		set_user_rendering(Player, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 16);	
		Print(0, "^x04[ALIEN vs PREDATOR]^x03 %s^x01 a fost ales^x04 ALIEN^x01 si a primit^x03 5000 HP", g_name[Player]);
	}
}

public GetRandomCT()
{
	get_players(Players, iNum, "ace", "CT");
	new Player = Players[random_num(0, iNum)];

	if(is_user_ok(Player))
	{
		has_glow[Player] = true;
		g_unlimited[Player] = true;
		set_user_rendering(Player, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 16);
		Print(0, "^x04[ALIEN vs PREDATOR]^x03 %s^x01 a fost ales^x04 PREDATOR^x01 si a primit^x03 Unlimited Clip", g_name[Player]);
	}
}

stock fm_find_ent_by_owner(entity, const classname[], owner)
{
	while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
	
	return entity;
}

stock Print(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
		for(new i = 0; i < count; i++) {
			if(is_user_connected(players)) {
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
				write_byte(players);
				write_string(msg);
				message_end();
			}
		}
	}
}

Re: [Cerere Plugin] CT vs T

Posted: 12 Feb 2019, 20:29
by goeslegendary
levin, al tau nu merge
london al tau merge dar cateodata daca sunt CT imi da 5k hp ci nu unlimited si invers

Re: [Cerere Plugin] CT vs T

Posted: 16 Feb 2019, 03:01
by levin
| Afiseaza codul
[code]
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <hamsandwich>

#pragma tabsize 0

#define PLUGIN "Alien vs Predator"
#define VERSION "3.0.6"//parc
#define AUTHOR "Aragon*"//+

#define _random(%1) random_num(0, %1 - 1)

new bool:IsAlien[33];
new bool:IsPredator[33];
new bool:played=false

new cvar_alien_health

// weapons offsets
#define OFFSET_CLIPAMMO        51
#define OFFSET_LINUX_WEAPONS    4
#define fm_cs_set_weapon_ammo(%1,%2)    set_pdata_int(%1, OFFSET_CLIPAMMO, %2, OFFSET_LINUX_WEAPONS)

// players offsets
#define m_pActiveItem 373

const NOCLIP_WPN_BS    = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))

new const g_MaxClipAmmo[] = 
{
    0,
    13, //CSW_P228
    0,
    10, //CSW_SCOUT
    0,  //CSW_HEGRENADE
    7,  //CSW_XM1014
    0,  //CSW_C4
    30,//CSW_MAC10
    30, //CSW_AUG
    0,  //CSW_SMOKEGRENADE
    15,//CSW_ELITE
    20,//CSW_FIVESEVEN
    25,//CSW_UMP45
    30, //CSW_SG550
    35, //CSW_GALIL
    25, //CSW_FAMAS
    12,//CSW_USP
    20,//CSW_GLOCK18
    10, //CSW_AWP
    30,//CSW_MP5NAVY
    100,//CSW_M249
    8,  //CSW_M3
    30, //CSW_M4A1
    30,//CSW_TMP
    20, //CSW_G3SG1
    0,  //CSW_FLASHBANG
    7,  //CSW_DEAGLE
    30, //CSW_SG552
    30, //CSW_AK47
    0,  //CSW_KNIFE
    50//CSW_P90
}

new bool:uac[33]

public plugin_init() {   
   register_logevent("LOGEVENT_RoundStart", 2, "1=Round_Start");
   
   register_event("DeathMsg", "EVENT_DeathMsg", "a");
   register_event("CurWeapon" , "Event_CurWeapon" , "be" , "1=1" );
   
   RegisterHam(Ham_Spawn, "player", "HAM_Spawn_Post", 1);
   
   cvar_alien_health = register_cvar("furien30_alien_health", "5000");      //| Alien Health |//
}

public Event_CurWeapon( id )
{
if(is_user_alive(id)&&get_user_team(id)==2&&played&&IsPredator[id]&&uac[id])
{
    new iWeapon = read_data(2)
    if( !( NOCLIP_WPN_BS & (1<<iWeapon) ) )   fm_cs_set_weapon_ammo( get_pdata_cbase(id, m_pActiveItem) , g_MaxClipAmmo[ iWeapon ] )
}
}

public client_disconnect(id) {
   IsAlien[id] = false;
   IsPredator[id] = false;
   uac[id]=false
}

public LOGEVENT_RoundStart() {
   static id;
   for(id = 1; id <= get_maxplayers(); id++) {
      if(is_user_connected(id)) {
         IsAlien[id] = false;
         IsPredator[id] = false;
         uac[id]=false
      }
   }
   if(get_playersnum()>=2&&!played)
   {
   SearchForAlien();
   SearchForPredator();

   played=true
   }
}

public EVENT_DeathMsg() {
   new victim = read_data(2)
   
   if(is_user_connected(victim)) {
      IsAlien[victim] = false;
      IsPredator[victim] = false;
      uac[victim]=false
   }
}

public HAM_Spawn_Post(id) {
   IsAlien[id] = false;
   IsPredator[id] = false;
   uac[id]=false
}

public SearchForAlien() {
   static Players[32], Num
   get_players(Players, Num, "ace", "TERRORIST")
   new id = Players[random_num(0, Num)]
   
   if(is_user_alive(id) && get_user_team(id) == 1) {

      IsAlien[id] = true;
      
      set_hudmessage(0, 0, 255, 0.0, 0.0, 0, 6.0, 12.0)
      show_hudmessage(id, "")
      ColorChat(0,"!t%s!g s-a transformat in!t Alien.", get_name(id));
      
      new Message[256];
      format(Message,sizeof(Message)-1,"%s s-a transformat in Alien!", get_name(id));
      HudMessage(0, Message)
      
      set_user_health(id, get_user_health(id)+get_pcvar_num(cvar_alien_health))
      
      set_user_rendering(id,kRenderFxGlowShell,255, 0, 0,kRenderNormal,16)
   }
}
public SearchForPredator() {
   static Players[32], Num
   get_players(Players, Num, "ace", "CT")
   new id = Players[random_num(0, Num)]
   
   if( is_user_alive(id) && get_user_team(id) == 2) {

      IsPredator[id] = true;
      
      ColorChat(0,"!t%s!g s-a transformat in!t Predator.", get_name(id));
      
      new Message[256];
      format(Message,sizeof(Message)-1,"%s s-a transformat in Predator!", get_name(id));
      HudMessage(0, Message, _, _, _, _, 0.60)
      
      set_user_rendering(id,kRenderFxGlowShell,0, 0 ,255,kRenderNormal,16)
      
      uac[id]=false
   }
}

stock get_name(id) {
   new name[32];
   get_user_name(id, name, sizeof (name) -1);
   
   return name;
}

#define clamp_byte(%1)       (clamp(%1, 0, 255))
#define pack_color(%1,%2,%3) (%3 + (%2 << 8) + (%1 << 16))

stock HudMessage(const id, const message[], red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 0.01, Float:holdtime = 3.0, Float:fadeintime = 0.01, Float:fadeouttime = 0.01) {
   new count = 1, players[32];
   
   if(id) players[0] = id;
   else get_players(players, count, "ch"); {
      for(new i = 0; i < count; i++) {
         if(is_user_connected(players)) {   
            new color = pack_color(clamp_byte(red), clamp_byte(green), clamp_byte(blue))
            
            message_begin(MSG_ONE_UNRELIABLE, SVC_DIRECTOR, _, players);
            write_byte(strlen(message) + 31);
            write_byte(DRC_CMD_MESSAGE);
            write_byte(effects);
            write_long(color);
            write_long(_:x);
            write_long(_:y);
            write_long(_:fadeintime);
            write_long(_:fadeouttime);
            write_long(_:holdtime);
            write_long(_:fxtime);
            write_string(message);
            message_end();
         }
      }
   }
}

stock ColorChat(const id, const input[], any:...) {
   new count = 1, players[32];
   static msg[191];
   vformat(msg, 190, input, 3);
   
   replace_all(msg, 190, "!g", "^4");
   replace_all(msg, 190, "!y", "^1");
   replace_all(msg, 190, "!t", "^3");
   
   if(id) players[0] = id;
   else get_players(players, count, "ch"); {
      for(new i = 0; i < count; i++) {
         if(is_user_connected(players)) {
            message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
            write_byte(players);
            write_string(msg);
            message_end();
         }
      }
   } 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/[/code]