Raised This Month: $32 Target: $400
 8% 

Suggestion / Subplugin Request [req] tripmine zombie plague


Post New Thread Reply   
 
Thread Tools Display Modes
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 06-20-2013 , 01:41   Re: [req] tripmine zombie plague
Reply With Quote #11

First of all, even if u are asking, bat i wanna be helpful to him, tell us what plugin for lasermines are u using, cuz in the last couple of days u confused all of us a lot xD

(No offense)
__________________
You will find everything u need :-
Catastrophe is offline
Caspre_detox
Member
Join Date: Jun 2013
Old 06-27-2013 , 16:46   Re: [req] tripmine zombie plague
Reply With Quote #12

My plugnis laser mine is 650 HP but in HUD message 1650 HP
Give Me Plufnis fol Se plugnis https://forums.alliedmods.net/showthread.php?t=159603
Please
__________________
Zombie Plague 7.0 (80 %)

Last edited by Caspre_detox; 06-27-2013 at 16:51.
Caspre_detox is offline
H3adshot
New Member
Join Date: Aug 2013
Old 10-02-2013 , 19:03   Re: [req] tripmine zombie plague
Reply With Quote #13

[EN] Sma is here.. is good for amxx studio i using this plugin (tested)
[RO] Sma aici e bun poti sal compliezi cu amxx studio folosesc acest plugin (testat)
_____________________________________________ _

#pragma semicolon 1
#include < amxmodx >
#include < fakemeta >
#include < engine >

native zp_get_user_zombie( iPlayer );
native zp_get_user_ammo_packs( iPlayer );
native zp_set_user_ammo_packs( iPlayer, iPacks );
native zp_is_lnj_round( );

#define MAX_ENTITIES 600
#define MAX_PLAYERS 32
#define MINE_ON 1
#define MINE_OFF 0
#define TASK_CREATE 84765
#define TASK_REMOVE 86766
#define MINE_COST 6
#define MINE_CLASSNAME "zp_trip_mine"
#define MINE_MODEL_EXPLODE "sprites/zerogxplode.spr"
#define MINE_MODEL_VIEW "models/zombie_plague/lasermine.mdl"
#define MINE_SOUND_ACTIVATE "weapons/mine_activate.wav"
#define MINE_SOUND_CHARGE "weapons/mine_charge.wav"
#define MINE_SOUND_DEPLOY "weapons/mine_deploy.wav"
#define MINE_HEALTH 800
#define entity_get_owner(%0) entity_get_int( %0, EV_INT_iuser2 )
#define entity_get_status(%0) entity_get_int( %0, EV_INT_iuser1 )
#define entity_get_classname(%0,%1) entity_get_string( %0, EV_SZ_classname, %1, charsmax( %1 ) )

new g_iTripMines[ 33 ];
new g_iPlantedMines[ 33 ];
new g_iPlanting[ 33 ];
new g_iRemoving[ 33 ];
new g_hExplode;
new g_msgsaytext;

print( id, const message[], { Float, Sql, Result, _ }:... )
{
new Buffer[ 128 ],Buffer2[ 128 ];
new players[ 32 ], index, num, i;

formatex( Buffer2, sizeof Buffer2 - 1, "%s",message );
vformat( Buffer, sizeof Buffer - 1, Buffer2, 3 );
get_players( players, num, "c" );

if( id )
{
if( !is_user_connected( id ))
return;

message_begin( MSG_ONE, g_msgsaytext, _, id );
write_byte( id );
write_string( Buffer );
message_end();

} else {

for( i = 0; i < num;i++ )
{
index = players[ i ];
if( !is_user_connected( index ))
continue;

message_begin( MSG_ONE, g_msgsaytext, _, index );
write_byte( index );
write_string( Buffer );
message_end();
}
}
}

public plugin_init( )
{
register_plugin( "[ZP] Trip Mines", "1.0", "Serjaka" );

register_clcmd( "say /lm", "Command_Buy" );
register_clcmd( "say lm", "Command_Buy" );

register_clcmd( "CreateLaser", "Command_Plant" );
register_clcmd( "TakeLaser", "Command_Take" );

register_logevent( "Event_RoundStart", 2, "1=Round_Start" );

register_think( MINE_CLASSNAME, "Forward_Think" );

g_msgsaytext = get_user_msgid( "SayText" );
}

public plugin_precache( )
{
engfunc( EngFunc_PrecacheModel, MINE_MODEL_VIEW );

engfunc( EngFunc_PrecacheSound, MINE_SOUND_ACTIVATE );
engfunc( EngFunc_PrecacheSound, MINE_SOUND_CHARGE );
engfunc( EngFunc_PrecacheSound, MINE_SOUND_DEPLOY );

g_hExplode = engfunc( EngFunc_PrecacheModel, MINE_MODEL_EXPLODE );
}
public client_putinserver( iPlayer )
{
set_task( 1.0, "Task_CheckAiming", iPlayer + 3389, _, _, "b" );
}

public client_disconnect( iPlayer )
{
g_iTripMines[ iPlayer ] = 0;
g_iPlanting[ iPlayer ] = false;
g_iRemoving[ iPlayer ] = false;

if( g_iPlantedMines[ iPlayer ] )
{
Func_RemoveMinesByOwner( iPlayer );

g_iPlantedMines[ iPlayer ] = 0;
}

remove_task( iPlayer + TASK_REMOVE );
remove_task( iPlayer + TASK_CREATE );
remove_task( iPlayer + 3389 );
}

public Task_CheckAiming( iTaskIndex )
{
static iPlayer;
iPlayer = iTaskIndex - 3389;

if( is_user_alive( iPlayer ) )
{
static iEntity, iDummy, cClassname[ 32 ];
get_user_aiming( iPlayer, iEntity, iDummy, 9999 );

if( pev_valid( iEntity ) )
{
pev( iEntity, pev_classname, cClassname, 31 );

if( equal( cClassname, "zp_trip_mine" ) )
{
set_hudmessage(0, 191, 255, 0.02, 0.17, 0, 2.0, 8.0);
show_hudmessage( iPlayer, "Lasermine#1,Hp :%d.", pev( iEntity, pev_health ) - 1000);
}
}
}
}

public Command_Buy( iPlayer )
{
if( !is_user_alive( iPlayer ) )
{
print( iPlayer, "^x04[ZP]^x01 You should be alive." );

return PLUGIN_CONTINUE;
}

if( zp_get_user_zombie( iPlayer ) )
{
print( iPlayer, "^x04[ZP]^x01 You should be human." );

return PLUGIN_CONTINUE;
}

if( zp_get_user_ammo_packs( iPlayer ) < MINE_COST )
{
print( iPlayer, "^x04[ZP]^x01 You need^x04 %i ammo packs!", MINE_COST );

return PLUGIN_CONTINUE;
}

if( zp_is_lnj_round( ) )
{
print( iPlayer, "^x04[ZP]^x01 You can't buy a tripmine into an armageddon round." );

return PLUGIN_CONTINUE;
}

zp_set_user_ammo_packs( iPlayer, zp_get_user_ammo_packs( iPlayer ) - MINE_COST );

g_iTripMines[ iPlayer ]++;

print( iPlayer, "^x04[ZP]^x01 You bought a^x04 Trip Mine^x01. Press^x04 'P'^x01 to plant it or^x04 'V'^x01 to take it!" );

client_cmd( iPlayer, "bind p CreateLaser" );
client_cmd( iPlayer, "bind v TakeLaser" );

return PLUGIN_CONTINUE;
}

public Command_Plant( iPlayer )
{
if( !is_user_alive( iPlayer ) )
{
print( iPlayer, "^x04[ZP]^x01 You should be alive." );

return PLUGIN_CONTINUE;
}

if( zp_get_user_zombie( iPlayer ) )
{
print( iPlayer, "^x04[ZP]^x01 You should be human." );

return PLUGIN_CONTINUE;
}

if( !g_iTripMines[ iPlayer ] )
{
print( iPlayer, "^x04[ZP]^x01 You don't have a trip mine to plant." );

return PLUGIN_CONTINUE;
}

if( g_iPlantedMines[ iPlayer ] > 1 )
{
print( iPlayer, "^x04[ZP]^x01 You can plant only^x04 2 mines^x01!" );

return PLUGIN_CONTINUE;
}

if( zp_is_lnj_round( ) )
{
print( iPlayer, "^x04[ZP]^x01 You can't buy a tripmine into an armageddon round." );

return PLUGIN_CONTINUE;
}

if( g_iPlanting[ iPlayer ] || g_iRemoving[ iPlayer ] )
return PLUGIN_CONTINUE;

if( CanPlant( iPlayer ) ) {
g_iPlanting[ iPlayer ] = true;

message_begin( MSG_ONE_UNRELIABLE, 108, _, iPlayer );
write_byte( 1 );
write_byte( 0 );
message_end( );

set_task( 1.2, "Func_Plant", iPlayer + TASK_CREATE );
}

return PLUGIN_CONTINUE;
}

public Command_Take( iPlayer )
{
if( !is_user_alive( iPlayer ) )
{
print( iPlayer, "^x04[ZP]^x01 You should be alive." );

return PLUGIN_CONTINUE;
}

if( zp_get_user_zombie( iPlayer ) )
{
print( iPlayer, "^x04[ZP]^x01 You should be human." );

return PLUGIN_CONTINUE;
}

if( !g_iPlantedMines[ iPlayer ] )
{
print( iPlayer, "^x04[ZP]^x01 You don't have a planted mine." );

return PLUGIN_CONTINUE;
}

if( g_iPlanting[ iPlayer ] || g_iRemoving[ iPlayer ] )
return PLUGIN_CONTINUE;

if( CanTake( iPlayer ) ) {
g_iRemoving[ iPlayer ] = true;

message_begin( MSG_ONE_UNRELIABLE, 108, _, iPlayer );
write_byte( 1 );
write_byte( 0 );
message_end( );

set_task( 1.2, "Func_Take", iPlayer + TASK_REMOVE );
}

return PLUGIN_CONTINUE;
}

public Event_RoundStart( ) {
static iEntity, szClassName[ 32 ], iPlayer;
for( iEntity = 0; iEntity < MAX_ENTITIES + 1; iEntity++ ) {
if( !is_valid_ent( iEntity ) )
continue;

szClassName[ 0 ] = '^0';
entity_get_classname( iEntity, szClassName );

if( equal( szClassName, MINE_CLASSNAME ) )
remove_entity( iEntity );
}

for( iPlayer = 1; iPlayer < 33; iPlayer++ ) {
g_iTripMines[ iPlayer ] = 0;
g_iPlantedMines[ iPlayer ] = 0;
}
}

public Func_Take( iPlayer ) {
iPlayer -= TASK_REMOVE;

g_iRemoving[ iPlayer ] = false;

static iEntity, szClassName[ 32 ], Float: flOwnerOrigin[ 3 ], Float: flEntityOrigin[ 3 ];
for( iEntity = 0; iEntity < MAX_ENTITIES + 1; iEntity++ ) {
if( !is_valid_ent( iEntity ) )
continue;

szClassName[ 0 ] = '^0';
entity_get_classname( iEntity, szClassName );

if( equal( szClassName, MINE_CLASSNAME ) ) {
if( entity_get_owner( iEntity ) == iPlayer ) {
entity_get_vector( iPlayer, EV_VEC_origin, flOwnerOrigin );
entity_get_vector( iEntity, EV_VEC_origin, flEntityOrigin );

if( get_distance_f( flOwnerOrigin, flEntityOrigin ) < 55.0 ) {
g_iPlantedMines[ iPlayer ]--;
g_iTripMines[ iPlayer ]++;

remove_entity( iEntity );

break;
}
}
}
}
}



public bool: CanTake( iPlayer ) {
static iEntity, szClassName[ 32 ], Float: flOwnerOrigin[ 3 ], Float: flEntityOrigin[ 3 ];
for( iEntity = 0; iEntity < MAX_ENTITIES + 1; iEntity++ ) {
if( !is_valid_ent( iEntity ) )
continue;

szClassName[ 0 ] = '^0';
entity_get_classname( iEntity, szClassName );

if( equal( szClassName, MINE_CLASSNAME ) ) {
if( entity_get_owner( iEntity ) == iPlayer ) {
entity_get_vector( iPlayer, EV_VEC_origin, flOwnerOrigin );
entity_get_vector( iEntity, EV_VEC_origin, flEntityOrigin );

if( get_distance_f( flOwnerOrigin, flEntityOrigin ) < 55.0 )
return true;
}
}
}

return false;
}

public bool: CanPlant( iPlayer ) {
static Float: flOrigin[ 3 ];
entity_get_vector( iPlayer, EV_VEC_origin, flOrigin );

static Float: flTraceDirection[ 3 ], Float: flTraceEnd[ 3 ], Float: flTraceResult[ 3 ], Float: flNormal[ 3 ];
velocity_by_aim( iPlayer, 64, flTraceDirection );
flTraceEnd[ 0 ] = flTraceDirection[ 0 ] + flOrigin[ 0 ];
flTraceEnd[ 1 ] = flTraceDirection[ 1 ] + flOrigin[ 1 ];
flTraceEnd[ 2 ] = flTraceDirection[ 2 ] + flOrigin[ 2 ];

static Float: flFraction, iTr;
iTr = 0;
engfunc( EngFunc_TraceLine, flOrigin, flTraceEnd, 0, iPlayer, iTr );
get_tr2( iTr, TR_vecEndPos, flTraceResult );
get_tr2( iTr, TR_vecPlaneNormal, flNormal );
get_tr2( iTr, TR_flFraction, flFraction );

if( flFraction >= 1.0 ) {
print( iPlayer, "^x04[ZP]^x01 You must plant the tripmine on a wall." );

return false;
}

return true;
}

public Func_Plant( iPlayer ) {
iPlayer -= TASK_CREATE;

g_iPlanting[ iPlayer ] = false;

static Float: flOrigin[ 3 ];
entity_get_vector( iPlayer, EV_VEC_origin, flOrigin );

static Float: flTraceDirection[ 3 ], Float: flTraceEnd[ 3 ], Float: flTraceResult[ 3 ], Float: flNormal[ 3 ];
velocity_by_aim( iPlayer, 128, flTraceDirection );
flTraceEnd[ 0 ] = flTraceDirection[ 0 ] + flOrigin[ 0 ];
flTraceEnd[ 1 ] = flTraceDirection[ 1 ] + flOrigin[ 1 ];
flTraceEnd[ 2 ] = flTraceDirection[ 2 ] + flOrigin[ 2 ];

static Float: flFraction, iTr;
iTr = 0;
engfunc( EngFunc_TraceLine, flOrigin, flTraceEnd, 0, iPlayer, iTr );
get_tr2( iTr, TR_vecEndPos, flTraceResult );
get_tr2( iTr, TR_vecPlaneNormal, flNormal );
get_tr2( iTr, TR_flFraction, flFraction );

static iEntity;
iEntity = create_entity( "info_target" );

if( !iEntity )
return;

entity_set_string( iEntity, EV_SZ_classname, MINE_CLASSNAME );
entity_set_model( iEntity, MINE_MODEL_VIEW );
entity_set_size( iEntity, Float: { -4.0, -4.0, -4.0 }, Float: { 4.0, 4.0, 4.0 } );

entity_set_int( iEntity, EV_INT_iuser2, iPlayer );

g_iPlantedMines[ iPlayer ]++;

entity_set_float( iEntity, EV_FL_frame, 0.0 );
entity_set_float( iEntity, EV_FL_framerate, 0.0 );
entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_FLY );
entity_set_int( iEntity, EV_INT_solid, SOLID_NOT );
entity_set_int( iEntity, EV_INT_body, 3 );
entity_set_int( iEntity, EV_INT_sequence, 7 );
entity_set_float( iEntity, EV_FL_takedamage, DAMAGE_NO );
entity_set_int( iEntity, EV_INT_iuser1, MINE_OFF );

static Float: flNewOrigin[ 3 ], Float: flEntAngles[ 3 ];
flNewOrigin[ 0 ] = flTraceResult[ 0 ] + ( flNormal[ 0 ] * 8.0 );
flNewOrigin[ 1 ] = flTraceResult[ 1 ] + ( flNormal[ 1 ] * 8.0 );
flNewOrigin[ 2 ] = flTraceResult[ 2 ] + ( flNormal[ 2 ] * 8.0 );

entity_set_origin( iEntity, flNewOrigin );

vector_to_angle( flNormal, flEntAngles );
entity_set_vector( iEntity, EV_VEC_angles, flEntAngles );
flEntAngles[ 0 ] *= -1.0;
flEntAngles[ 1 ] *= -1.0;
flEntAngles[ 2 ] *= -1.0;
entity_set_vector( iEntity, EV_VEC_v_angle, flEntAngles );

g_iTripMines[ iPlayer ]--;

emit_sound( iEntity, CHAN_WEAPON, MINE_SOUND_DEPLOY, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
emit_sound( iEntity, CHAN_VOICE, MINE_SOUND_CHARGE, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );

entity_set_float( iEntity, EV_FL_nextthink, get_gametime( ) + 0.6 );
}

public Func_RemoveMinesByOwner( iPlayer ) {
static iEntity, szClassName[ 32 ];
for( iEntity = 0; iEntity < MAX_ENTITIES + 1; iEntity++ ) {
if( !is_valid_ent( iEntity ) )
continue;

szClassName[ 0 ] = '^0';
entity_get_classname( iEntity, szClassName );

if( equal( szClassName, MINE_CLASSNAME ) )
if( entity_get_int( iEntity, EV_INT_iuser2 ) == iPlayer )
remove_entity( iEntity );
}
}

Func_Explode( iEntity ) {
g_iPlantedMines[ entity_get_owner( iEntity ) ]--;

static Float: flOrigin[ 3 ], Float: flZombieOrigin[ 3 ], Float: flHealth, Float: flVelocity[ 3 ];
entity_get_vector( iEntity, EV_VEC_origin, flOrigin );

message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_EXPLOSION );
engfunc( EngFunc_WriteCoord, flOrigin[ 0 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 1 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 2 ] );
write_short( g_hExplode );
write_byte( 55 );
write_byte( 15 );
write_byte( 0 );
message_end( );

message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_EXPLOSION );
engfunc( EngFunc_WriteCoord, flOrigin[ 0 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 1 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 2 ] );
write_short( g_hExplode );
write_byte( 65 );
write_byte( 15 );
write_byte( 0 );
message_end( );

message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_EXPLOSION );
engfunc( EngFunc_WriteCoord, flOrigin[ 0 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 1 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 2 ] );
write_short( g_hExplode );
write_byte( 85 );
write_byte( 15 );
write_byte( 0 );
message_end( );

static iZombie;
for( iZombie = 1; iZombie < MAX_PLAYERS + 1; iZombie++ ) {
if( is_user_connected( iZombie ) ) {
if( is_user_alive( iZombie ) ) {
entity_get_vector( iZombie, EV_VEC_origin, flZombieOrigin );

if( get_distance_f( flOrigin, flZombieOrigin ) < 360.0 ) {
flHealth = entity_get_float( iZombie, EV_FL_health );
entity_get_vector( iZombie, EV_VEC_velocity, flVelocity );

flVelocity[ 2 ] += 456.0;
flVelocity[ 1 ] += 320.0;
flVelocity[ 0 ] += 299.0;

entity_set_vector( iZombie, EV_VEC_velocity, flVelocity );

if( zp_get_user_zombie( iZombie ) )
fm_set_user_health( iZombie, floatmax( flHealth - random_float( 1600.0, 2800.0 ), 0.0 ) );
}
}
}
}

remove_entity( iEntity );

}

public Forward_Think( iEntity ) {
static Float: flGameTime, iStatus;
flGameTime = get_gametime( );
iStatus = entity_get_status( iEntity );

switch( iStatus ) {
case MINE_OFF: {
entity_set_int( iEntity, EV_INT_iuser1, MINE_ON );
entity_set_float( iEntity, EV_FL_takedamage, DAMAGE_YES );
entity_set_int( iEntity, EV_INT_solid, SOLID_BBOX );
entity_set_float( iEntity, EV_FL_health, MINE_HEALTH + 1000.0 );

emit_sound( iEntity, CHAN_VOICE, MINE_SOUND_ACTIVATE, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}

case MINE_ON: {
static Float: flHealth;
flHealth = entity_get_float( iEntity, EV_FL_health );

if( flHealth <= 1000.0 ) {
Func_Explode( iEntity );

return FMRES_IGNORED;
}
}
}

if( is_valid_ent( iEntity ) )
entity_set_float( iEntity, EV_FL_nextthink, flGameTime + 0.1 );

return FMRES_IGNORED;
}

public fm_set_user_health( iPlayer, Float: flHealth )
flHealth ? set_pev( iPlayer, pev_health, flHealth ) : dllfunc( DLLFunc_ClientKill, iPlayer );

_____________________________________________ _________

Multumesc lui ESPADONGAMING ca ma ajutat
THX for help ESPADONGAMING

Last edited by H3adshot; 10-02-2013 at 19:04.
H3adshot is offline
Send a message via Yahoo to H3adshot
phines
New Member
Join Date: Jul 2016
Old 07-28-2016 , 01:51   Re: [req] tripmine zombie plague
Reply With Quote #14

Quote:
Originally Posted by gamestar110 View Post
Just change
PHP Code:
set_hudmessage(01912550.420.1406.012.0)
show_hudmessageiClient"Health: %d"peviEntitypev_health )); 
TO

PHP Code:
set_hudmessage(01912550.020.1706.012.0)
show_hudmessageiClient"Health: %d"peviEntitypev_health )); 
Cant Give Me plugin Diract Please with models Please
My IP ZP :159.122.102.83:27017
phines is offline
ShooTeR XKy
Member
Join Date: Jul 2014
Location: Palestine
Old 09-16-2016 , 03:49   Re: [req] tripmine zombie plague
Reply With Quote #15

here
Attached Files
File Type: sma Get Plugin or Get Source (zp_extra_tripmine_hattrick.sma - 485 views - 16.0 KB)
ShooTeR XKy is offline
ShooTeR XKy
Member
Join Date: Jul 2014
Location: Palestine
Old 10-01-2016 , 13:02   Re: [req] tripmine zombie plague
Reply With Quote #16

Code:
#include < amxmodx >
#include < fakemeta >
#include < engine >
#include < hamsandwich >
#include < xs >

native zp_get_user_zombie( iPlayer );
native zp_get_user_ammo_packs( iPlayer );
native zp_set_user_ammo_packs( iPlayer, iPacks );
native zp_get_user_nemesis( i );
native zp_is_lnj_round( );
//native Float: HattrickRange( i, j );
#define HattrickRange(%1,%2) entity_range(%1,%2)

new q;

#define MAX_ENTITIES        1500
#define MAX_PLAYERS        32
#define MINE_ON            1
#define MINE_OFF            0
#define TASK_CREATE        84765
#define TASK_REMOVE        86766
#define MINE_COST            8
#define MINE_CLASSNAME        "lasermine"
#define MINE_MODEL_EXPLODE    "sprites/zerogxplode.spr"
#define MINE_MODEL_VIEW        "models/zombie_plague/lasermine.mdl"
#define MINE_SOUND_ACTIVATE    "weapons/mine_activate.wav"
#define MINE_SOUND_CHARGE        "weapons/mine_charge.wav"
#define MINE_SOUND_DEPLOY        "weapons/mine_deploy.wav"
#define MINE_HEALTH        999.0
#define entity_get_owner(%0)        entity_get_int( %0, EV_INT_iuser2 )
#define entity_get_status(%0)        entity_get_int( %0, EV_INT_iuser1 )
#define entity_get_classname(%0,%1)    entity_get_string( %0, EV_SZ_classname, %1, charsmax( %1 ) )
const FFADE_IN = 0x0000
new g_iTripMines[ 33 ];
new g_iPlantedMines[ 33 ];
new g_iPlanting[ 33 ];
new g_iRemoving[ 33 ];
new g_hExplode;

public plugin_init( )
{
    register_plugin( "[S-X] lasermine", "1.0", "Hattrick" );
    
    register_clcmd( "say /lm", "Command_Buy" );
    register_clcmd( "say lm", "Command_Buy" );
    q=get_user_msgid("SayText");
    register_clcmd( "+setlaser", "Command_Plant" );
    register_clcmd( "+dellaser", "Command_Take" );
    
    register_logevent( "Event_RoundStart", 2, "1=Round_Start" );
    
    register_think( MINE_CLASSNAME, "Forward_Think" );
}

public plugin_precache( )
{
    engfunc( EngFunc_PrecacheModel, MINE_MODEL_VIEW );
    
    engfunc( EngFunc_PrecacheSound, MINE_SOUND_ACTIVATE );
    engfunc( EngFunc_PrecacheSound, MINE_SOUND_CHARGE );
    engfunc( EngFunc_PrecacheSound, MINE_SOUND_DEPLOY );
    
    g_hExplode = engfunc( EngFunc_PrecacheModel, MINE_MODEL_EXPLODE );
}

public client_disconnect( iPlayer )
{
    g_iTripMines[ iPlayer ] = 0;
    g_iPlanting[ iPlayer ] = false;
    g_iRemoving[ iPlayer ] = false;
    
    if( g_iPlantedMines[ iPlayer ] )
    {
        Func_RemoveMinesByOwner( iPlayer );
        
        g_iPlantedMines[ iPlayer ] = 0;
    }
    
    remove_task( iPlayer + TASK_REMOVE );
    remove_task( iPlayer + TASK_CREATE );
}

public Command_Buy( iPlayer )
{
    if( !is_user_alive( iPlayer ) )
    {
        client_print( iPlayer, print_chat, "[S-X] You should be Alive" );
        
        return PLUGIN_CONTINUE;
    }
    
    if( zp_get_user_zombie( iPlayer ) )
    {
        client_print( iPlayer, print_chat, "[S-X] You should be Human" );
        
        return PLUGIN_CONTINUE;
    }
    
    if( zp_get_user_ammo_packs( iPlayer ) < MINE_COST )
    {
        client_print( iPlayer, print_chat, "[S-X] You need %i Ammo packs", MINE_COST );
        
        return PLUGIN_CONTINUE;
    }
    
    if( zp_is_lnj_round( ) )
    {
        client_print( iPlayer, print_chat, "[S-X] You can't buy a Tripmine into an Armageddon round" );
        
        return PLUGIN_CONTINUE;
    }
    
    zp_set_user_ammo_packs( iPlayer, zp_get_user_ammo_packs( iPlayer ) - MINE_COST );
    
    g_iTripMines[ iPlayer ]++;
    
    client_print( iPlayer, print_chat, "[S-X]You bought Tripmine" );
    
    client_cmd( iPlayer, "bind c +setlaser" );
    client_cmd( iPlayer, "bind v +dellaser" );
    
    return PLUGIN_CONTINUE;
}

public Command_Plant( iPlayer )
{
    if( !is_user_alive( iPlayer ) )
    {
        client_print( iPlayer, print_chat, "[S-X] You should be Alive" );
        
        return PLUGIN_CONTINUE;
    }
    
    if( zp_get_user_zombie( iPlayer ) )
    {
        client_print( iPlayer, print_chat, "[S-X] You should be Human" );
        
        return PLUGIN_CONTINUE;
    }
    
    if( !g_iTripMines[ iPlayer ] )
    {
        client_print( iPlayer, print_chat, "[S-X] You don't have a Tripmine to plant" );
        
        return PLUGIN_CONTINUE;
    }
    
    if( g_iPlantedMines[ iPlayer ] > 1 )
    {
        client_print( iPlayer, print_chat, "[S-X] You can plant only 2 Mines" );
        
        return PLUGIN_CONTINUE;
    }
    
    if( zp_is_lnj_round( ) )
    {
        client_print( iPlayer, print_chat, "[S-X] You can't buy a Tripmine into an Armageddon round" );
        
        return PLUGIN_CONTINUE;
    }
    
    if( g_iPlanting[ iPlayer ] || g_iRemoving[ iPlayer ] )
        return PLUGIN_CONTINUE;
    
    if( CanPlant( iPlayer ) ) {
        g_iPlanting[ iPlayer ] = true;
        
        message_begin( MSG_ONE_UNRELIABLE, 108, _, iPlayer );
        write_byte( 1 );
        write_byte( 0 );
        message_end( );
        
        set_task( 1.2, "Func_Plant", iPlayer + TASK_CREATE );
    }
    
    return PLUGIN_CONTINUE;
}

public Command_Take( iPlayer )
{
    if( !is_user_alive( iPlayer ) )
    {
        client_print( iPlayer, print_chat, "[S-X] You should be Alive" );
        
        return PLUGIN_CONTINUE;
    }
    
    if( zp_get_user_zombie( iPlayer ) )
    {
        client_print( iPlayer, print_chat, "[S-X] You should be Human" );
        
        return PLUGIN_CONTINUE;
    }
    
    if( !g_iPlantedMines[ iPlayer ] )
    {
        client_print( iPlayer, print_chat, "[S-X] You don't have a planted mine" );
        
        return PLUGIN_CONTINUE;
    }
    
    if( g_iPlanting[ iPlayer ] || g_iRemoving[ iPlayer ] )
        return PLUGIN_CONTINUE;
    
    if( CanTake( iPlayer ) ) {
        g_iRemoving[ iPlayer ] = true;
        
        message_begin( MSG_ONE_UNRELIABLE, 108, _, iPlayer );
        write_byte( 1 );
        write_byte( 0 );
        message_end( );
        
        set_task( 1.2, "Func_Take", iPlayer + TASK_REMOVE );
    }
    
    return PLUGIN_CONTINUE;
}

public Event_RoundStart( ) {
    static iEntity, szClassName[ 32 ], iPlayer;
    for( iEntity = 0; iEntity < MAX_ENTITIES + 1; iEntity++ ) {
        if( !is_valid_ent( iEntity ) )
            continue;
        
        szClassName[ 0 ] = '^0';
        entity_get_classname( iEntity, szClassName );
        
        if( equal( szClassName, MINE_CLASSNAME ) )
            remove_entity( iEntity );
    }
    
    for( iPlayer = 1; iPlayer < 33; iPlayer++ ) {
        g_iTripMines[ iPlayer ] = 0;
        g_iPlantedMines[ iPlayer ] = 0;
    }
}

public Func_Take( iPlayer ) {
    iPlayer -= TASK_REMOVE;
    
    g_iRemoving[ iPlayer ] = false;
    
    static iEntity, szClassName[ 32 ], Float: flOwnerOrigin[ 3 ], Float: flEntityOrigin[ 3 ];
    for( iEntity = 0; iEntity < MAX_ENTITIES + 1; iEntity++ ) {
        if( !is_valid_ent( iEntity ) )
            continue;
        
        szClassName[ 0 ] = '^0';
        entity_get_classname( iEntity, szClassName );
        
        if( equal( szClassName, MINE_CLASSNAME ) ) {
            if( entity_get_owner( iEntity ) == iPlayer ) {
                entity_get_vector( iPlayer, EV_VEC_origin, flOwnerOrigin );
                entity_get_vector( iEntity, EV_VEC_origin, flEntityOrigin );
                
                if( get_distance_f( flOwnerOrigin, flEntityOrigin ) < 55.0 ) {
                    g_iPlantedMines[ iPlayer ]--;
                    g_iTripMines[ iPlayer ]++;
                    
                    remove_entity( iEntity );
                    
                    break;
                }
            }
        }
    }
}

public bool: CanTake( iPlayer ) {
    static iEntity, szClassName[ 32 ], Float: flOwnerOrigin[ 3 ], Float: flEntityOrigin[ 3 ];
    for( iEntity = 0; iEntity < MAX_ENTITIES + 1; iEntity++ ) {
        if( !is_valid_ent( iEntity ) )
            continue;
        
        szClassName[ 0 ] = '^0';
        entity_get_classname( iEntity, szClassName );
        
        if( equal( szClassName, MINE_CLASSNAME ) ) {
            if( entity_get_owner( iEntity ) == iPlayer ) {
                entity_get_vector( iPlayer, EV_VEC_origin, flOwnerOrigin );
                entity_get_vector( iEntity, EV_VEC_origin, flEntityOrigin );
                
                if( get_distance_f( flOwnerOrigin, flEntityOrigin ) < 55.0 )
                    return true;
            }
        }
    }
    
    return false;
}

public bool: CanPlant( iPlayer ) {
    static Float: flOrigin[ 3 ];
    entity_get_vector( iPlayer, EV_VEC_origin, flOrigin );
    
    static Float: flTraceDirection[ 3 ], Float: flTraceEnd[ 3 ], Float: flTraceResult[ 3 ], Float: flNormal[ 3 ];
    velocity_by_aim( iPlayer, 64, flTraceDirection );
    flTraceEnd[ 0 ] = flTraceDirection[ 0 ] + flOrigin[ 0 ];
    flTraceEnd[ 1 ] = flTraceDirection[ 1 ] + flOrigin[ 1 ];
    flTraceEnd[ 2 ] = flTraceDirection[ 2 ] + flOrigin[ 2 ];
    
    static Float: flFraction, iTr;
    iTr = 0;
    engfunc( EngFunc_TraceLine, flOrigin, flTraceEnd, 0, iPlayer, iTr );
    get_tr2( iTr, TR_vecEndPos, flTraceResult );
    get_tr2( iTr, TR_vecPlaneNormal, flNormal );
    get_tr2( iTr, TR_flFraction, flFraction );
    
    if( flFraction >= 1.0 ) {
        client_print( iPlayer, print_chat, "[S-X] You must plant the Tripmine on a Wall" );
        
        return false;
    }
    
    return true;
}

public Func_Plant( iPlayer ) {
    iPlayer -= TASK_CREATE;
    
    g_iPlanting[ iPlayer ] = false;
    
    static Float: flOrigin[ 3 ];
    entity_get_vector( iPlayer, EV_VEC_origin, flOrigin );
    
    static Float: flTraceDirection[ 3 ], Float: flTraceEnd[ 3 ], Float: flTraceResult[ 3 ], Float: flNormal[ 3 ];
    velocity_by_aim( iPlayer, 128, flTraceDirection );
    flTraceEnd[ 0 ] = flTraceDirection[ 0 ] + flOrigin[ 0 ];
    flTraceEnd[ 1 ] = flTraceDirection[ 1 ] + flOrigin[ 1 ];
    flTraceEnd[ 2 ] = flTraceDirection[ 2 ] + flOrigin[ 2 ];
    
    static Float: flFraction, iTr;
    iTr = 0;
    engfunc( EngFunc_TraceLine, flOrigin, flTraceEnd, 0, iPlayer, iTr );
    get_tr2( iTr, TR_vecEndPos, flTraceResult );
    get_tr2( iTr, TR_vecPlaneNormal, flNormal );
    get_tr2( iTr, TR_flFraction, flFraction );
    
    static iEntity;
    iEntity = create_entity( "info_target" );
    
    if( !iEntity )
        return;
    
    entity_set_string( iEntity, EV_SZ_classname, MINE_CLASSNAME );
    entity_set_model( iEntity, MINE_MODEL_VIEW );
    entity_set_size( iEntity, Float: { -15.0, -15.0, -15.0 }, Float: { 15.0, 15.0, 15.0 } );
    
    entity_set_int( iEntity, EV_INT_iuser2, iPlayer );
    
    g_iPlantedMines[ iPlayer ]++;

    set_pev( iEntity, pev_iuser3, g_iPlantedMines[ iPlayer ] );
    
    entity_set_float( iEntity, EV_FL_frame, 0.0 );
    entity_set_float( iEntity, EV_FL_framerate, 0.0 );
    entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_FLY );
    entity_set_int( iEntity, EV_INT_solid, SOLID_NOT );
    entity_set_int( iEntity, EV_INT_body, 3 );
    entity_set_int( iEntity, EV_INT_sequence, 7 );
    entity_set_float( iEntity, EV_FL_takedamage, DAMAGE_NO );
    entity_set_int( iEntity, EV_INT_iuser1, MINE_OFF );
    
    static Float: flNewOrigin[ 3 ], Float: flEntAngles[ 3 ];
    flNewOrigin[ 0 ] = flTraceResult[ 0 ] + ( flNormal[ 0 ] * 8.0 );
    flNewOrigin[ 1 ] = flTraceResult[ 1 ] + ( flNormal[ 1 ] * 8.0 );
    flNewOrigin[ 2 ] = flTraceResult[ 2 ] + ( flNormal[ 2 ] * 8.0 );
    
    entity_set_origin( iEntity, flNewOrigin );
    
    vector_to_angle( flNormal, flEntAngles );
    entity_set_vector( iEntity, EV_VEC_angles, flEntAngles );
    flEntAngles[ 0 ] *= -1.0;
    flEntAngles[ 1 ] *= -1.0;
    flEntAngles[ 2 ] *= -1.0;
    entity_set_vector( iEntity, EV_VEC_v_angle, flEntAngles );
    
    g_iTripMines[ iPlayer ]--;
    
    emit_sound( iEntity, CHAN_WEAPON, MINE_SOUND_DEPLOY, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
    emit_sound( iEntity, CHAN_VOICE, MINE_SOUND_CHARGE, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
    
    entity_set_float( iEntity, EV_FL_nextthink, get_gametime( ) + 0.6 );
}

public Func_RemoveMinesByOwner( iPlayer ) {
    static iEntity, szClassName[ 32 ];
    for( iEntity = 0; iEntity < MAX_ENTITIES + 1; iEntity++ ) {
        if( !is_valid_ent( iEntity ) )
            continue;
        
        szClassName[ 0 ] = '^0';
        entity_get_classname( iEntity, szClassName );
        
        if( equal( szClassName, MINE_CLASSNAME ) )
            if( entity_get_int( iEntity, EV_INT_iuser2 ) == iPlayer )
                remove_entity( iEntity );
    }
}

Func_Explode( iEntity ) {
    g_iPlantedMines[ entity_get_owner( iEntity ) ]--;
    
    static Float: flOrigin[ 3 ];
    entity_get_vector( iEntity, EV_VEC_origin, flOrigin );
    
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
    write_byte( TE_EXPLOSION );
    engfunc( EngFunc_WriteCoord, flOrigin[ 0 ] );
    engfunc( EngFunc_WriteCoord, flOrigin[ 1 ] );
    engfunc( EngFunc_WriteCoord, flOrigin[ 2 ] );
    write_short( g_hExplode );
    write_byte( 55 );
    write_byte( 15 );
    write_byte( 0 );
    message_end( );
    
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
    write_byte( TE_EXPLOSION );
    engfunc( EngFunc_WriteCoord, flOrigin[ 0 ] );
    engfunc( EngFunc_WriteCoord, flOrigin[ 1 ] );
    engfunc( EngFunc_WriteCoord, flOrigin[ 2 ] );
    write_short( g_hExplode );
    write_byte( 65 );
    write_byte( 15 );
    write_byte( 0 );
    message_end( );
    
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
    write_byte( TE_EXPLOSION );
    engfunc( EngFunc_WriteCoord, flOrigin[ 0 ] );
    engfunc( EngFunc_WriteCoord, flOrigin[ 1 ] );
    engfunc( EngFunc_WriteCoord, flOrigin[ 2 ] );
    write_short( g_hExplode );
    write_byte( 85 );
    write_byte( 15 );
    write_byte( 0 );
    message_end( );
    
    for( new i = 1; i < 33; i++ )
    {
        if( !is_user_connected( i ) || !is_user_alive( i ) ) continue;
        if( zp_get_user_zombie( i ) )
        {
            static Float: fDistance, Float: fDamage;

            fDistance = HattrickRange( i, iEntity );

            if( fDistance < 340 )
            {
                fDamage = 1900 - fDistance;

                if( !zp_get_user_nemesis( i ) )
                    fDamage *= 0.75;

                static Float: fVelocity[ 3 ];
                pev( i, pev_velocity, fVelocity );

                xs_vec_mul_scalar( fVelocity, 1.75, fVelocity );

                set_pev( i, pev_velocity, fVelocity );

                message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenFade" ), _, i );
                write_short( 4096 );
                write_short( 4096 );
                write_short( FFADE_IN );
                write_byte( 255 );
                write_byte( 0 );
                write_byte( 0 );
                write_byte( 225 );
                message_end( );

                message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenShake" ), _, i );
                write_short( 4096 * 19 );
                write_short( 4096 * 7 );
                write_short( 4096 * 24 );
                message_end( );

                if( float( get_user_health( i ) ) - fDamage > 0 )
                    ExecuteHamB( Ham_TakeDamage, i, iEntity, entity_get_owner( iEntity ), fDamage, DMG_BLAST );

                else ExecuteHamB( Ham_Killed, i, entity_get_owner( iEntity ), 2 );

                static cName[ 32 ]; get_user_name( i, cName, 31 );
                Message( entity_get_owner( iEntity ), "^x04[S-X]^x01 Damage to^x03 %s^x01 ::^x04 %0.0f damage", cName, fDamage );
            }
        }
    }

    for( new i = 1; i < 33; i++ )
    {
        if( !is_user_connected( i ) || !is_user_alive( i ) )
            continue;
        if( !zp_get_user_zombie( i ) )
        {
            if( HattrickRange( i, iEntity ) < 340 )
            {
                static Float: fVelocity[ 3 ];
                pev( i, pev_velocity, fVelocity );

                xs_vec_mul_scalar( fVelocity, 1.5, fVelocity );

                set_pev( i, pev_velocity, fVelocity );

                message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenShake" ), _, i );
                write_short( 4096 * 19 );
                write_short( 4096 * 7 );
                write_short( 4096 * 24 );
                message_end( );
            }
        }
    }

    remove_entity( iEntity );
}

public Forward_Think( iEntity ) {
    static Float: flGameTime, iStatus;
    flGameTime = get_gametime( );
    iStatus = entity_get_status( iEntity );
    
    switch( iStatus ) {
        case MINE_OFF: {
            entity_set_int( iEntity, EV_INT_iuser1, MINE_ON );
            entity_set_float( iEntity, EV_FL_takedamage, DAMAGE_YES );
            entity_set_int( iEntity, EV_INT_solid, SOLID_BBOX );
            entity_set_float( iEntity, EV_FL_health, MINE_HEALTH + 1000.0 );
            
            emit_sound( iEntity, CHAN_VOICE, MINE_SOUND_ACTIVATE, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
        }
        
        case MINE_ON: {
            static Float: flHealth;
            flHealth = entity_get_float( iEntity, EV_FL_health );

            if( is_user_alive( entity_get_owner( iEntity ) ) )
            {
                if( pev( iEntity, pev_iuser3 ) == 1 )
                    set_hudmessage(0, 200, 100, 0.05, 0.3, 0, 0.0, 0.12, 2.0, 1.0, -1),
                    show_hudmessage( entity_get_owner( iEntity ), "Lasermine #1 :: %0.0f HP", flHealth - 1000.0 );

                else
                    set_hudmessage(0, 200, 100, 0.05, 0.32, 0, 0.0, 0.12, 2.0, 1.0, -1),
                    show_hudmessage( entity_get_owner( iEntity ), "Lasermine #2 :: %0.0f HP", flHealth - 1000.0 );
            }

            if( flHealth <= 1000.0 ) {
                Func_Explode( iEntity );
                
                return FMRES_IGNORED;
            }
        }
    }
    
    if( is_valid_ent( iEntity ) )
        entity_set_float( iEntity, EV_FL_nextthink, flGameTime + 0.1 );
    
    return FMRES_IGNORED;
}
Message( v, c[ ], any: ... )
{
    static cBuffer[ 192 ];
    vformat( cBuffer, 191, c, 3 );

    if( v )
    {
        message_begin( MSG_ONE_UNRELIABLE, q, _, v );
        write_byte( v );
        write_string( cBuffer );
        message_end( );
    }

    else
    {
        static i[ 32 ], j, k;
        get_players( i, j, "ch" );
        for( k = 0; k < j; k++ )
        {
            message_begin( MSG_ONE_UNRELIABLE, q, _, i[ k ] );
            write_byte( i[ k ] );
            write_string( cBuffer );
            message_end( );
        }
    }
}
ShooTeR XKy is offline
Dr Zayd
Senior Member
Join Date: Jun 2014
Location: forums.alliedmods.net
Old 10-05-2016 , 22:57   Re: [req] tripmine zombie plague
Reply With Quote #17

sorry for going off-topic but you have a high ping and 4FPS how the hell that you can play cs 1.6 ?
__________________
Invisible System | 100%
ـــــــــــــــــــــــــــــ
Anti setinfo check | Ez Plugin and lite
ـــــــــــــــــــــــــــــ
[ZP] Free VIP Menu | Free VIP menu | ZP-Mod |
Dr Zayd is offline
Reply


Thread Tools
Display Modes

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 01:13.


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