[AMXX] Salvatorul Craciunului 3.0 [NO CRASH]

Pluginuri facute de utilizatorii forumului eXtream.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
YONTU
Moderator ajutator
Moderator ajutator
Posts: 2396
Joined: 10 May 2013, 13:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 253 times
Been thanked: 271 times
Contact:

24 Jan 2015, 14:50

Descriere: La fiecare inceput de runda, este ales aleatoriu un jucator, Salvatorul Craciunului, ce primeste anumite beneficii (viata, grenade, arme, armura, viteza, model nou) pentru a putea salva Craciunul. Desigur, sa castige runda. :))
Pentru ca ma numesc Craciun, am decis sa refac pluginul, cu noi imbunatatiri, fara a mai da crash serverului si sa fac pe plac jucatorilor care imi cereau pe privat sa le rezolv pluginul.

Descarcare: GirlShare! ZippyShare!

Nume: Salvatorul Craciunului
Versiune: 3.0
Autor: ^S3ekEr (eu doar l-am modificat si fixat bugurile)
Link oficial: http://www.extreamcs.com/forum/
SMA | Afiseaza codul
#include < amxmodx >
#include < fakemeta >
#include < cstrike >
#include < hamsandwich >
#include < fun >

#define PLUGIN_NAME	"Xmas Random"
#define PLUGIN_VERSION 	"3.0"
#define PLUGIN_AUTHOR	"S3ekEr"
#define PLUGIN_EDITOR	"YONTU"

#define TASK_MODEL	12012
#define TASK_HE		12812
#define fm_get_user_model(%1,%2,%3) engfunc(EngFunc_InfoKeyValue, engfunc(EngFunc_GetInfoKeyBuffer, %1), "model", %2, %3)

#define ITEM_HE		(1<<0)	// "a"
#define ITEM_FB		(1<<1)	// "b"
#define ITEM_SG		(1<<2)	// "c"
#define ITEM_DEAGLE	(1<<3)	// "d"
#define ITEM_AWP	(1<<4)	// "e"
#define ITEM_M4A1	(1<<5)	// "f"
#define ITEM_AK47	(1<<6)	// "g"
#define ITEM_SPEED	(1<<7)	// "h"
#define ITEM_DEFUSEKIT	(1<<8)	// "i"
#define ITEM_UNHE	(1<<9)	// "j"

new Snow, g_iLastId;
new g_has_custom_model[ 33 ], g_player_model[ 33 ][ 32 ], Float:g_models_counter;
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
new bool:g_Speed[ 33 ], bool:g_HE[ 33 ], TimeReciveHe[ 33 ] = 0;
new cvar_health, cvar_armor, cvar_effects, cvar_speed, cvar_items, cvar_team;

new const SpriteSnow[  ] = "sprites/snowflakes.spr";
new const xmas_model[  ] = "xmas";
new const Tag[  ] = "[Xmas]";

public plugin_init(  ) {
	
	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
	
	register_logevent( "logevent_RoundStart", 2, "1=Round_Start" );
	register_logevent( "logevent_RoundEnd", 2, "1=Round_End" );
	
	register_event( "DeathMsg",  "event_DeathMsg",  "a" );
	register_event( "CurWeapon", "event_CurWeapon", "be", "1=1" );
	
	RegisterHam( Ham_Spawn, "player", "fw_HamPlayerSpawnPost", 1 );
	RegisterHam( Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeedPost", 1 );

	register_forward( FM_SetClientKeyValue, "fw_SetClientKeyValue" );
	register_forward( FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged" );
	
	cvar_health = register_cvar( "xmas_health", "200" );
	cvar_armor = register_cvar( "xmas_armor", "200" );
	cvar_speed = register_cvar( "xmas_speed", "400.0" );
	cvar_effects = register_cvar( "xmas_effects", "1" );
	cvar_items = register_cvar( "xmas_items", "abcdefghij" );
	cvar_team = register_cvar( "xmas_team", "ALL" );	// ALL, T, CT
}

public plugin_precache(  ) {
	
	Snow = precache_model( SpriteSnow );
	
	new _model[ 200 ];
	format( _model, charsmax( _model ), "models/player/%s/%s.mdl", xmas_model, xmas_model );
	
	if( file_exists( _model ) )
		precache_model( _model );
	else
		set_fail_state( "Models ^"xmas.mdl^" does not exists in cstrike/models/player/." );
}

public client_putinserver( id ) {

	g_Speed[ id ] = false;
	g_HE[ id ] = false;
	TimeReciveHe[ id ] = 0;
}

public logevent_RoundStart(  )
	set_task( 1.0, "task_SetSanta" );

public logevent_RoundEnd(  )
	g_models_counter = 0.0;

public task_SetSanta(  ) {

	new team_access[ 11 ], Flags[ 4 ], Team[ 11 ];
	get_pcvar_string( cvar_team, team_access, charsmax( team_access ) );

	if( equal( team_access, "T" ) ) {

		formatex( Flags, charsmax( Flags ), "aeh" );
		formatex( Team, charsmax( Team ), "TERRORIST" );
	}

	if( equal( team_access, "CT" ) ) {

		formatex( Flags, charsmax( Flags ), "aeh" );
		formatex( Team, charsmax( Team ), "CT" );
	}

	if( equal( team_access, "ALL" ) ) {

		formatex( Flags, charsmax( Flags ), "ah" );
		formatex( Team, charsmax( Team ), "" );
	}

	new id = GetRandomPlayer( Flags, Team );
	if( !id ) return;
	
	fm_strip_user_weapons( id );
	give_item( id, "weapon_knife" );

	set_user_health( id, get_pcvar_num( cvar_health ) );
	set_user_armor( id, get_pcvar_num( cvar_armor ) );
	
	set_model( id );
	set_items( id );
	if( get_pcvar_num( cvar_effects ) ) make_effect( id );
	
	ColorChat( 0, "!1---!4 HO!3 HO!1 HO" );
	ColorChat( 0, "!3%s!4 %s!1 a fost ales Salvatorul Craciunului!", Tag, get_name( id ) );
	ColorChat( 0, "!1---!4 HO!3 HO!1 HO" );
		
	g_iLastId = id;
}

public event_DeathMsg(  ) {	
	
	new iKiller = read_data( 1 );
	new iVictim  = read_data( 2 );
	
	new HitSelf = ( iVictim == iKiller ) ? 1 : 0;
	
	if( iVictim == g_iLastId ) {
		
		g_Speed[ iVictim ] = false;
		g_HE[ iVictim ] = false;
		
		new Origin[ 3 ];
		get_user_origin( iVictim, Origin );
		UTIL_CreateSnow( Origin, Snow, random_num( 40, 60 ), random_num( 10, 15 ), random_num( 5, 10 ), random_num( 40, 55 ) );
		
		!HitSelf ? ColorChat( 0, "!3%s!4 Salvatorul Craciunului!1 %s!4 a fost omorat de!1 %s!4 !", Tag, get_name( iVictim ), get_name( iKiller ) ) : ColorChat( 0, "!3%s!4 Salvatorul Craciunului!1 %s!4 a murit !", Tag, get_name( iVictim ) );
	}
}

public event_CurWeapon( id ) {

	if( id == g_iLastId ) {

		if( !g_HE[ id ] )
			return PLUGIN_HANDLED;

		if( !user_has_weapon( id, CSW_HEGRENADE ) && !TimeReciveHe[ id ] ) {

			TimeReciveHe[ id ] = 1;
			set_task( 1.0, "give_user_he", id + TASK_HE, _, _, "b" );
		}

		return PLUGIN_HANDLED;
	}

	return PLUGIN_HANDLED;
}

public fw_HamPlayerSpawnPost( id ) {
	
	if( !is_user_connected( id ) )
		return HAM_IGNORED;
	
	if( id == g_iLastId ) {
		
		remove_task( id + TASK_HE );
		TimeReciveHe[ id ] = 0;
		g_Speed[ id ] = false;
		g_HE[ id ] = false;

		set_user_armor( id, 0 );
		fm_reset_user_model( id );

		fm_strip_user_weapons( id );
		give_item( id, "weapon_knife" );

		switch( _:cs_get_user_team( id ) ) {

			case CS_TEAM_CT: {

				give_item( id, "weapon_usp" );
				cs_set_user_bpammo( id, CSW_USP, 24 );
			}

			case CS_TEAM_T: {

				give_item( id, "weapon_glock18" );
				cs_set_user_bpammo( id, CSW_GLOCK18, 20 );
			}
		}

		return HAM_IGNORED;
	}
	
	return HAM_IGNORED;
}

public fw_ResetMaxSpeedPost( id ) {
	
	if( !is_user_alive( id ) )
		return HAM_IGNORED;
	
	if( id == g_iLastId ) {

		if( g_Speed[ id ] ) {

			new Float:flMaxSpeed = get_pcvar_float( cvar_speed );
		
			if( flMaxSpeed > 0.0 ) {
		
				set_user_maxspeed( id, flMaxSpeed );
				new szCommand[ 128 ];
				formatex( szCommand, sizeof(  szCommand ) - 1, "cl_forwardspeed %.1f;cl_sidespeed %.1f;cl_backspeed %.1f", flMaxSpeed, flMaxSpeed, flMaxSpeed );
				client_cmd( id, szCommand );
			}
		} else return HAM_HANDLED;
	}
	
	return HAM_IGNORED;
}

public fw_SetClientKeyValue( id, const infobuffer[  ], const key[  ] ) {
	
	if( g_has_custom_model[ id ] && equal( key, "model" ) )
		return FMRES_SUPERCEDE;
	
	return FMRES_IGNORED;
}

public fw_ClientUserInfoChanged( id ) {
	
	if( !g_has_custom_model[ id ] )
		return FMRES_IGNORED;
	
	static szCurrentModel[ 32 ];
	fm_get_user_model( id, szCurrentModel, charsmax( szCurrentModel ) );
	
	if( !equal( szCurrentModel, g_player_model[ id ] ) )
		fm_set_user_model( id, g_player_model[ id ] );
	
	return FMRES_IGNORED;
}

public set_model( id ) {
	
	remove_task( id + TASK_MODEL );
	
	copy( g_player_model[ id ], charsmax( g_player_model[  ] ), xmas_model );
	
	static szCurrentModel[ 32 ];
	fm_get_user_model( id, szCurrentModel, charsmax( szCurrentModel ) );
	
	if( !equal( szCurrentModel, g_player_model[ id ] ) ) {
		
		set_task( 1.0 + g_models_counter, "task_setmodel2", id + TASK_MODEL );
		g_models_counter += 0.25;
	} else if( g_has_custom_model[ id ] ) {
		
		fm_reset_user_model( id );
		set_task( 1.0, "set_model", id );
	}
}

public task_setmodel2( id ) {
	
	id -= TASK_MODEL;
	fm_set_user_model( id, g_player_model[ id ] );
}

public set_items( id ) {

	new Flag = GetItemFlags(  );

	if( Flag & ITEM_HE )
		give_item( id, "weapon_hegrenade" ); 
	
	if( Flag & ITEM_FB ) {

		give_item( id, "weapon_flashbang" );
		cs_set_user_bpammo( id, CSW_FLASHBANG, cs_get_user_bpammo( id, CSW_FLASHBANG ) + 1 );
	}
	
	if( Flag & ITEM_SG )
		give_item( id, "weapon_smokegrenade" );
	
	if( Flag & ITEM_DEAGLE ) {

		give_item( id, "weapon_deagle" );
		cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
	}
	
	if( Flag & ITEM_AWP ) {

		give_item( id, "weapon_awp" );
		cs_set_user_bpammo( id, CSW_AWP, 30 );
	}
	
	if( Flag & ITEM_M4A1 ) {

		give_item( id, "weapon_m4a1" );
		cs_set_user_bpammo( id, CSW_M4A1, 90 );
	}

	if( Flag & ITEM_AK47 ) {

		give_item( id, "weapon_ak47" );
		cs_set_user_bpammo( id, CSW_AK47, 90 );
	}
	
	if( Flag & ITEM_SPEED )
		g_Speed[ id ] = true;
	
	if( cs_get_user_team( id ) == CS_TEAM_CT && Flag & ITEM_DEFUSEKIT )
		give_item( id, "item_thighpack" );

	if( Flag & ITEM_UNHE )
		g_HE[ id ] = true;
}

public make_effect( id ) {
	
	static g_msg_ScreenFade = 0;
	if( !g_msg_ScreenFade )
		g_msg_ScreenFade = get_user_msgid( "ScreenFade" );
	
	message_begin( MSG_ONE, g_msg_ScreenFade, _, id );
	write_short( 4<<10 );
	write_short( 5<<10 );
	write_short( 3<<12 );
	write_byte( 0 );
	write_byte( 0 );
	write_byte( 0 );
	write_byte( 255 );
	message_end(  );
}

public give_user_he( id ) {

	id -= TASK_HE;

	if( id == g_iLastId ) {

		if( !g_HE[ id ] )
			return PLUGIN_HANDLED;

		else if( !is_user_alive( id ) || user_has_weapon( id, CSW_HEGRENADE ) ) {

			remove_task( id + TASK_HE );
			TimeReciveHe[ id ] = 0;
		
			return PLUGIN_HANDLED;
		}
		
		else if( TimeReciveHe[ id ] > 0 )
			TimeReciveHe[ id ]--;
	
		else {// if( TimeReciveHe[ id ] <= 0 ) {

			remove_task( id + TASK_HE );
			TimeReciveHe[ id ] = 0;
		
			give_item( id, "weapon_hegrenade" );
		}
	}
	
	return PLUGIN_HANDLED;	
}

stock GetRandomPlayer( const flags[  ] = "", const team[  ] = "" ) { // thx Exolent
	
	new iPlayers[ 32 ], iNum;
	get_players( iPlayers, iNum, flags, team );
	
	return iNum ? iPlayers[ random_num( 0, iNum - 1 ) ] : 0;
}

stock GetItemFlags(  ) {

	new Flags[ 26 ];
	get_pcvar_string( cvar_items, Flags, charsmax( Flags ) );
 
	return read_flags( Flags );
}

stock ColorChat( id, String[  ], any:... ) {
	
	static szMesage[ 192 ];
	vformat( szMesage, charsmax( szMesage ), String, 3 );
	
	replace_all( szMesage, charsmax( szMesage ), "!1", "^1" );
	replace_all( szMesage, charsmax( szMesage ), "!3", "^3" );
	replace_all( szMesage, charsmax( szMesage ), "!4", "^4" );
	
	static g_msg_SayText = 0;
	if( !g_msg_SayText )
		g_msg_SayText = get_user_msgid( "SayText" );
	
	new Players[ 32 ], iNum = 1, i;
	
	if( id ) Players[ 0 ] = id;
	else get_players( Players, iNum, "ch" );
	
	for( --iNum; iNum >= 0; iNum-- ) {
		
		i = Players[ iNum ];
		
		message_begin( MSG_ONE_UNRELIABLE, g_msg_SayText, _, i );
		write_byte( i );
		write_string( szMesage );
		message_end(  );
	}
}

stock UTIL_CreateSnow( const iOrigin[ 3 ], const iSpriteID, const iCount, const iLife, const iScale, const velo ) {
	
	message_begin( MSG_BROADCAST,SVC_TEMPENTITY );
	write_byte( TE_SPRITETRAIL );
	write_coord( iOrigin[ 0 ] );				// start position (X)
	write_coord( iOrigin[ 1 ] );				// start position (Y)
	write_coord( iOrigin[ 2 ] );				// start position (Z)
	write_coord( iOrigin[ 0 ] );				// end position (X)
	write_coord( iOrigin[ 1 ] );				// end position (Y)
	write_coord( iOrigin[ 2 ] + random_num( 40, 60 ) );	// end position (Z)
	write_short( iSpriteID );				// sprite index
	write_byte( iCount );				// number of snow
	write_byte( iLife );					// life in 0.1's
	write_byte( iScale );				// scale in 0.1's
	write_byte( velo );					// velocity along vector in 10's
	write_byte( random_num( 15, 15 ) );			// randomness of velocity in 10's
	message_end(  );
}

stock get_name( id ) {
	
	new szName[ 32 ];
	get_user_name( id, szName, charsmax( szName ) );
	
	return szName;
}

stock fm_set_user_model( id, const modelname[  ] ) {
	
	engfunc( EngFunc_SetClientKeyValue, id, engfunc( EngFunc_GetInfoKeyBuffer, id ), "model", modelname );
	g_has_custom_model[ id ] = true;
}

stock fm_reset_user_model( id ) {
	
	g_has_custom_model[ id ] = false;
	dllfunc( DLLFunc_ClientUserInfoChanged, id, engfunc( EngFunc_GetInfoKeyBuffer, id ) );
}

stock fm_strip_user_weapons( id ) {
	
	static stripent;
	if( !pev_valid( stripent ) ) {
		
		stripent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "player_weaponstrip" ) );
		dllfunc( DLLFunc_Spawn, stripent );
		set_pev( stripent, pev_solid, SOLID_NOT );
	}
	
	dllfunc( DLLFunc_Use, stripent, id );
	
	return PLUGIN_HANDLED;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Instalare:
1. Fisierul salvatorul_craciunului.sma il puneti in addons/amxmodx/scripting
2. Fisierul salvatorul_craciunului.amxx il puneti in addons/amxmodx/plugins
3. Fisierul xmas.mdl il puneti in cstrike/models/player/xmas
4. Fisierul snowflakes.spr il puneti in cstrike/sprites
5. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma:

Code: Select all

salvatorul_craciunului.amxx
6. Alti pasi necesari....

Cvar-uri (se adauga in fisierul amxmodx\configs\amxx.cfg):
  • xmas_health "200" - viata 'salvatorului'
    xmas_armor "200" - armura 'salvatorului'
    xmas_speed "280.0" - viteza 'salvatorului' (cu zecimala)
    xmas_effects "1" - 1 - ON, 0 - OFF (efecte: la inceput de runda i se inegreste ecranul)
    xmas_team "ALL" - din ce echipa sa fie ales 'salvatorul'? T - din echipa Teroristilor | CT - din echipa Anti Teroristilor | ALL - din ambele echipe
    xmas_items "abcdefghij" - ce iteme sa primeasca 'salvatorului'
    • Flaguri Iteme | Afiseaza codul
      a - 1 grenada HE
      b - 2 grenade flashbang
      c - 1 grenada smoke
      d - un deagle cu 35 gloante
      e - un awp cu 30 gloante
      f - m4a1 cu 90 gloante
      g - ak47 cu 90 gloante
      h - daca folosim flagul "h", ii vom activa viteza, daca nu, nu va primi viteza
      i - defuse kit (doar daca e CT)
      j - grenade HE infinite
      
      // puteti seta sa primeasca toate itemele (ex: xmas_items "abcdefghij")
      // daca nu doresti ca 'salvatorul' sa primeasca viteza sau grenade he infinite setezi astfel: (ex: xmas_items "abcdefgi")
      // puteti seta itemele dupa bunul plac
      Comenzi administrative (se tasteaza in consola si trebuie sa fiti administrator):
      • Nu are
      Comenzi publice (se tasteaza in joc prin apasarea tastei Y):
      • Nu are
Module necesare (se sterge ; din fata modulului de mai jos; acestea le gasiti in fisierul amxmodx\configs\modules.ini):
- CStrike
- Fun
- Hamsandwich
- Fakemeta
- Fun

Alte informatii:
Daca intampinati buguri, sau erori in log sau ceva de genul, nu ezitati sa postati mai jos
Imagini | Afiseaza codul
Image

Image

Image
Last edited by YONTU on 10 Jun 2015, 16:39, edited 1 time in total.
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș
Pluginurile mele publice | Afiseaza codul
Control HE Damage(s)
[Zombie mod] Liderul oamenilor
NO RUSH (MANUAL)
Salvatorul Craciunului
Harry Potter's Magic Wand [0.0.3]
New HE Grenade Effects
Upgrades Menu -> Health/Armor/Damage
Serverele care au achizitonat pluginurile mele: #1 #2

CONTACT: sef_yontu@yahoo.com | skype: cyp_yontu
IG-BOOST.org - Instagram Followers Best, Cheap, Reliable
S3ekEr^
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 3467
Joined: 06 Dec 2009, 12:47
Detinator Steam: Nu
Reputatie: Nume anterior: The Seeker , Reptyle
Fost Scripter
Fost super moderator
Utilizator neserios ( tepar )
Has thanked: 105 times
Been thanked: 326 times

24 Jan 2015, 15:50

Nu stiu la cine putea da crash versiunea mea, eu am folosit-o pe dr.indungi, zombie.csblackdevil si nu imi pica niciodata, aveam fix aceeasi versiune pe care am postat-o pe extream, nu spun ca nu-i buna versiunea ta, doamne ferese, spun doar ca mie nu mi-a picat niciodata si de cand l-am facut nu am gasit vreun bug, oricum felicitari, e mai umplut al tau :))
User avatar
YONTU
Moderator ajutator
Moderator ajutator
Posts: 2396
Joined: 10 May 2013, 13:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 253 times
Been thanked: 271 times
Contact:

24 Jan 2015, 16:20

S3ekEr^ wrote:Nu stiu la cine putea da crash versiunea mea, eu am folosit-o pe dr.indungi, zombie.csblackdevil si nu imi pica niciodata, aveam fix aceeasi versiune pe care am postat-o pe extream, nu spun ca nu-i buna versiunea ta, doamne fereste, spun doar ca mie nu mi-a picat niciodata si de cand l-am facut nu am gasit vreun bug, oricum felicitari, e mai umplut al tau :))
Serverele pe care le-ai precizat mai sus: poate ca mereu erau full sau aveau undeva la 10/32 mereu.
Aici era problema.
//get random player and don't get it twice in a row
new iPlayer;
do {
iPlayer = GetRandomPlayer("ah");
}
while((iPlayer == g_iLastSaverId || !is_user_connected(iPlayer)) && iPlayer != 0);
if(!iPlayer)
return;
Cei care foloseau versiunea a 2.0 a a pluginului primeau crash deoarece era un singur player pe server.
Mersi :* !
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș
Pluginurile mele publice | Afiseaza codul
Control HE Damage(s)
[Zombie mod] Liderul oamenilor
NO RUSH (MANUAL)
Salvatorul Craciunului
Harry Potter's Magic Wand [0.0.3]
New HE Grenade Effects
Upgrades Menu -> Health/Armor/Damage
Serverele care au achizitonat pluginurile mele: #1 #2

CONTACT: sef_yontu@yahoo.com | skype: cyp_yontu
Jhonn
Membru, skill 0
Membru, skill 0
Posts: 14
Joined: 30 Dec 2014, 23:45
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

10 Jun 2015, 15:06

cum pot scoate efectul cu fulgii de zapada? am pus effects pe 0, dar cand moare respectivul player, tot sar din el fulgi de zapada.
User avatar
YONTU
Moderator ajutator
Moderator ajutator
Posts: 2396
Joined: 10 May 2013, 13:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 253 times
Been thanked: 271 times
Contact:

10 Jun 2015, 16:38

Jhonn wrote:cum pot scoate efectul cu fulgii de zapada? am pus effects pe 0, dar cand moare respectivul player, tot sar din el fulgi de zapada.
Nu era setat cvar-ul, imi cer scuze ;)) !
Fara fulgi cand moare | Afiseaza codul
#include < amxmodx >
#include < fakemeta >
#include < cstrike >
#include < hamsandwich >
#include < fun >

#define PLUGIN_NAME	"Xmas Random"
#define PLUGIN_VERSION 	"3.0"
#define PLUGIN_AUTHOR	"S3ekEr"
#define PLUGIN_EDITOR	"YONTU"

#define TASK_MODEL	12012
#define TASK_HE		12812
#define fm_get_user_model(%1,%2,%3) engfunc(EngFunc_InfoKeyValue, engfunc(EngFunc_GetInfoKeyBuffer, %1), "model", %2, %3)

