Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Cvar-uri:
- fmp_psycho_hp 400 - viata care o primeste psycho
- fmp_psycho_ap 400 - armura care o primeste psycho
- fmp_psycho_speed 500 - viteza care o primeste psycho
- fmp_kage_hp 300 - viata care o primeste kage
- fmp_kage_ap 200 - armura care o primeste kage
- fmp_kage_speed 1000 - viteza care o primeste kage
- */
- #include < amxmodx >
- #include < cstrike >
- #include < fun >
- #include < engine >
- #include < hamsandwich >
- #include < fakemeta_util >
- #include < ColorChat >
- new const thunder_sound[] = "ambience/thunder_clap.wav";
- #define PLUGIN "Furien Mod Powers"
- #define VERSION "0.1"
- new const KageSound[ ] = "bleahhK.wav";
- new const PsychoSound[ ] = "bleacP.wav";
- new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
- new bool:UserIsKage[ 33 ];
- new bool:UserIsPsycho[ 33 ];
- new cvar_hp;
- new cvar_ap;
- new cvar_speed;
- new cvar_hp2;
- new cvar_ap2;
- new cvar_speed2;
- new SyncHudMessage;
- #define SPEARGUN
- //native give_barlog9 ( id );
- native give_plasma ( id );
- native set_user_janus7 ( id, janus7 );
- native give_weapon_sfgun ( id );
- native set_user_ethereal ( id, ethereal );
- native set_user_superclaws ( id, superclaws );
- #if defined SPEARGUN
- // SPIRE
- new PRIMARY_WEAPONS_BITSUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
- #define SPEARGUN_WEAPONKEY 98
- #define weapon_speargun "weapon_galil"
- #define CSW_SPEARGUN CSW_GALIL
- #define SPEARGUN_CLASS "oicw_grenade"
- #define speargun_shotdelay 1.0 // Refire rate
- new SpearGunModel_V[] = "models/furien30_weapons/Primary/v_speargun.mdl";
- new SpearGunModel_P[] = "models/furien30_weapons/Primary/p_speargun.mdl";
- new SpearGunModel_W[] = "models/furien30_weapons/Primary/w_speargun.mdl";
- new SpearGunModel_S[] = "models/furien30_weapons/Primary/s_speargun.mdl";
- new SpearGun_Sound[][] = {
- "weapons/speargun_shoot1.wav",
- "weapons/speargun_clipin.wav",
- "weapons/speargun_draw.wav"
- };
- new SpearGun_Generic[][] = {
- "sprites/furien30_speargun.txt",
- "sprites/furien30_weapons/SpearGun.spr",
- "sprites/furien30_weapons/640hud7x.spr"
- };
- new bool:HaveSpearGun[33], speargun_clip[33], speargun_reload[33], speargun_event, speargun_trail, speargun_explode;
- new speargundamage, speargunradius, speargunknockback, speargunreloadtime;
- // END SPIRE
- #endif
- new g_lightning, g_smoke, SPR_ICE_BLAST, SPR_ICEEXPLODE, SPR_ICEGIB, g_light;
- public plugin_cfg( )
- {
- set_cvar_float("sv_maxspeed", 1000.0 );
- }
- #if defined SPEARGUN
- public plugin_natives ( ) {
- SpearGun_Natives();
- }
- #endif
- public plugin_precache( )
- {
- #if defined SPEARGUN
- SpearGun_Precache();
- register_clcmd ( "say spiregun", "give_sipregun" );
- #endif
- precache_sound( KageSound );
- precache_sound( PsychoSound );
- g_lightning = precache_model("sprites/beamvip.spr");
- g_light = precache_model ( "sprites/lgtning.spr" );
- precache_sound ( thunder_sound );
- g_smoke = precache_model( "sprites/steam1.spr" );
- SPR_ICE_BLAST = precache_model("sprites/furien30_levelssistem/ef_shockwave.spr");
- SPR_ICEEXPLODE = precache_model("sprites/furien30_levelssistem/frost_explode.spr")
- SPR_ICEGIB = precache_model("sprites/furien30_levelssistem/frost_gib.spr")
- }
- #if defined SPEARGUN
- public give_sipregun ( id ) {
- set_user_speargun ( id, true );
- }
- #endif
- public plugin_init( )
- {
- register_plugin( PLUGIN, VERSION, "Askhanar" );
- cvar_hp = register_cvar( "fmp_psycho_hp", "400" );
- cvar_ap = register_cvar( "fmp_psycho_ap", "400" );
- cvar_speed = register_cvar( "fmp_psycho_speed", "450" );
- cvar_hp2 = register_cvar( "fmp_kage_hp", "400" );
- cvar_ap2 = register_cvar( "fmp_kage_ap", "400" );
- cvar_speed2 = register_cvar( "fmp_kage_speed", "750" );
- RegisterHam( Ham_Spawn, "player", "Ham_PlayerSpawnPost", 1 );
- RegisterHam( Ham_Killed, "player", "Player_Killed" );
- register_event( "DeathMsg", "evDeathMsg", "a" );
- RegisterHam( Ham_Player_ResetMaxSpeed, "player", "Ham_ResetMaxSpeedPost", 1 );
- SyncHudMessage = CreateHudSyncObj( );
- #if defined SPEARGUN
- SpearGun_Init ( )
- #endif
- }
- public client_connect( id )
- {
- if( is_user_bot( id ) || is_user_hltv( id ) ) return 0;
- UserIsKage[ id ] = false;
- UserIsPsycho[ id ] = false;
- client_cmd( id , "cl_sidespeed 2000" );
- client_cmd( id , "cl_forwardspeed 2000" );
- client_cmd( id , "cl_backspeed 2000" );
- return 0;
- }
- public client_disconnect( id )
- {
- if( is_user_bot( id ) || is_user_hltv( id ) ) return 0;
- UserIsKage[ id ] = false;
- UserIsPsycho[ id ] = false;
- client_cmd( id , "cl_sidespeed 2000" );
- client_cmd( id , "cl_forwardpeed 2000" );
- client_cmd( id , "cl_backspeed 2000" );
- return 0;
- }
- public Ham_PlayerSpawnPost( id )
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) ) return HAM_IGNORED;
- set_user_superclaws ( id, false );
- #if defined SPEARGUN
- set_user_speargun ( id, false );
- #endif
- set_task( 0.1, "RemovePowers", id + 123 );
- return HAM_IGNORED;
- }
- public Player_Killed ( id ) {
- if ( UserIsPsycho [ id ] ) {
- new Float:fOrigin[ 3 ], iOrigin[ 3 ];
- pev( id, pev_origin, fOrigin );
- FVecIVec( fOrigin, iOrigin );
- new target = id;
- // get target's origin
- new vorigin[ 3 ], pos[ 3 ];
- get_user_origin( target, vorigin );
- // modify origins
- vorigin[ 2 ] -= 26;
- pos[ 0 ] = vorigin[ 0 ] + 150;
- pos[ 1 ] = vorigin[ 1 ] + 150;
- pos[ 2 ] = vorigin[ 2 ] + 800;
- // create lightning bolt
- Thunder( pos, vorigin );
- Thunder2 ( pos, vorigin );
- Thunder( pos, vorigin );
- Thunder2 ( pos, vorigin );
- Thunder( pos, vorigin );
- Thunder2 ( pos, vorigin );
- Thunder( pos, vorigin );
- Thunder2 ( pos, vorigin );
- LightNearPlayers ( target, fOrigin );
- Smoke( vorigin, 10, 10 );
- message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id);
- write_short(1<<10);
- write_short(1<<10);
- write_short(0x0000);
- write_byte(255);
- write_byte(255);
- write_byte(255);
- write_byte(50);
- message_end();
- message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, target);
- write_short(1<<10);
- write_short(1<<10);
- write_short(0x0000);
- write_byte(255);
- write_byte(255);
- write_byte(255);
- write_byte(50);
- message_end();
- }
- }
- Thunder( start[ 3 ], end[ 3 ] ) {
- message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
- write_byte( TE_BEAMPOINTS );
- write_coord( start[ 0 ] );
- write_coord( start[ 1 ] );
- write_coord( start[ 2 ] );
- write_coord( end[ 0 ] );
- write_coord( end[ 1 ] );
- write_coord( end[ 2 ] );
- write_short( g_light );
- write_byte( 1 );
- write_byte( 5 );
- write_byte( 7 );
- write_byte( 80 );
- write_byte( 30 );
- write_byte( 51 ); // r
- write_byte( 204 ); // b
- write_byte( 255 ); // b
- write_byte( 200 );
- write_byte( 200 );
- message_end();
- message_begin( MSG_PVS, SVC_TEMPENTITY, end );
- write_byte( TE_SPARKS );
- write_coord( end[ 0 ] );
- write_coord( end[ 1 ]);
- write_coord( end[ 2 ] );
- message_end();
- emit_sound( 0 ,CHAN_ITEM, thunder_sound, 1.0, ATTN_NORM, 0, PITCH_NORM );
- }
- Thunder2( start[ 3 ], end[ 3 ] ) {
- message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
- write_byte( TE_BEAMPOINTS );
- write_coord( start[ 0 ] );
- write_coord( start[ 1 ] );
- write_coord( start[ 2 ] );
- write_coord( end[ 0 ] );
- write_coord( end[ 1 ] );
- write_coord( end[ 2 ] );
- write_short( g_light );
- write_byte( 1 );
- write_byte( 5 );
- write_byte( 7 );
- write_byte( 20 );
- write_byte( 30 );
- write_byte( 51 ); // r
- write_byte( 204 ); // b
- write_byte( 255 ); // b
- write_byte( 200 );
- write_byte( 200 );
- message_end();
- message_begin( MSG_PVS, SVC_TEMPENTITY, end );
- write_byte( TE_SPARKS );
- write_coord( end[ 0 ] );
- write_coord( end[ 1 ]);
- write_coord( end[ 2 ] );
- message_end();
- }
- Smoke( iorigin[ 3 ], scale, framerate ) {
- message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
- write_byte( TE_SMOKE );
- write_coord( iorigin[ 0 ] );
- write_coord( iorigin[ 1 ] );
- write_coord( iorigin[ 2 ] );
- write_short( g_smoke );
- write_byte( scale );
- write_byte( framerate );
- message_end();
- }
- public LightNearPlayers( id, const Float:fOrigin[ 3 ] )
- {
- static iVictim;
- iVictim = -1;
- while( ( iVictim = engfunc(EngFunc_FindEntityInSphere, iVictim, fOrigin, 300.0) ) != 0 )
- {
- if( !is_user_alive( iVictim ) )
- continue;
- new Float:fVictimOrigin[ 3 ], iVictimOrigin[ 3 ];
- pev( id, pev_origin, fVictimOrigin );
- FVecIVec( fVictimOrigin, iVictimOrigin );
- new Origin[3];
- get_user_origin(id, Origin) ;
- new Float:Origin2[3];
- IVecFVec(Origin, Origin2);
- engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, Origin2, 0)
- write_byte(TE_EXPLOSION)
- engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
- engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
- engfunc(EngFunc_WriteCoord, Origin2[2]+75) // z axis
- write_short(SPR_ICEEXPLODE)
- write_byte(22)
- write_byte(35)
- write_byte(TE_EXPLFLAG_NOSOUND)
- message_end()
- engfunc(EngFunc_MessageBegin, MSG_BROADCAST ,SVC_TEMPENTITY, Origin2, 0)
- write_byte(TE_SPRITETRAIL) // TE ID
- engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
- engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
- engfunc(EngFunc_WriteCoord, Origin2[2]+70) // z axis
- engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
- engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
- engfunc(EngFunc_WriteCoord, Origin2[2]) // z axis
- write_short(SPR_ICEGIB) // Sprite Index
- write_byte(100) // Count
- write_byte(15) // Life
- write_byte(1) // Scale
- write_byte(50) // Velocity Along Vector
- write_byte(10) // Rendomness of Velocity
- message_end();
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin2, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, Origin2[0]) // x
- engfunc(EngFunc_WriteCoord, Origin2[1]) // y
- engfunc(EngFunc_WriteCoord, Origin2[2]) // z
- engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
- engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
- engfunc(EngFunc_WriteCoord, Origin2[2]+385.0) // z axis
- write_short(SPR_ICE_BLAST) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(100) // green
- write_byte(200) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin2, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, Origin2[0]) // x
- engfunc(EngFunc_WriteCoord, Origin2[1]) // y
- engfunc(EngFunc_WriteCoord, Origin2[2]) // z
- engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
- engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
- engfunc(EngFunc_WriteCoord, Origin2[2]+470.0) // z axis
- write_short(SPR_ICE_BLAST) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(100) // green
- write_byte(200) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin2, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, Origin2[0]) // x
- engfunc(EngFunc_WriteCoord, Origin2[1]) // y
- engfunc(EngFunc_WriteCoord, Origin2[2]) // z
- engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
- engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
- engfunc(EngFunc_WriteCoord, Origin2[2]+555.0) // z axis
- write_short(SPR_ICE_BLAST) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(100) // green
- write_byte(200) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
- write_byte(TE_DLIGHT);
- write_coord(Origin[0]); // x
- write_coord(Origin[1]); // y
- write_coord(Origin[2]); // z
- write_byte(25); // radius
- write_byte(0) // red
- write_byte(100) // green
- write_byte(200) // blue
- write_byte(8); // life
- write_byte(60); // decay rate
- message_end();
- CreateLightning( id, iVictim, iVictimOrigin );
- if ( get_user_team ( iVictim ) != get_user_team ( id ) ) {
- new Damage = 150;
- if(get_user_health(iVictim) - Damage >= 1) {
- ExecuteHam(Ham_TakeDamage, iVictim, id, id, float(Damage), DMG_BLAST);
- Create_ScreenFade(iVictim,(1<<13),(1<<14), 0x0000, 255, 255, 255, 100);
- Create_ScreenShake(iVictim,(1<<14),(1<<13),(1<<14));
- }
- else
- death_message(id, iVictim, "Chain Lightning");
- }
- }
- }
- stock Create_TE_SPRITETRAIL3(start[3], end[3], iSprite, count, life, scale, velocity, random ){
- message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte( TE_SPRITETRAIL )
- write_coord( start[0] ) // start position (X)
- write_coord( start[1] ) // start position (Y)
- write_coord( start[2] + 40 ) // start position (Z)
- write_coord( end[0] ) // end position (X)
- write_coord( end[1] ) // end position (Y)
- write_coord( end[2] ) // end position (Z)
- write_short( iSprite ) // sprite index
- write_byte( count ) // count
- write_byte( life) // life in 0.1's
- write_byte( scale) // scale in 0.1's
- write_byte( velocity ) // velocity along vector in 10's
- write_byte( random ) // randomness of velocity in 10's
- message_end()
- }
- public CreateLightning( id, iVictim, iVictimOrigin[ 3 ] )
- {
- message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
- write_byte( TE_BEAMENTS );
- write_short( id ); // start entity
- write_short( iVictim ); // end entity
- write_short( g_lightning ); // model
- write_byte( 0 ); // starting frame
- write_byte( 15 ); // frame rate
- write_byte( 15 ); // life
- write_byte( 80 ); // line width
- write_byte( 10 ); // noise amplitude
- write_byte( 51 ); // red
- write_byte( 204 ); // green
- write_byte( 255 ); // blue
- write_byte( 255 ); // brightness
- write_byte( 0 ); // scroll speed
- message_end( );
- message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
- write_byte( TE_ELIGHT );
- write_short( iVictim ); // entity
- write_coord( iVictimOrigin[0] ); // initial position
- write_coord( iVictimOrigin[1] ); // initial position
- write_coord( iVictimOrigin[2] ); // initial position
- write_coord( 100 ); // radius
- write_byte( 51 ); // red
- write_byte( 204 ); // green
- write_byte( 255 ); // blue
- write_byte( 15 ); // life
- write_coord( 0 ); // decay rate
- message_end( );
- }
- public RemovePowers( id )
- {
- id -= 123;
- if( !is_user_connected( id ) ) return 1;
- if( UserIsPsycho[ id ] )
- set_user_rendering( id );
- if( UserIsKage[ id ] || UserIsPsycho[ id ] )
- set_user_armor( id, 0 );
- UserIsPsycho[ id ] = false;
- UserIsKage[ id ] = false;
- client_cmd( id, "lastinv" );
- client_cmd( id, "lastinv" );
- return 0;
- }
- public SearchForPsycho( )
- {
- new iTerro = CountPlayers( 1 );
- new iCounter = CountPlayers( 2 );
- if( iCounter == 1 && iTerro > 0 )
- {
- new id = GetRemainingPlayerId( 2 );
- if( UserIsPsycho[ id ] ) return 1;
- UserIsPsycho[ id ] = true;
- switch ( random_num ( 1, 5 ) ) {
- case 1: give_plasma ( id );
- case 2: set_user_ethereal ( id, true );
- case 3: set_user_janus7 ( id, true );
- case 4: give_weapon_sfgun ( id );
- case 5: set_user_speargun ( id, true );
- }
- ColorChat( 0, RED,"^x04[AntiFurien]^x03 %s^x01 a devenit^x03 Psycho^x01 ! ", get_name( id ) );
- ColorChat( 0, RED,"^x04[AntiFurien]^x01 Are^x03 %d^x01 HP,^x03 %d^x01 AP,^x03 %d^x01 Speed, aveti grija !", get_pcvar_num( cvar_hp ), get_pcvar_num( cvar_ap ), get_pcvar_num( cvar_speed ) );
- set_hudmessage( 0, 255, 0, -1.0, -1.0, 0, 0.0, 5.0, 0.0, 1.0, 3);
- ShowSyncHudMsg( 0, SyncHudMessage, "%s a devenit Psycho !^n Cea din urma salvare a omenirii !", get_name( id ) );
- set_user_maxspeed( id, float( get_pcvar_num( cvar_speed ) ) );
- set_user_health( id, get_pcvar_num( cvar_hp ) );
- set_user_armor( id, get_pcvar_num( cvar_ap ) );
- set_user_rendering( id, kRenderFxGlowShell, 0, 255, 255, kRenderNormal, 25 );
- client_cmd( 0, "spk sound/%s", PsychoSound );
- }
- return 0;
- }
- public SearchForKage( )
- {
- new iTerro = CountPlayers( 1 );
- new iCounter = CountPlayers( 2 );
- if( iTerro == 1 && iCounter > 0 )
- {
- new id = GetRemainingPlayerId( 1 );
- if( UserIsKage[ id ] ) return 1;
- UserIsKage[ id ] = true;
- set_user_superclaws ( id, true );
- ColorChat( 0, RED,"^x04[Furien]^x03 %s^x01 s-a transformat in^x03 Kage^x01 ! ", get_name( id ));
- ColorChat( 0, RED,"^x04[Furien]^x01 Are^x03 %d^x01 HP,^x03 %d^x01 AP,^x03 %d^x01 Speed, aveti grija !", get_pcvar_num( cvar_hp2 ), get_pcvar_num( cvar_ap2 ), get_pcvar_num( cvar_speed2 ) );
- set_hudmessage( 0, 255, 0, -1.0, -1.0, 0, 0.0, 5.0, 0.0, 1.0, 3);
- ShowSyncHudMsg( 0, SyncHudMessage, "%s s-a transformat in Kage !^nSansele pamantenilor au scazut !", get_name( id ) );
- set_user_maxspeed( id, float( get_pcvar_num( cvar_speed2 ) ) );
- set_user_health( id, get_pcvar_num( cvar_hp2 ) );
- set_user_armor( id, get_pcvar_num( cvar_ap2 ) );
- client_cmd( 0, "spk sound/%s", KageSound );
- }
- return 0;
- }
- public evDeathMsg( )
- {
- if ( get_playersnum ( ) > 4 ) {
- SearchForPsycho( );
- SearchForKage( );
- }
- new iKiller = read_data( 1 );
- new iVictim = read_data( 2 );
- if( !is_user_connected( iKiller ) || !is_user_connected( iVictim ) || iKiller == iVictim ) return 1;
- if( UserIsKage[ iVictim ] )
- {
- ColorChat( 0, RED, "^x04[AntiFurien]^x01 Kage^x03 %s^x01 a fost omorat de^x03 %s^x01 !",get_name( iVictim ), get_name( iKiller ) );
- }
- else if( UserIsPsycho[ iVictim ] )
- {
- ColorChat( 0, RED, "^x04[AntiFurien]^x01 Psycho^x03 %s^x01 a fost omorat de^x03 %s^x01 !",get_name( iVictim ), get_name( iKiller ) );
- set_user_ethereal ( iVictim, false );
- set_user_janus7 ( iVictim, false );
- }
- return 0;
- }
- public Ham_ResetMaxSpeedPost( id )
- {
- if( is_user_alive( id ) && is_user_connected( id ) && get_user_maxspeed(id) != 1.0 )
- {
- new Float:flMaxSpeed;
- if( UserIsPsycho[ id ] )
- {
- flMaxSpeed = float( get_pcvar_num( cvar_speed ) );
- }
- if( UserIsKage[ id ] )
- {
- flMaxSpeed = float( get_pcvar_num( cvar_speed2 ) );
- }
- if( flMaxSpeed > 0.0 )
- {
- set_pev( id, pev_maxspeed, flMaxSpeed );
- // slow hack ? o_O
- //client_cmd( id, "cl_forwardspeed %.1f;cl_sidespeed %.1f;cl_backspeed %.1f", flMaxSpeed, flMaxSpeed, flMaxSpeed );
- }
- }
- }
- stock CountPlayers( const Team )
- {
- new iPlayers[ 32 ];
- new iPlayersNum;
- new iPlayersCount;
- get_players( iPlayers, iPlayersNum );
- for( new i = 0 ; i < iPlayersNum ; i++ )
- {
- if( is_user_alive( iPlayers[ i ] ) )
- {
- if( Team == 1 )
- {
- if( get_user_team( iPlayers[ i ] ) == 1 )
- {
- iPlayersCount++;
- }
- }
- else if( Team == 2 )
- {
- if( get_user_team( iPlayers[ i ] ) == 2 )
- {
- iPlayersCount++;
- }
- }
- }
- }
- return iPlayersCount;
- }
- stock GetRemainingPlayerId( const Team )
- {
- new iPlayers[ 32 ];
- new iPlayersNum;
- new iPlayerId;
- get_players( iPlayers, iPlayersNum );
- for( new i = 0 ; i < iPlayersNum ; i++ )
- {
- if( is_user_alive( iPlayers[ i ] ) )
- {
- if( Team == 1 )
- {
- if( get_user_team( iPlayers[ i ] ) == 1 )
- {
- iPlayerId = iPlayers[ i ];
- }
- }
- else if( Team == 2 )
- {
- if( get_user_team( iPlayers[ i ] ) == 2 )
- {
- iPlayerId = iPlayers[ i ];
- }
- }
- }
- }
- return iPlayerId;
- }
- stock get_name( id )
- {
- new name[ 32 ];
- get_user_name( id, name, sizeof ( name ) -1 );
- return name;
- }
- #if defined SPEARGUN
- public give_spear ( id ) {
- set_user_speargun ( id, true );
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //---------------------------------------| SpearGun |--------------------------------------------------------
- //======================================= sDs|Aragon* =======================================================
- SpearGun_Init() {
- register_clcmd("furien30_speargun", "Hook_SpearGun");
- register_event("CurWeapon", "SpearGun_ViewModel", "be", "1=1");
- register_event("WeapPickup","SpearGun_ViewModel","b","1=19");
- register_forward(FM_SetModel, "SpearGun_WorldModel", 1);
- register_forward(FM_UpdateClientData, "SpearGun_UpdateClientData_Post", 1);
- register_forward(FM_PlaybackEvent, "SpearGun_PlaybackEvent");
- register_forward(FM_CmdStart, "SpearGun_CmdStart");
- RegisterHam(Ham_Item_AddToPlayer, weapon_speargun, "SpearGun_AddToPlayer");
- RegisterHam(Ham_Item_Deploy , weapon_speargun, "SpearGun_Deploy_Post", 1);
- RegisterHam(Ham_Weapon_WeaponIdle, weapon_speargun, "SpearGun_WeaponIdle")
- RegisterHam(Ham_Weapon_PrimaryAttack, weapon_speargun, "SpearGun_PrimaryAttack");
- RegisterHam(Ham_Weapon_Reload, weapon_speargun, "SpearGun_Reload");
- RegisterHam(Ham_Weapon_Reload, weapon_speargun, "SpearGun_Reload_Post", 1);
- RegisterHam(Ham_Item_PostFrame, weapon_speargun, "SpearGun_PostFrame");
- register_touch(SPEARGUN_CLASS, "*", "SpearGun_Touch");
- speargundamage = register_cvar("furien30_speargun_damage", "200"); //| SpearGun Damage |//
- speargunreloadtime = register_cvar("furien30_speargun_reload_time", "1.0"); //| SpearGun Reload Time |//
- speargunradius = register_cvar("furien30_speargun_radius", "250.0"); //| SpearGun Bolt Radius |//
- speargunknockback = register_cvar("furien30_speargun_knockback", "3.0"); //| SpearGun Bolt Knockback |//
- }
- SpearGun_Precache() {
- register_forward(FM_PrecacheEvent, "SpearGun_PrecacheEvent_Post", 1);
- speargun_trail = precache_model("sprites/xbeam3.spr");
- speargun_explode = precache_model("sprites/furien30_weapons/explode.spr");
- precache_model(SpearGunModel_V);
- precache_model(SpearGunModel_P);
- precache_model(SpearGunModel_W);
- precache_model(SpearGunModel_S);
- for(new i = 0; i < sizeof(SpearGun_Sound); i++)
- engfunc(EngFunc_PrecacheSound, SpearGun_Sound[i]);
- for(new i = 0; i < sizeof(SpearGun_Generic); i++)
- engfunc(EngFunc_PrecacheGeneric, SpearGun_Generic[i]);
- }
- SpearGun_Natives() {
- register_native("get_user_speargun", "get_user_speargun", 1);
- register_native("set_user_speargun", "set_user_speargun", 1);
- }
- public SpearGun_ViewModel(id) {
- if(get_user_weapon(id) == CSW_SPEARGUN && get_user_speargun(id)) {
- set_pev(id, pev_viewmodel2, SpearGunModel_V);
- set_pev(id, pev_weaponmodel2, SpearGunModel_P);
- }
- return PLUGIN_CONTINUE
- }
- public SpearGun_WorldModel(entity, model[]) {
- if(is_valid_ent(entity)) {
- static ClassName[33];
- entity_get_string(entity, EV_SZ_classname, ClassName, charsmax(ClassName));
- if(equal(ClassName, "weaponbox")) {
- new Owner = entity_get_edict(entity, EV_ENT_owner);
- new _SpearGun = find_ent_by_owner(-1, weapon_speargun, entity);
- if(get_user_speargun(Owner) && is_valid_ent(_SpearGun) && equal(model, "models/w_galil.mdl")) {
- entity_set_int(_SpearGun, EV_INT_impulse, SPEARGUN_WEAPONKEY);
- HaveSpearGun[Owner] = false;
- entity_set_model(entity, SpearGunModel_W);
- }
- }
- }
- return FMRES_IGNORED;
- }
- public SpearGun_UpdateClientData_Post(id, sendweapons, cd_handle) {
- if(is_user_alive(id) && is_user_connected(id) && get_user_weapon(id) == CSW_SPEARGUN && get_user_speargun(id))
- set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001);
- return FMRES_IGNORED;
- }
- public SpearGun_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2) {
- if(is_user_connected(invoker) && eventid == speargun_event)
- playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2);
- return FMRES_IGNORED;
- }
- public SpearGun_PrecacheEvent_Post(type, const name[]) {
- if (equal("events/galil.sc", name))
- speargun_event = get_orig_retval();
- return FMRES_IGNORED;
- }
- public SpearGun_CmdStart(id, uc_handle, seed) {
- if(is_user_alive(id) && is_user_connected(id)) {
- static CurButton;
- CurButton = get_uc(uc_handle, UC_Buttons);
- new Float:NextAttack = get_pdata_float(id, 83, 5);
- if(CurButton & IN_ATTACK) {
- if(get_user_weapon(id) == CSW_SPEARGUN && get_user_speargun(id)) {
- static _SpearGun;
- _SpearGun = fm_find_ent_by_owner(-1, weapon_speargun, id);
- if(pev_valid(_SpearGun) && cs_get_weapon_ammo(_SpearGun) > 0 && !speargun_reload[id] && NextAttack <= 0.0) {
- set_weapon_anim(id, 1);
- emit_sound(id, CHAN_WEAPON, SpearGun_Sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM);
- SpearGun_Fire(id);
- new Float:PunchAngle[3]
- PunchAngle[0] = random_float(-5.0, -7.0), PunchAngle[1] = 0.0, PunchAngle[0] = 0.0
- set_pev(id, pev_punchangle, PunchAngle);
- cs_set_weapon_ammo(_SpearGun, cs_get_weapon_ammo(_SpearGun) - 1);
- if(cs_get_weapon_ammo(_SpearGun) > 0 && !speargun_reload[id] && NextAttack <= 0.0) {
- set_pdata_float(id, 83, speargun_shotdelay, 5);
- set_pdata_float(_SpearGun, 48, 1.0, 4)
- }
- }
- CurButton &= ~IN_ATTACK;
- set_uc(uc_handle, UC_Buttons, CurButton);
- }
- }
- }
- return FMRES_IGNORED;
- }
- public SpearGun_AddToPlayer(Weapon, id) {
- if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(Weapon, EV_INT_impulse) == SPEARGUN_WEAPONKEY) {
- HaveSpearGun[id] = true;
- WeaponList(id, SPEARGUN_WEAPONKEY)
- entity_set_int(Weapon, EV_INT_impulse, 0);
- }
- return HAM_IGNORED;
- }
- public SpearGun_Deploy_Post(Weapon) {
- if(pev_valid(Weapon)) {
- new Owner = get_pdata_cbase(Weapon, 41, 4);
- if(is_user_alive(Owner) && get_user_speargun(Owner)) {
- set_pev(Owner, pev_viewmodel2, SpearGunModel_V);
- set_pev(Owner, pev_weaponmodel2, SpearGunModel_P);
- set_weapon_anim(Owner, 3)
- set_pdata_float(Owner, 83, 1.2, 5);
- set_pdata_float(Weapon, 48, 1.2, 4)
- if(cs_get_weapon_ammo(Weapon) > 0)
- speargun_reload[Owner] = 0;
- }
- }
- return HAM_IGNORED;
- }
- public SpearGun_WeaponIdle(Weapon) {
- if(pev_valid(Weapon)) {
- new Owner = get_pdata_cbase(Weapon, 41, 4);
- if(is_user_alive(Owner) && get_user_speargun(Owner) && get_pdata_float(Weapon, 48, 4) <= 0.1) {
- set_pdata_float(Weapon, 48, 1.7, 4)
- set_weapon_anim(Owner, 0)
- }
- }
- return HAM_IGNORED;
- }
- public SpearGun_PrimaryAttack(Weapon) {
- if(pev_valid(Weapon)) {
- new Owner = get_pdata_cbase(Weapon, 41, 4);
- if(is_user_alive(Owner) && get_user_speargun(Owner))
- return HAM_SUPERCEDE;
- }
- return HAM_IGNORED;
- }
- public SpearGun_Reload(Weapon) {
- if(pev_valid(Weapon)) {
- new Owner = get_pdata_cbase(Weapon, 41, 4);
- if(is_user_alive(Owner) && get_user_speargun(Owner)) {
- speargun_clip[Owner] = -1;
- if(cs_get_user_bpammo(Owner, CSW_SPEARGUN) <= 0 || get_pdata_int(Weapon, 51, 4) >= 1)
- return HAM_SUPERCEDE;
- speargun_clip[Owner] = get_pdata_int(Weapon, 51, 4);
- speargun_reload[Owner] = true;
- }
- }
- return HAM_IGNORED;
- }
- public SpearGun_Reload_Post(Weapon) {
- if(pev_valid(Weapon)) {
- new Owner = get_pdata_cbase(Weapon, 41, 4);
- if(is_user_alive(Owner) && get_user_speargun(Owner) && speargun_clip[Owner] != -1) {
- set_pdata_int(Weapon, 51, speargun_clip[Owner], 4);
- set_pdata_float(Weapon, 48, get_pcvar_float(speargunreloadtime), 4);
- set_pdata_float(Owner, 83, get_pcvar_float(speargunreloadtime), 5);
- set_pdata_int(Weapon, 54, 1, 4);
- set_weapon_anim(Owner, 2)
- }
- }
- return HAM_IGNORED;
- }
- public SpearGun_PostFrame(Weapon) {
- if(pev_valid(Weapon)) {
- new Owner = get_pdata_cbase(Weapon, 41, 4);
- if(is_user_alive(Owner) && get_user_speargun(Owner) && get_pdata_int(Weapon, 54, 4) && get_pdata_float(Owner, 83, 5) <= 0.0) {
- new Temp = min(1 - get_pdata_int(Weapon, 51, 4), cs_get_user_bpammo(Owner, CSW_SPEARGUN));
- set_pdata_int(Weapon, 51, get_pdata_int(Weapon, 51, 4) + Temp, 4);
- cs_set_user_bpammo(Owner, CSW_SPEARGUN, cs_get_user_bpammo(Owner, CSW_SPEARGUN) - Temp);
- set_pdata_int(Weapon, 54, 0, 4);
- speargun_reload[Owner] = false;
- }
- }
- return HAM_IGNORED;
- }
- public SpearGun_Fire(id) {
- new Bolt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
- if(pev_valid(Bolt)) {
- new Float:Origin[3], Float:Angles[3], Float:Velocity[3];
- engfunc(EngFunc_GetAttachment, id, 0, Origin, Angles);
- pev(id, pev_angles, Angles);
- set_pev(Bolt, pev_origin, Origin);
- set_pev(Bolt, pev_angles, Angles);
- set_pev(Bolt, pev_solid, SOLID_BBOX);
- set_pev(Bolt, pev_movetype, MOVETYPE_FLY);
- set_pev(Bolt, pev_classname, SPEARGUN_CLASS);
- set_pev(Bolt, pev_owner, id);
- engfunc(EngFunc_SetModel, Bolt, SpearGunModel_S);
- set_pev(Bolt, pev_mins, {-1.0, -1.0, -1.0});
- set_pev(Bolt, pev_maxs, {1.0, 1.0, 1.0});
- velocity_by_aim(id, 2000, Velocity);
- set_pev(Bolt, pev_velocity, Velocity);
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
- write_byte(TE_BEAMFOLLOW); // TE id
- write_short(Bolt); // entity:attachment to follow
- write_short(speargun_trail); // sprite index
- write_byte(1); // life in 0.1's
- write_byte(1); // line width in 0.1's
- write_byte(255); // r
- write_byte(255); // g
- write_byte(255); // b
- write_byte(200); // brightness
- message_end();
- }
- }
- public SpearGun_Touch(Bolt, touch) {
- if(is_valid_ent(Bolt)) {
- static Float:BoltOrigin[3];
- pev(Bolt, pev_origin, BoltOrigin);
- new id = pev(Bolt, pev_owner);
- message_begin(MSG_BROADCAST ,SVC_TEMPENTITY);
- write_byte(TE_EXPLOSION);
- engfunc(EngFunc_WriteCoord, BoltOrigin[0]);
- engfunc(EngFunc_WriteCoord, BoltOrigin[1]);
- engfunc(EngFunc_WriteCoord, BoltOrigin[2]);
- write_short(speargun_explode); // sprite index
- write_byte(20); // scale in 0.1's
- write_byte(30); // framerate
- write_byte(0); // flags
- message_end();
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_WORLDDECAL)
- engfunc(EngFunc_WriteCoord, BoltOrigin[0])
- engfunc(EngFunc_WriteCoord, BoltOrigin[1])
- engfunc(EngFunc_WriteCoord, BoltOrigin[2])
- write_byte(random_num(46, 48))
- message_end()
- static ClassName[32];
- pev(touch, pev_classname, ClassName, charsmax(ClassName));
- if(equal(ClassName, "player") && is_user_connected(touch) && is_user_alive(touch)) {
- if(!fm_get_user_godmode(touch) && get_user_team(touch) != get_user_team(id) && touch != id) {
- new Float:Damage = get_pcvar_float(speargundamage);
- //make_blood(touch, get_pcvar_num(speargundamage))
- make_knockback(touch, BoltOrigin, get_pcvar_float(speargunknockback) * Damage);
- if(get_user_health(touch) > Damage)
- ExecuteHam(Ham_TakeDamage, touch, id, id, Damage, DMG_BLAST);
- else
- death_message(id, touch, "SpearGun");
- }
- }
- else if(equal(ClassName, "func_breakable")) {
- if(entity_get_float(touch, EV_FL_health) <= get_pcvar_num(speargundamage))
- force_use(id, touch);
- }
- for(new Victim = 1; Victim < get_maxplayers(); Victim++) {
- if(is_user_connected(Victim) && is_user_alive(Victim) && !fm_get_user_godmode(Victim) && get_user_team(Victim) != get_user_team(id) && Victim != id && Victim != touch) {
- new Float:VictimOrigin[3], Float:Distance_F, Distance;
- pev(Victim, pev_origin, VictimOrigin);
- Distance_F = get_distance_f(BoltOrigin, VictimOrigin);
- Distance = floatround(Distance_F);
- if(Distance <= get_pcvar_float(speargunradius)) {
- new Float:DistanceRatio, Float:Damage;
- DistanceRatio = floatdiv(float(Distance), get_pcvar_float(speargunradius));
- Damage = get_pcvar_float(speargundamage) - floatround(floatmul(get_pcvar_float(speargundamage), DistanceRatio));
- //make_blood(Victim, floatround(Damage))
- make_knockback(Victim, BoltOrigin, get_pcvar_float(speargunknockback)*Damage);
- if(get_user_health(Victim) - Damage >= 1)
- ExecuteHam(Ham_TakeDamage, Victim, id, id, Damage, DMG_BLAST);
- else
- death_message(id, Victim, "SpearGun");
- }
- }
- }
- engfunc(EngFunc_RemoveEntity, Bolt);
- }
- }
- public Hook_SpearGun(id) {
- engclient_cmd(id, weapon_speargun);
- return PLUGIN_HANDLED
- }
- public get_user_speargun(id)
- return HaveSpearGun[id];
- public set_user_speargun(id, speargun) {
- if(speargun) {
- if(!HaveSpearGun[id]) {
- drop_primary_weapons(id);
- HaveSpearGun[id] = true;
- speargun_reload[id] = 0;
- WeaponList(id, SPEARGUN_WEAPONKEY)
- fm_give_item(id, weapon_speargun);
- new Clip = fm_get_user_weapon_entity(id, CSW_SPEARGUN);
- cs_set_weapon_ammo(Clip, 1);
- }
- }
- else {
- if(HaveSpearGun[id])
- HaveSpearGun[id] = false;
- }
- }
- public WeaponList(id, WEAPONKEY) {
- new Message_WeaponList = get_user_msgid("WeaponList")
- switch(WEAPONKEY) {
- case SPEARGUN_WEAPONKEY: {
- message_begin(MSG_ONE, Message_WeaponList, _, id);
- write_string(HaveSpearGun[id] ? "furien30_speargun" : "weapon_galil"); // WeaponName
- write_byte(4); // PrimaryAmmoID
- write_byte(90); // PrimaryAmmoMaxAmount
- write_byte(-1); // SecondaryAmmoID
- write_byte(-1); // SecondaryAmmoMaxAmount
- write_byte(0); // SlotID (0...N)
- write_byte(17); // NumberInSlot (1...N)
- write_byte(CSW_SPEARGUN); // WeaponID
- write_byte(0); // Flags
- message_end();
- }
- }
- }
- stock set_weapon_anim(id, anim) {
- set_pev(id, pev_weaponanim, anim);
- if(is_user_connected(id)) {
- message_begin(MSG_ONE, SVC_WEAPONANIM, _, id);
- write_byte(anim);
- write_byte(pev(id, pev_body));
- message_end();
- }
- }
- stock drop_primary_weapons(Player) {
- static weapons[32], num, i, weaponid;
- num = 0;
- get_user_weapons(Player, weapons, num);
- for(i = 0; i < num; i++) {
- weaponid = weapons [i];
- if(((1<<weaponid) & PRIMARY_WEAPONS_BITSUM)) {
- static wname[32];
- get_weaponname(weaponid, wname, charsmax(wname));
- engclient_cmd(Player, "drop", wname);
- }
- }
- }
- #endif
- stock death_message(Killer, Victim, const Weapon[]) {
- set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET);
- ExecuteHamB(Ham_Killed, Victim, Killer, 2);
- set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT);
- make_deathmsg(Killer, Victim, 0, Weapon);
- cs_set_user_money(Killer, cs_get_user_money(Killer) + 300);
- message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"));
- write_byte(Killer); // id
- write_short(pev(Killer, pev_frags)); // frags
- write_short(cs_get_user_deaths(Killer)); // deaths
- write_short(0); // class?
- write_short(get_user_team(Killer)); // team
- message_end();
- message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"));
- write_byte(Victim); // id
- write_short(pev(Victim, pev_frags)); // frags
- write_short(cs_get_user_deaths(Victim)); // deaths
- write_short(0); // class?
- write_short(get_user_team(Victim)); // team
- message_end();
- }
- public make_knockback(Victim, Float:origin[3], Float:maxspeed) {
- new Float:fVelocity[3];
- kickback(Victim, origin, maxspeed, fVelocity);
- entity_set_vector(Victim, EV_VEC_velocity, fVelocity);
- return(1);
- }
- stock kickback(ent, Float:fOrigin[3], Float:fSpeed, Float:fVelocity[3]) {
- new Float:fEntOrigin[3];
- entity_get_vector(ent, EV_VEC_origin, fEntOrigin);
- new Float:fDistance[3];
- fDistance[0] = fEntOrigin[0] - fOrigin[0];
- fDistance[1] = fEntOrigin[1] - fOrigin[1];
- fDistance[2] = fEntOrigin[2] - fOrigin[2];
- new Float:fTime = (vector_distance(fEntOrigin,fOrigin) / fSpeed);
- fVelocity[0] = fDistance[0] / fTime;
- fVelocity[1] = fDistance[1] / fTime;
- fVelocity[2] = fDistance[2] / fTime;
- return(fVelocity[0] && fVelocity[1] && fVelocity[2]);
- }
- stock Create_ScreenFade(id, duration, holdtime, fadetype, red, green, blue, alpha){
- if(is_user_connected(id)) {
- message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id)
- write_short(duration) // fade lasts this long duration
- write_short(holdtime) // fade lasts this long hold time
- write_short(fadetype) // fade type(in / out)
- write_byte(red) // fade red
- write_byte(green) // fade green
- write_byte(blue) // fade blue
- write_byte(alpha) // fade alpha
- message_end()
- }
- }
- stock Create_ScreenShake(id, amount, duration, frequency){
- if(is_user_connected(id)) {
- message_begin(MSG_ONE,get_user_msgid("ScreenShake"),{0,0,0},id)
- write_short(amount) // ammount
- write_short(duration) // lasts this long
- write_short(frequency) // frequency
- message_end()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement