AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ZP 4.3 Knockback bomb (https://forums.alliedmods.net/showthread.php?t=168764)

bloczek 10-03-2011 16:36

ZP 4.3 Knockback bomb
 
Many ppl know about this plug:
PHP Code:

#include < amxmodx >
#include < cstrike >
#include < engine >
#include <fakemeta_util>
#include < fun >
#include < hamsandwich >
#include < zombieplague >

#define Plugin    "[ZM] Extra Item: Jump Bomb"
#define Version    "1.2"
#define Author    "Zombie-rus"

// Модели гранаты
new const g_ViewModel [ ] = "models/cz/v_zombibomb.mdl"
new const g_PlayerModel [ ] = "models/cz/p_zombibomb.mdl"
new const g_WorldModel [ ] = "models/cz/w_zombibomb.mdl"

//Звуки покупки
new const g_SoundGrenadeBuy [ ] [ ] = { "items/gunpickup2.wav" }
new const 
g_SoundAmmoPurchase [ ] [ ] = { "items/9mmclip1.wav" }

//Звук взрыва
new const g_SoundBombExplode [ ] [ ] = { "nst_zombie/zombi_bomb_exp.wav" }

//Не изменять! Звуки прописаны в модели.
new const frogbomb_sound [ ] = { "nst_zombie/zombi_bomb_pull_1.wav""nst_zombie/zombi_bomb_deploy.wav" }
new const 
frogbomb_sound_idle [ ] = {  "nst_zombie/zombi_bomb_idle_1.wav""nst_zombie/zombi_bomb_idle_2.wav",  "nst_zombie/zombi_bomb_idle_3.wav""nst_zombie/zombi_bomb_idle_4.wav" }

new const 
g_szItemName [ ] = "Jump Bomb \r[Knockback Bomb]" // Имя айтема

new const g_iItemPrice // Стоимость за 1 бомбу

#define MAXCARRY    5 // Лимит гранат
#define RADIUS        300.0 // Радиус взрыва

#define MAXPLAYERS        32
#define pev_nade_type        pev_flTimeStepSound
#define NADE_TYPE_JUMPING    26517
#define AMMOID_SM        13

new g_iExplo
new g_iNadeID

new g_iJumpingNadeCount MAXPLAYERS+]
new 
g_iCurrentWeapon MAXPLAYERS+]

new 
cvar_speed
new iconstatus
new grenade_icons[33][32]

new 
g_msgScreenShake

new g_MaxPlayers
new g_msgAmmoPickup

const UNIT_SECOND = (1<<12)

public 
plugin_precache ( )
{
precache_model g_ViewModel )
precache_model g_PlayerModel )
precache_model g_WorldModel )
        
precache_sound frogbomb_sound )
precache_sound frogbomb_sound_idle )
        
new 
i
for ( 0sizeof g_SoundGrenadeBuyi++ )
precache_sound g_SoundGrenadeBuy ] )
for ( 
0sizeof g_SoundAmmoPurchasei++ )
precache_sound g_SoundAmmoPurchase ] )
for ( 
0sizeof g_SoundBombExplodei++ )
precache_sound g_SoundBombExplode ] )

g_iExplo precache_model "sprites/zombiebomb_exp.spr" // Спрайт взрыва
}

public 
plugin_init ( )
{
register_plugin PluginVersionAuthor )

g_iNadeID zp_register_extra_item g_szItemNameg_iItemPriceZP_TEAM_ZOMBIE )

register_event "CurWeapon""EV_CurWeapon""be""1=1" )
register_event "HLTV""EV_NewRound""a""1=0""2=0" )
register_event "DeathMsg""EV_DeathMsg""a" )

register_forward FM_SetModel"fw_SetModel" )
RegisterHam Ham_Think"grenade""fw_ThinkGrenade" )
g_msgScreenShake get_user_msgid("ScreenShake")

cvar_speed register_cvar "zp_zombiebomb_knockback""800" )

g_msgAmmoPickup get_user_msgid "AmmoPickup" )

g_MaxPlayers get_maxplayers ( )
register_event("CurWeapon""grenade_icon""be""1=1")
register_event("DeathMsg""event_death""a")
iconstatus get_user_msgid("StatusIcon")
}

public 
client_connect id )
{
    
g_iJumpingNadeCount id ] = 0
}

public 
zp_extra_item_selected idItem )
{
if ( 
Item == g_iNadeID )
{
if ( 
g_iJumpingNadeCount id ] >= MAXCARRY )
{
client_print idprint_chat"[ZM] Mozesz posiadac maxymalnie 5 Jump Bomb's na raz!" )
return 
ZP_PLUGIN_HANDLED
}        
new 
iBpAmmo cs_get_user_bpammo idCSW_SMOKEGRENADE )
          
if ( 
g_iJumpingNadeCount id ] >= )
{
cs_set_user_bpammo idCSW_SMOKEGRENADEiBpAmmo+)
             
emit_sound idCHAN_ITEMg_SoundAmmoPurchase[random_num(0sizeof  g_SoundAmmoPurchase-1)], VOL_NORMATTN_NORM0PITCH_NORM )
             
AmmoPickup idAMMOID_SM)
             
g_iJumpingNadeCount id ]++
}
else
{
give_item id"weapon_smokegrenade" )
client_print idprint_chat"[ZM] Kupiles Jump Bomb!" )
emit_sound idCHAN_ITEMg_SoundGrenadeBuy[random_num(0sizeof g_SoundGrenadeBuy-1)], VOL_NORMATTN_NORM0PITCH_NORM )
             
AmmoPickup idAMMOID_SM)
             
g_iJumpingNadeCount id ] = 1
}
}
return 
PLUGIN_CONTINUE
}

public 
zp_user_infected_post idInfectorNemesis )

{
g_iJumpingNadeCount id ] = 0
       
give_item 
id"weapon_smokegrenade" )    
cs_set_user_bpammo(idCSW_SMOKEGRENADE1)
emit_sound idCHAN_ITEMg_SoundGrenadeBuy[random_num(0sizeof  g_SoundGrenadeBuy-1)], VOL_NORMATTN_NORM0PITCH_NORM )     
AmmoPickup idAMMOID_SM)    
g_iJumpingNadeCount id ] = 1
}

public 
zp_user_humanized_post idSurvivor )
{
if ( 
Survivor )
{
g_iJumpingNadeCount Survivor ] = 0
}
}

public 
EV_CurWeapon id )
{
if ( !
is_user_alive id ) || !zp_get_user_zombie id ) )
return 
PLUGIN_CONTINUE

g_iCurrentWeapon 
id ] = read_data )
if ( 
g_iJumpingNadeCount id ] > && g_iCurrentWeapon id ] == CSW_SMOKEGRENADE )
{
set_pev(idpev_viewmodel2g_ViewModel)
set_pev idpev_weaponmodel2g_PlayerModel )
}
return 
PLUGIN_CONTINUE
}

public 
EV_NewRound ( )
{
arrayset g_iJumpingNadeCount033 )
}

public 
EV_DeathMsg ( )
{
new 
iVictim read_data )
       
if ( !
is_user_connected iVictim ) )
return
       
g_iJumpingNadeCount iVictim ] = 0
}

public 
fw_SetModel Entity, const Model [ ] )
{
if ( 
Entity )
return 
FMRES_IGNORED
       
if ( pev Entitypev_dmgtime ) == 0.0 )
return 
FMRES_IGNORED
       
new iOwner entity_get_edict EntityEV_ENT_owner )   
       
if ( 
g_iJumpingNadeCount iOwner ] >= && equal Model ], "w_sm") )
{
// Reset any other nade
set_pev Entitypev_nade_type)
           
set_pev Entitypev_nade_typeNADE_TYPE_JUMPING )
            
g_iJumpingNadeCount iOwner ]--
entity_set_model Entityg_WorldModel )
            
fm_set_rendering(EntitykRenderFxHologram2551650kRenderNormal16//kRenderFxGlowShell
            
return FMRES_SUPERCEDE    
}
return 
FMRES_IGNORED
}
public 
fw_ThinkGrenade Entity )
{
if ( !
pev_valid Entity ) )
return 
HAM_IGNORED
       
static Float:dmg_time
pev 
Entitypev_dmgtimedmg_time )
       
if ( 
dmg_time get_gametime ( ) )
return 
HAM_IGNORED
       
if ( pev Entitypev_nade_type ) == NADE_TYPE_JUMPING )
{
jumping_explode Entity )
return 
HAM_SUPERCEDE
}
return 
HAM_IGNORED
}

public 
jumping_explode Entity )
{
if ( 
Entity )
return
       
static 
Float:flOrigin ]
pev Entitypev_originflOrigin )
       
engfunc EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYflOrigin)
write_byte TE_SPRITE )
engfunc EngFunc_WriteCoordflOrigin ] )
engfunc EngFunc_WriteCoordflOrigin ] )
engfunc EngFunc_WriteCoordflOrigin ] + 45.0 )
write_short g_iExplo )
write_byte 35 )
write_byte 186 )
message_end ( )
       
new 
iOwner entity_get_edict EntityEV_ENT_owner )
       
emit_sound EntityCHAN_WEAPONg_SoundBombExplode[random_num(0,  sizeof g_SoundBombExplode-1)], VOL_NORMATTN_NORM0PITCH_NORM )
       
for ( new 
1g_MaxPlayersi++ )
{
if ( !
is_user_alive  ) )
continue
                  
new 
Float:flVictimOrigin ]
pev ipev_originflVictimOrigin )
           
new 
Float:flDistance get_distance_f flOriginflVictimOrigin )   
           
if ( 
flDistance <= RADIUS )
{
static 
Float:flSpeed
flSpeed 
get_pcvar_float cvar_speed )
               
static 
Float:flNewSpeed
flNewSpeed 
flSpeed * ( 1.0 - ( flDistance RADIUS ) )
               
static 
Float:flVelocity ]
get_speed_vector flOriginflVictimOriginflNewSpeedflVelocity )
               
set_pev ipev_velocity,flVelocity )

message_begin(MSG_ONE_UNRELIABLEg_msgScreenShake_i)
write_short(UNIT_SECOND*4// amplitude             
write_short(UNIT_SECOND*5// duration
write_short(UNIT_SECOND*5// frequency
message_end()    
                
fm_fakedamage(i"knockback-bomb"10.0,  DMG_BLAST);
}
}

engfunc EngFunc_RemoveEntityEntity )
}       

public 
AmmoPickup idAmmoIDAmmoAmount )
{
message_begin MSG_ONEg_msgAmmoPickup_id )
write_byte AmmoID )
write_byte AmmoAmount )
message_end ( )
}

stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speedFloat:new_velocity[3])
{
new_velocity[0] = origin2[0] - origin1[0]
new_velocity[1] = origin2[1] - origin1[1]
new_velocity[2] = origin2[2] - origin1[2]
new 
Float:num floatsqroot(speed*speed /  (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] +  new_velocity[2]*new_velocity[2]))
new_velocity[0] *= num
new_velocity
[1] *= num
new_velocity
[2] *= num
       
return 1;
}

public 
grenade_icon(id
{
remove_grenade_icon(id)
        
if(
is_user_bot(id))
        return
        
static 
igrenadegrenade_sprite[16], grenade_color[3]
igrenade get_user_weapon(id)
    
switch(
igrenade
{
case 
CSW_SMOKEGRENADE:
{
if(!
is_user_alive(id) || zp_get_user_zombie(id)) {
grenade_sprite "dmg_gas"
grenade_color = {2551650
}
else
{
grenade_sprite ""
grenade_color = {000
}
}
default: 
return
}
grenade_icons[id] = grenade_sprite
    
// show grenade icons
message_begin(MSG_ONE,iconstatus,{0,0,0},id)
write_byte(1// status (0=hide, 1=show, 2=flash)
write_string(grenade_icons[id]) // sprite name
write_byte(grenade_color[0]) // red
write_byte(grenade_color[1]) // green
write_byte(grenade_color[2]) // blue
message_end()
    
return
}

public 
remove_grenade_icon(id
{
// remove grenade icons
message_begin(MSG_ONE,iconstatus,{0,0,0},id)
write_byte(0// status (0=hide, 1=show, 2=flash)
write_string(grenade_icons[id]) // sprite name
message_end()
}

public 
event_death() 
{
new 
id read_data(2)
    
if(!
is_user_bot(id))
remove_grenade_icon(id)


First of all, this .sma can't compile (for newest compilator) .
Second i think this plug would be more practical if change this. Turn off ability to buy it for all, turn off appear to zombies for every spawn, but nemezis every spawn get 5 of them only.
How about this ?

enjoi. 10-03-2011 16:40

Re: ZP 4.3 Knockback bomb
 
Sigh you could of posted the error. Yer lazy son.
Its because you need to compile locally. Let me get zombie plague.inc and try to compile

enjoi. 10-03-2011 16:43

Re: ZP 4.3 Knockback bomb
 
1 Attachment(s)
Compiled perfectly. Just 1 warning.

if you still cant figure it out pm me.

The Inhabitant Of Heavens 10-03-2011 23:32

Re: ZP 4.3 Knockback bomb
 
#define Author "Zombie-rus" WTF ?!

#define Author "NiHiLaNTh" - The real author !!!

yokomo 10-04-2011 02:15

Re: ZP 4.3 Knockback bomb
 
1 Attachment(s)
@bloczek
You want to make it as server addon? please try it. Only Nemesis will get 5 jumpnade every spawn and no one can buy it.

bloczek 10-04-2011 05:50

Re: ZP 4.3 Knockback bomb
 
Quote:

Originally Posted by enjoi. (Post 1567889)
Its because you need to compile locally.

I do this and still have 3 errors and can't compile
Quote:

Originally Posted by The Inhabitant Of Heavens (Post 1568065)
#define Author "Zombie-rus" WTF ?!

#define Author "NiHiLaNTh" - The real author !!!

Don't ask me... it's russian work...
Quote:

Originally Posted by yokomo (Post 1568109)
@bloczek
You want to make it as server addon? please try it. Only Nemesis will get 5 jumpnade every spawn and no one can buy it.

unfortunately i have the same 3 errors like on orginal plug compilation:
[IMG]http://img196.**************/img196/5413/compuz.jpg[/IMG]

And can't download .amxx

yokomo 10-04-2011 09:47

Re: ZP 4.3 Knockback bomb
 
@bloczek
1. use steam
2. install a full amxmodx package
3. copy .sma into "scripting" folder
4. compile

from the picture you attached above i see you don't have any include files yet.

bloczek 10-04-2011 10:33

Re: ZP 4.3 Knockback bomb
 
Quote:

Originally Posted by yokomo (Post 1568251)
@bloczek
1. use steam
2. install a full amxmodx package
3. copy .sma into "scripting" folder
4. compile

from the picture you attached above i see you don't have any include files yet.

Yesss... compilation done.
And plug work perfectly. Exactly how i imagine.
So sorry for trouble from noob like me, and Thank You for help. Keep goin :3

TOM4S 10-30-2011 20:45

Re: ZP 4.3 Knockback bomb
 
Nice man :D


All times are GMT -4. The time now is 19:38.

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