#define ITEM_HE		(1<<0)	// "a"
#define ITEM_FB		(1<<1)	// "b"
#define ITEM_SG		(1<<2)	// "c"
#define ITEM_DEAGLE	(1<<3)	// "d"
#define ITEM_AWP	(1<<4)	// "e"
#define ITEM_M4A1	(1<<5)	// "f"
#define ITEM_AK47	(1<<6)	// "g"
#define ITEM_SPEED	(1<<7)	// "h"
#define ITEM_DEFUSEKIT	(1<<8)	// "i"
#define ITEM_UNHE	(1<<9)	// "j"

new g_iLastId;
new g_has_custom_model[ 33 ], g_player_model[ 33 ][ 32 ], Float:g_models_counter;
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
new bool:g_Speed[ 33 ], bool:g_HE[ 33 ], TimeReciveHe[ 33 ] = 0;
new cvar_health, cvar_armor, cvar_effects, cvar_speed, cvar_items, cvar_team;

new const SpriteSnow[  ] = "sprites/snowflakes.spr";
new const xmas_model[  ] = "xmas";
new const Tag[  ] = "[Xmas]";

public plugin_init(  ) {
	
	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
	
	register_logevent( "logevent_RoundStart", 2, "1=Round_Start" );
	register_logevent( "logevent_RoundEnd", 2, "1=Round_End" );
	
	register_event( "DeathMsg",  "event_DeathMsg",  "a" );
	register_event( "CurWeapon", "event_CurWeapon", "be", "1=1" );
	
	RegisterHam( Ham_Spawn, "player", "fw_HamPlayerSpawnPost", 1 );
	RegisterHam( Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeedPost", 1 );

	register_forward( FM_SetClientKeyValue, "fw_SetClientKeyValue" );
	register_forward( FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged" );
	
	cvar_health = register_cvar( "xmas_health", "200" );
	cvar_armor = register_cvar( "xmas_armor", "200" );
	cvar_speed = register_cvar( "xmas_speed", "400.0" );
	cvar_effects = register_cvar( "xmas_effects", "1" );
	cvar_items = register_cvar( "xmas_items", "abcdefghij" );
	cvar_team = register_cvar( "xmas_team", "ALL" );	// ALL, T, CT
}

public plugin_precache(  ) {
	
	new _model[ 200 ];
	format( _model, charsmax( _model ), "models/player/%s/%s.mdl", xmas_model, xmas_model );
	
	if( file_exists( _model ) )
		precache_model( _model );
	else
		set_fail_state( "Models ^"xmas.mdl^" does not exists in cstrike/models/player/." );
}

public client_putinserver( id ) {

	g_Speed[ id ] = false;
	g_HE[ id ] = false;
	TimeReciveHe[ id ] = 0;
}

public logevent_RoundStart(  )
	set_task( 1.0, "task_SetSanta" );

public logevent_RoundEnd(  )
	g_models_counter = 0.0;

public task_SetSanta(  ) {

	new team_access[ 11 ], Flags[ 4 ], Team[ 11 ];
	get_pcvar_string( cvar_team, team_access, charsmax( team_access ) );

	if( equal( team_access, "T" ) ) {

		formatex( Flags, charsmax( Flags ), "aeh" );
		formatex( Team, charsmax( Team ), "TERRORIST" );
	}

	if( equal( team_access, "CT" ) ) {

		formatex( Flags, charsmax( Flags ), "aeh" );
		formatex( Team, charsmax( Team ), "CT" );
	}

	if( equal( team_access, "ALL" ) ) {

		formatex( Flags, charsmax( Flags ), "ah" );
		formatex( Team, charsmax( Team ), "" );
	}

	new id = GetRandomPlayer( Flags, Team );
	if( !id ) return;
	
	fm_strip_user_weapons( id );
	give_item( id, "weapon_knife" );

	set_user_health( id, get_pcvar_num( cvar_health ) );
	set_user_armor( id, get_pcvar_num( cvar_armor ) );
	
	set_model( id );
	set_items( id );
	if( get_pcvar_num( cvar_effects ) ) make_effect( id );
	
	ColorChat( 0, "!1---!4 HO!3 HO!1 HO" );
	ColorChat( 0, "!3%s!4 %s!1 a fost ales Salvatorul Craciunului!", Tag, get_name( id ) );
	ColorChat( 0, "!1---!4 HO!3 HO!1 HO" );
		
	g_iLastId = id;
}

public event_DeathMsg(  ) {	
	
	new iKiller = read_data( 1 );
	new iVictim  = read_data( 2 );
	
	new HitSelf = ( iVictim == iKiller ) ? 1 : 0;
	
	if( iVictim == g_iLastId ) {
		
		g_Speed[ iVictim ] = false;
		g_HE[ iVictim ] = false;
		
		!HitSelf ? ColorChat( 0, "!3%s!4 Salvatorul Craciunului!1 %s!4 a fost omorat de!1 %s!4 !", Tag, get_name( iVictim ), get_name( iKiller ) ) : ColorChat( 0, "!3%s!4 Salvatorul Craciunului!1 %s!4 a murit !", Tag, get_name( iVictim ) );
	}
}

public event_CurWeapon( id ) {

	if( id == g_iLastId ) {

		if( !g_HE[ id ] )
			return PLUGIN_HANDLED;

		if( !user_has_weapon( id, CSW_HEGRENADE ) && !TimeReciveHe[ id ] ) {

			TimeReciveHe[ id ] = 1;
			set_task( 1.0, "give_user_he", id + TASK_HE, _, _, "b" );
		}

		return PLUGIN_HANDLED;
	}

	return PLUGIN_HANDLED;
}

public fw_HamPlayerSpawnPost( id ) {
	
	if( !is_user_connected( id ) )
		return HAM_IGNORED;
	
	if( id == g_iLastId ) {
		
		remove_task( id + TASK_HE );
		TimeReciveHe[ id ] = 0;
		g_Speed[ id ] = false;
		g_HE[ id ] = false;

		set_user_armor( id, 0 );
		fm_reset_user_model( id );

		fm_strip_user_weapons( id );
		give_item( id, "weapon_knife" );

		switch( _:cs_get_user_team( id ) ) {

			case CS_TEAM_CT: {

				give_item( id, "weapon_usp" );
				cs_set_user_bpammo( id, CSW_USP, 24 );
			}

			case CS_TEAM_T: {

				give_item( id, "weapon_glock18" );
				cs_set_user_bpammo( id, CSW_GLOCK18, 20 );
			}
		}

		return HAM_IGNORED;
	}
	
	return HAM_IGNORED;
}

public fw_ResetMaxSpeedPost( id ) {
	
	if( !is_user_alive( id ) )
		return HAM_IGNORED;
	
	if( id == g_iLastId ) {

		if( g_Speed[ id ] ) {

			new Float:flMaxSpeed = get_pcvar_float( cvar_speed );
		
			if( flMaxSpeed > 0.0 ) {
		
				set_user_maxspeed( id, flMaxSpeed );
				new szCommand[ 128 ];
				formatex( szCommand, sizeof(  szCommand ) - 1, "cl_forwardspeed %.1f;cl_sidespeed %.1f;cl_backspeed %.1f", flMaxSpeed, flMaxSpeed, flMaxSpeed );
				client_cmd( id, szCommand );
			}
		} else return HAM_HANDLED;
	}
	
	return HAM_IGNORED;
}

public fw_SetClientKeyValue( id, const infobuffer[  ], const key[  ] ) {
	
	if( g_has_custom_model[ id ] && equal( key, "model" ) )
		return FMRES_SUPERCEDE;
	
	return FMRES_IGNORED;
}

public fw_ClientUserInfoChanged( id ) {
	
	if( !g_has_custom_model[ id ] )
		return FMRES_IGNORED;
	
	static szCurrentModel[ 32 ];
	fm_get_user_model( id, szCurrentModel, charsmax( szCurrentModel ) );
	
	if( !equal( szCurrentModel, g_player_model[ id ] ) )
		fm_set_user_model( id, g_player_model[ id ] );
	
	return FMRES_IGNORED;
}

public set_model( id ) {
	
	remove_task( id + TASK_MODEL );
	
	copy( g_player_model[ id ], charsmax( g_player_model[  ] ), xmas_model );
	
	static szCurrentModel[ 32 ];
	fm_get_user_model( id, szCurrentModel, charsmax( szCurrentModel ) );
	
	if( !equal( szCurrentModel, g_player_model[ id ] ) ) {
		
		set_task( 1.0 + g_models_counter, "task_setmodel2", id + TASK_MODEL );
		g_models_counter += 0.25;
	} else if( g_has_custom_model[ id ] ) {
		
		fm_reset_user_model( id );
		set_task( 1.0, "set_model", id );
	}
}

public task_setmodel2( id ) {
	
	id -= TASK_MODEL;
	fm_set_user_model( id, g_player_model[ id ] );
}

public set_items( id ) {

	new Flag = GetItemFlags(  );

	if( Flag & ITEM_HE )
		give_item( id, "weapon_hegrenade" ); 
	
	if( Flag & ITEM_FB ) {

		give_item( id, "weapon_flashbang" );
		cs_set_user_bpammo( id, CSW_FLASHBANG, cs_get_user_bpammo( id, CSW_FLASHBANG ) + 1 );
	}
	
	if( Flag & ITEM_SG )
		give_item( id, "weapon_smokegrenade" );
	
	if( Flag & ITEM_DEAGLE ) {

		give_item( id, "weapon_deagle" );
		cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
	}
	
	if( Flag & ITEM_AWP ) {

		give_item( id, "weapon_awp" );
		cs_set_user_bpammo( id, CSW_AWP, 30 );
	}
	
	if( Flag & ITEM_M4A1 ) {

		give_item( id, "weapon_m4a1" );
		cs_set_user_bpammo( id, CSW_M4A1, 90 );
	}

	if( Flag & ITEM_AK47 ) {

		give_item( id, "weapon_ak47" );
		cs_set_user_bpammo( id, CSW_AK47, 90 );
	}
	
	if( Flag & ITEM_SPEED )
		g_Speed[ id ] = true;
	
	if( cs_get_user_team( id ) == CS_TEAM_CT && Flag & ITEM_DEFUSEKIT )
		give_item( id, "item_thighpack" );

	if( Flag & ITEM_UNHE )
		g_HE[ id ] = true;
}

public make_effect( id ) {
	
	static g_msg_ScreenFade = 0;
	if( !g_msg_ScreenFade )
		g_msg_ScreenFade = get_user_msgid( "ScreenFade" );
	
	message_begin( MSG_ONE, g_msg_ScreenFade, _, id );
	write_short( 4<<10 );
	write_short( 5<<10 );
	write_short( 3<<12 );
	write_byte( 0 );
	write_byte( 0 );
	write_byte( 0 );
	write_byte( 255 );
	message_end(  );
}

public give_user_he( id ) {

	id -= TASK_HE;

	if( id == g_iLastId ) {

		if( !g_HE[ id ] )
			return PLUGIN_HANDLED;

		else if( !is_user_alive( id ) || user_has_weapon( id, CSW_HEGRENADE ) ) {

			remove_task( id + TASK_HE );
			TimeReciveHe[ id ] = 0;
		
			return PLUGIN_HANDLED;
		}
		
		else if( TimeReciveHe[ id ] > 0 )
			TimeReciveHe[ id ]--;
	
		else {// if( TimeReciveHe[ id ] <= 0 ) {

			remove_task( id + TASK_HE );
			TimeReciveHe[ id ] = 0;
		
			give_item( id, "weapon_hegrenade" );
		}
	}
	
	return PLUGIN_HANDLED;	
}

stock GetRandomPlayer( const flags[  ] = "", const team[  ] = "" ) { // thx Exolent
	
	new iPlayers[ 32 ], iNum;
	get_players( iPlayers, iNum, flags, team );
	
	return iNum ? iPlayers[ random_num( 0, iNum - 1 ) ] : 0;
}

stock GetItemFlags(  ) {

	new Flags[ 26 ];
	get_pcvar_string( cvar_items, Flags, charsmax( Flags ) );
 
	return read_flags( Flags );
}

stock ColorChat( id, String[  ], any:... ) {
	
	static szMesage[ 192 ];
	vformat( szMesage, charsmax( szMesage ), String, 3 );
	
	replace_all( szMesage, charsmax( szMesage ), "!1", "^1" );
	replace_all( szMesage, charsmax( szMesage ), "!3", "^3" );
	replace_all( szMesage, charsmax( szMesage ), "!4", "^4" );
	
	static g_msg_SayText = 0;
	if( !g_msg_SayText )
		g_msg_SayText = get_user_msgid( "SayText" );
	
	new Players[ 32 ], iNum = 1, i;
	
	if( id ) Players[ 0 ] = id;
	else get_players( Players, iNum, "ch" );
	
	for( --iNum; iNum >= 0; iNum-- ) {
		
		i = Players[ iNum ];
		
		message_begin( MSG_ONE_UNRELIABLE, g_msg_SayText, _, i );
		write_byte( i );
		write_string( szMesage );
		message_end(  );
	}
}

stock get_name( id ) {
	
	new szName[ 32 ];
	get_user_name( id, szName, charsmax( szName ) );
	
	return szName;
}

stock fm_set_user_model( id, const modelname[  ] ) {
	
	engfunc( EngFunc_SetClientKeyValue, id, engfunc( EngFunc_GetInfoKeyBuffer, id ), "model", modelname );
	g_has_custom_model[ id ] = true;
}

stock fm_reset_user_model( id ) {
	
	g_has_custom_model[ id ] = false;
	dllfunc( DLLFunc_ClientUserInfoChanged, id, engfunc( EngFunc_GetInfoKeyBuffer, id ) );
}

stock fm_strip_user_weapons( id ) {
	
	static stripent;
	if( !pev_valid( stripent ) ) {
		
		stripent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "player_weaponstrip" ) );
		dllfunc( DLLFunc_Spawn, stripent );
		set_pev( stripent, pev_solid, SOLID_NOT );
	}
	
	dllfunc( DLLFunc_Use, stripent, id );
	
	return PLUGIN_HANDLED;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Last edited by YONTU on 11 Jun 2015, 12:59, edited 1 time in total.
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș
Pluginurile mele publice | Afiseaza codul
Control HE Damage(s)
[Zombie mod] Liderul oamenilor
NO RUSH (MANUAL)
Salvatorul Craciunului
Harry Potter's Magic Wand [0.0.3]
New HE Grenade Effects
Upgrades Menu -> Health/Armor/Damage
Serverele care au achizitonat pluginurile mele: #1 #2

CONTACT: sef_yontu@yahoo.com | skype: cyp_yontu
Jhonn
Membru, skill 0
Membru, skill 0
Posts: 14
Joined: 30 Dec 2014, 23:45
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

10 Jun 2015, 19:59

salvatorul_craciunului.sma(63) : error 017: undefined symbol "Snow"

1 Error.
Compilarea a esuat!
User avatar
-BlacKodE-
Super moderator
Super moderator
Posts: 1190
Joined: 16 Nov 2013, 11:57
Detinator Steam: Da
SteamID: blackode
Reputatie: Super moderator
Membru Club eXtreamCS (1 luna)
Fost Membru Club eXtreamCS (5 apr - 5 mai - acces in club)
Location: Pascani
Has thanked: 16 times
Been thanked: 10 times

06 Jul 2015, 09:45

Nu se poate face la diferenta de 3 4 runzi?
StaFF
Membru, skill 0
Membru, skill 0
Posts: 83
Joined: 27 Mar 2015, 22:43
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

13 Dec 2015, 22:00

Imi merge serverul in reluare, comenzile le ia dupa 5-10 secunde, cand scriu pe say la fel, serverul e furien mod, posibil sa intre cu ceva in conflict, il testez si pe serverul de clasic si revin cu edit.
User avatar
b|t|d
Membru, skill 0
Membru, skill 0
Posts: 94
Joined: 14 Jan 2011, 18:21
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com!
Location: ro
Has thanked: 20 times
Contact:

21 Dec 2017, 04:06

Se poate adauga motel Ct adica xmas_red T si xmas_blue Ct ?
Post Reply

Return to “Pluginuri eXtream”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests