Raised This Month: $9 Target: $400
 2% 

Jetpack+Bazooka


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
R.I.P
Junior Member
Join Date: Jun 2013
Old 06-01-2013 , 05:32   Jetpack+Bazooka
Reply With Quote #1

Jetpack+Bazooka give ammo




Attached Files
File Type: sma Get Plugin or Get Source (Jetpack+Bazooka.sma - 940 views - 22.4 KB)

Last edited by R.I.P; 06-01-2013 at 05:45.
R.I.P is offline
Egan
Senior Member
Join Date: May 2013
Location: pluto
Old 06-01-2013 , 06:19   Re: Jetpack+Bazooka
Reply With Quote #2

if your smart you would attach a resource file....

and their are like alot of jetpack+bazooka plugins out their and wht makes your plugin so special ?
__________________
Egan is offline
Old 06-01-2013, 06:51
bat
This message has been deleted by bat. Reason: Idiot
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 06-01-2013 , 12:29   Re: Jetpack+Bazooka
Reply With Quote #3

I think he bought this from ZOMBIE OUTSTANDING. But still nthing better than other such shit...... Nonetheless People continue to post things like this.
Catastrophe is offline
bashar beesho 1999
Junior Member
Join Date: Jun 2013
Old 06-24-2013 , 19:29   Re: Jetpack+Bazooka
Reply With Quote #4

how can i fix this

Quote:
L 06/25/2013 - 01:21:46: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/25/2013 - 01:21:46: [ZP] Invalid Player (25)
L 06/25/2013 - 01:21:46: [AMXX] Run time error 10 (plugin "Jetpack+Bazooka.amxx") (native "zp_get_user_zombie") - debug not enabled!
pllllez help !!!!!!
bashar beesho 1999 is offline
darkallience5
Junior Member
Join Date: Jun 2013
Old 06-25-2013 , 01:38   Re: Jetpack+Bazooka
Reply With Quote #5

tnx man !
darkallience5 is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 06-25-2013 , 02:09   Re: Jetpack+Bazooka
Reply With Quote #6

Quote:
Originally Posted by bashar beesho 1999 View Post
how can i fix this


pllllez help !!!!!!
Enable the debug then, post the output here....
__________________
You will find everything u need :-
Catastrophe is offline
bashar beesho 1999
Junior Member
Join Date: Jun 2013
Old 06-25-2013 , 14:04   Re: Jetpack+Bazooka
Reply With Quote #7

Quote:
Originally Posted by Catastrophe View Post
Enable the debug then, post the output here....

Quote:
L 06/26/2013 - 02:28:55: [ZP] Invalid Player (25)
L 06/26/2013 - 02:28:55: [AMXX] Displaying debug trace (plugin "Jetpack+Bazooka.amxx")
L 06/26/2013 - 02:28:55: [AMXX] Run time error 10: native error (native "zp_get_user_zombie")
L 06/26/2013 - 02:28:55: [AMXX] [0] Jetpack+Bazooka.sma::jp_forward (line 144)
L 06/26/2013 - 02:28:55: [AMXX] [1] Jetpack+Bazooka.sma::fm_startFrame (line 13
L 06/26/2013 - 02:28:55: [META] ERROR: Plugin didn't set meta_result: fakemeta_amxx.dll:StartFrame()
PLLLLLLLLLLLLLEEEEEEEEZ help

Last edited by bashar beesho 1999; 06-25-2013 at 20:44.
bashar beesho 1999 is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 06-26-2013 , 01:48   Re: Jetpack+Bazooka
Reply With Quote #8

Try:-

PHP Code:
#include <amxmodx>
#include <fun>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

#define PLUGINNAME        "Jetpack+Bazooka"
#define VERSION            "3.2"
#define AUTHOR            "B!gBud"

#define ACCESS_LEVEL    ADMIN_LEVEL_A
#define VOTE_ACCESS    ADMIN_CFG

#define TE_EXPLOSION    3
#define TE_BEAMFOLLOW    22
#define TE_BEAMCYLINDER    21

#define JETPACK_COST 50 // set how may ammopacks the Jatpack+Rocket cost

new ROCKET_MDL[64] = "models/rpgrocket.mdl"
new ROCKET_SOUND[64] = "weapons/rocketfire1.wav"
new getrocket[64] = "items/9mmclip2.wav"

new bool:fly[33] = false
new bool:rocket[33] = false
new bool:rksound[33] = false
new bool:shot[33] = false

new Float:gltime 0.0
new Float:last_Rocket[33] = 0.0
new Float:jp_cal[33] = 0.0
new Float:jp_soun[33] = 0.0
new flameexplosiontrailwhite
new g_flyEnergy[33], hasjet[33]
new 
cvar_jetpackcvar_jetpackSpeedcvar_jetpackUpSpeedcvar_jetpackAcrate ,cvar_RocketDelaycvar_RocketSpeedcvar_fly_max_engerycvar_fly_engerycvar_RocketDmgcvar_Dmg_rangecvar_regain_energyg_item_jetpackcvar_cal_timecvar_oneround

#define MAXSLOTS 32

enum Color{
    
GREEN 1// Yellow
    
YELLOW// Green Color
    
TEAM_COLOR// Red, grey, blue
    
GREY// grey
    
RED// Red
    
BLUE// Blue
}
new 
TeamName[][] = {
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

public 
plugin_init() {
    
register_plugin(PLUGINNAMEVERSIONAUTHOR)
    
    
g_item_jetpack zp_register_extra_item("Jetpack + Bazooka"JETPACK_COSTZP_TEAM_HUMAN)
    
register_clcmd("drop","cmdDrop")
        
    new 
ver[64]
    
format(ver,63,"%s v%s",PLUGINNAME,VERSION)
    
register_cvar("zp_jp_version",ver,FCVAR_SERVER)    
    
    
cvar_jetpack register_cvar("zp_jetpack""2")
    
    
cvar_jetpackSpeed=register_cvar("zp_jp_forward_speed","300.0")
    
cvar_jetpackUpSpeed=register_cvar("zp_jp_up_speed","35.0")
    
cvar_jetpackAcrate=register_cvar("zp_jp_accelerate","100.0")
    
    
cvar_RocketDelay=register_cvar("zp_jp_rocket_delay","12.0")
    
cvar_RocketSpeed=register_cvar("zp_jp_rocket_speed","1500")
    
cvar_RocketDmg=register_cvar("zp_jp_rocket_damage","1500")
    
cvar_Dmg_range=register_cvar("zp_jp_damage_radius","650")    
    
    
cvar_fly_max_engery register_cvar("zp_jp_max_engery""100")
    
cvar_fly_engery register_cvar("zp_jp_engery""10")
    
cvar_regain_energy register_cvar("zp_jp_regain_energy""3")
    
cvar_cal_time register_cvar("zp_jp_energy_cal""1.0")
    
cvar_oneround register_cvar("zp_jp_oneround""0")

    
    
register_event("CurWeapon""check_models""be")
    
register_event("DeathMsg""player_die""a")
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
    
register_forward(FM_StartFrame"fm_startFrame")
    
register_forward(FM_EmitSound"emitsound")
}

public 
plugin_precache() {
    
precache_model("models/p_egon.mdl")
    
precache_model("models/v_egon.mdl")
    
precache_model("models/w_egon.mdl")
    
precache_sound("jetpack.wav")
    
precache_sound("jp_blow.wav")
    
    
precache_model(ROCKET_MDL)
    
precache_sound(ROCKET_SOUND)
    
precache_sound(getrocket)
    
    
explosion precache_model("sprites/zerogxplode.spr")
    
trail precache_model("sprites/smoke.spr")
    
flame precache_model("sprites/xfireball3.spr")
    
white precache_model("sprites/white.spr")
}

public 
client_putinserver(id) {
    
fly[id] = false
    rocket
[id] = false
    hasjet
[id] = 0
    g_flyEnergy
[id] = 0
}

public 
client_disconnect(id) {
    
fly[id] = false
    rocket
[id] = false
    hasjet
[id] = 0
    g_flyEnergy
[id] = 0
}

public 
event_round_start()
{
    
remove_jetpacks();
    if (
get_pcvar_num(cvar_oneround) == 1) {
        for (new 
idid <= 32id++) hasjet[id] = 0g_flyEnergy[id] = 0,    fly[id] = false;
    }
}

public 
fm_startFrame(){
        
    
gltime get_gametime()
    static 
id
    
for (id 1id <= 32id++)
    {
        
jp_forward(id)
    }
    return 
FMRES_IGNORED 
}

public 
jp_forward(player) {
    
    if (!
is_user_connected(player) || !is_user_alive(player) || zp_get_user_zombie(player) || zp_get_user_nemesis(player) || zp_get_user_survivor(player))
        return 
FMRES_IGNORED        
        
    
if (!hasjet[player])
        return 
FMRES_IGNORED
    
    
if(jp_cal[player] < gltime){
        
jp_energy(player); jp_cal[player] = gltime get_pcvar_float(cvar_cal_time)
    }
    
    
check_rocket(player)
    
    new 
clip,ammo
    
new wpnid get_user_weapon(player,clip,ammo)
    if (
wpnid == CSW_KNIFE || wpnid != CSW_KNIFE){
        if(
get_pcvar_num(cvar_jetpack) == 1){
            if(!(
pev(playerpev_flags)&FL_ONGROUND) && pev(player,pev_button)&IN_ATTACK){
                if((
g_flyEnergy[player] > get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[player] <= get_pcvar_num(cvar_fly_max_engery))){
                    if(
jp_soun[player] < gltime){
                        
emit_sound(player,CHAN_ITEM,"jetpack.wav",1.0,ATTN_NORM,1,PITCH_HIGH)
                        
jp_soun[player] = gltime 1.0
                    
}
                }            
                else if((
g_flyEnergy[player] > 0) && (g_flyEnergy[player] < get_pcvar_num(cvar_fly_max_engery)*0.3)){
                    if(
jp_soun[player] < gltime){
                            
emit_sound(player,CHAN_ITEM,"jp_blow.wav",1.0,ATTN_NORM,1,PITCH_HIGH)
                            
jp_soun[player] = gltime 1.0
                    
}
                }
            }
            
human_fly(player)
            
attack(player)    
        }
        if((
pev(player,pev_button)&IN_ATTACK2)){
                
attack2(player)    
            }    
    }
    if((
get_pcvar_num(cvar_jetpack) == && !(pev(playerpev_flags)&FL_ONGROUND)) && (pev(player,pev_button)&IN_JUMP && pev(player,pev_button)&IN_DUCK)){            
        if((
g_flyEnergy[player] > get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[player] <= get_pcvar_num(cvar_fly_max_engery))){
            if(
jp_soun[player] < gltime){
                
emit_sound(player,CHAN_ITEM,"jetpack.wav",1.0,ATTN_NORM,1,PITCH_HIGH)
                
jp_soun[player] = gltime 1.0
            
}
        }                    
        else if((
g_flyEnergy[player] > 0) && (g_flyEnergy[player] < get_pcvar_num(cvar_fly_max_engery)*0.3)){
            if(
jp_soun[player] < gltime){
                
emit_sound(player,CHAN_ITEM,"jp_blow.wav",1.0,ATTN_NORM,1,PITCH_HIGH)
                
jp_soun[player] = gltime 1.0
            
}
        }
        
human_fly(player)
        
attack(player)
    }    
    
    return 
FMRES_IGNORED
}

public 
jp_energy(player) {
            
        if (!(
pev(playerpev_flags)&FL_ONGROUND) && pev(player,pev_button)&IN_ATTACK)    
        {
            
// Get our current velocity        
            
new clip,ammo
            
new wpnid get_user_weapon(player,clip,ammo)
            if (
wpnid == CSW_KNIFE
            {
            
// flying
            
if(g_flyEnergy[player] > get_pcvar_num(cvar_fly_max_engery)*0.09)
                
g_flyEnergy[player] = g_flyEnergy[player] - get_pcvar_num(cvar_fly_engery);     // Increase distance counter        
            
}
        }
        else if ((
get_pcvar_num(cvar_jetpack) == && !(pev(playerpev_flags)&FL_ONGROUND)) && (pev(player,pev_button)&IN_JUMP && pev(player,pev_button)&IN_DUCK))
        {
            if(
g_flyEnergy[player] > get_pcvar_num(cvar_fly_max_engery)*0.09)
                
g_flyEnergy[player] = g_flyEnergy[player] - get_pcvar_num(cvar_fly_engery);     // Increase distance counter    
        
}
        
// Walking/Runnig
        
if (pev(playerpev_flags) & FL_ONGROUND)    
            
g_flyEnergy[player] = g_flyEnergy[player] + get_pcvar_num(cvar_regain_energy);// Decrease distance counter
}

public 
attack(player) {
//code snippa from TS_Jetpack 1.0 - Jetpack plugin for The Specialists.
//http://forums.alliedmods.net/showthread.php?t=55709&highlight=jetpack
//By: Bad_Bud
    
if(fly[player])
    {    
        static 
Float:JetpackData[3]
        
pev(player,pev_velocity,JetpackData)
                    
        new 
fOrigin[3],Float:Aim[3]
        
VelocityByAim(player10Aim)
        
get_user_origin(player,fOrigin)
        
fOrigin[0] -= floatround(Aim[0])
        
fOrigin[1] -= floatround(Aim[1])
        
fOrigin[2] -= floatround(Aim[2])
        
        
        if((
pev(player,pev_button)&IN_FORWARD) && !(pev(playerpev_flags) & FL_ONGROUND))
            {
                
                
message_begin(MSG_ALL,SVC_TEMPENTITY)
                
write_byte(17
                
write_coord(fOrigin[0])
                
write_coord(fOrigin[1])
                
write_coord(fOrigin[2])
                
write_short(flame)
                
write_byte(8)
                
write_byte(70)
                
message_end()    
                
                static 
Float:Speed
                Speed
=floatsqroot(JetpackData[0]*JetpackData[0]+JetpackData[1]*JetpackData[1])
                    
                if(
Speed!=10.0)//Makes players only lay down if their speed isn't 0; if they are thrusting forward.
                
{
                    
set_pev(player,pev_gaitsequence,1)
                    
set_pev(player,pev_sequence,111)
                }
                    
                if(
Speed<get_pcvar_float(cvar_jetpackSpeed))
                    
Speed+=get_pcvar_float(cvar_jetpackAcrate)
                        
                static 
Float:JetpackData2[3]
                
pev(player,pev_angles,JetpackData2)
                
JetpackData2[2]=0.0//Remove the Z value/
                    
                
angle_vector(JetpackData2,ANGLEVECTOR_FORWARD,JetpackData2)
                
JetpackData2[0]*=Speed
                JetpackData2
[1]*=Speed
                    
                JetpackData
[0]=JetpackData2[0]
                
JetpackData[1]=JetpackData2[1]
            }
            
        if(
JetpackData[2]<get_pcvar_float(cvar_jetpackSpeed)&&JetpackData[2]>0.0)//Jetpacks get more power on the way down -- it helps landing.
                
JetpackData[2]+=get_pcvar_float(cvar_jetpackUpSpeed)
            else if(
JetpackData[2]<0.0)
                
JetpackData[2]+=(get_pcvar_float(cvar_jetpackUpSpeed)*1.15)
                    
        
set_pev(player,pev_velocity,JetpackData)
    }
}

public 
attack2(player) {
        
    if (
rocket[player])
    {
        
        new 
rocket create_entity("info_target")
        if(
rocket == 0) return PLUGIN_CONTINUE
        
        entity_set_string
(rocketEV_SZ_classname"zp_jp_rocket")
        
entity_set_model(rocketROCKET_MDL)
        
        
entity_set_size(rocketFloat:{0.00.00.0}, Float:{0.00.00.0})
        
entity_set_int(rocketEV_INT_movetypeMOVETYPE_FLY)
        
entity_set_int(rocketEV_INT_solidSOLID_BBOX)
        
        new 
Float:vSrc[3]
        
entity_get_vector(playerEV_VEC_originvSrc)
        
        new 
Float:Aim[3],Float:origin[3]
        
VelocityByAim(player64Aim)
        
entity_get_vector(player,EV_VEC_origin,origin)
        
        
vSrc[0] += Aim[0]
        
vSrc[1] += Aim[1]
        
entity_set_origin(rocketvSrc)
        
        new 
Float:velocity[3], Float:angles[3]
        
VelocityByAim(playerget_pcvar_num(cvar_RocketSpeed), velocity)
        
        
entity_set_vector(rocketEV_VEC_velocityvelocity)
        
vector_to_angle(velocityangles)
        
entity_set_vector(rocketEV_VEC_anglesangles)
        
entity_set_edict(rocket,EV_ENT_owner,player)
        
entity_set_float(rocketEV_FL_takedamage1.0)
        
        
set_pev(rocketpev_effectsEF_LIGHT)
        
set_pev(rocketpev_effectsEF_BRIGHTLIGHT)

                
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_BEAMFOLLOW)
        
write_short(rocket)
        
write_short(trail)
                
write_byte(20)
        
write_byte(25)
        
write_byte(224)
        
write_byte(224)
        
write_byte(255)
        
write_byte(255)
        
message_end()

        
emit_sound(rocketCHAN_WEAPONROCKET_SOUND1.0ATTN_NORM0PITCH_NORM)
        
        
shot[player] = true
        last_Rocket
[player] = gltime get_pcvar_num(cvar_RocketDelay)
    }
    return 
PLUGIN_CONTINUE
}

public 
check_models(id) {

    if (
zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_survivor(id))
        return 
FMRES_IGNORED
    
    
if(hasjet[id]) {
        new 
clip,ammo
        
new wpnid get_user_weapon(id,clip,ammo)
        
        if ( 
wpnid == CSW_KNIFE ) {
            
switchmodel(id)
        }
        return 
PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}

public 
switchmodel(id) {
    
entity_set_string(id,EV_SZ_viewmodel,"models/v_egon.mdl")
    
entity_set_string(id,EV_SZ_weaponmodel,"models/p_egon.mdl")
}

public 
remove_jetpacks() {
    new 
nextitem  find_ent_by_class(-1,"zp_jp_jetpack")
    while(
nextitem) {
        
remove_entity(nextitem)
        
nextitem find_ent_by_class(-1,"zp_jp_jetpack")
    }
    return 
PLUGIN_CONTINUE
}

public 
emitsound(entitychannel, const sample[]) {
    if(
is_user_alive(entity)) {
        new 
clip,ammo
        
new weapon get_user_weapon(entity,clip,ammo)
        
        if(
hasjet[entity] && weapon == CSW_KNIFE) {
            if(
equal(sample,"weapons/knife_slash1.wav")) return FMRES_SUPERCEDE
            
if(equal(sample,"weapons/knife_slash2.wav")) return FMRES_SUPERCEDE
            
            
if(equal(sample,"weapons/knife_deploy1.wav")) return FMRES_SUPERCEDE
            
if(equal(sample,"weapons/knife_hitwall1.wav")) return FMRES_SUPERCEDE
            
            
if(equal(sample,"weapons/knife_hit1.wav")) return FMRES_SUPERCEDE
            
if(equal(sample,"weapons/knife_hit2.wav")) return FMRES_SUPERCEDE
            
if(equal(sample,"weapons/knife_hit3.wav")) return FMRES_SUPERCEDE
            
if(equal(sample,"weapons/knife_hit4.wav")) return FMRES_SUPERCEDE
            
            
if(equal(sample,"weapons/knife_stab.wav")) return FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
}

public 
human_fly(player) {
    
    if (
g_flyEnergy[player] <= get_pcvar_num(cvar_fly_max_engery)*0.1)
    {
        
jp_off(player);    
    }
    if (
g_flyEnergy[player] > get_pcvar_num(cvar_fly_max_engery)*0.1)
    {
        
jp_on(player);
    }
}

public 
jp_on(player) {

    
fly[player] = true
    
}

public 
jp_off(player) {

    
fly[player] = false
    
}

public 
check_rocket(player) {
        
    if (
last_Rocket[player] > gltime)
    {    
        
rk_forbidden(player)
        
rksound[player] = true
    
}
    else
    {    

        if (
shot[player])
        {
            
rksound[player] = false
            shot
[player] = false
        
}
        
rk_sound(player)
        
rk_allow(player)
    }
    
}

public 
rk_allow(player) {
        
    
rocket[player] = true
}

public 
rk_forbidden(player) {

    
rocket[player] = false
    
}

public 
rk_sound(player) {

    if (!
rksound[player])
    {
        
engfunc(EngFunc_EmitSoundplayerCHAN_WEAPONgetrocket1.0ATTN_NORM0PITCH_NORM)
        
client_print(playerprint_center"** Reloaded & Ready **")
        
rksound[player] = true
    
}
    else if (
rksound[player])
    {
        
    }
    
}

public 
player_die() {
    
    new 
id read_data(2)
    if(
hasjet[id]) {
        
drop_jetpack(id)
        
hasjet[id] = 0
        rocket
[id] = false
        g_flyEnergy
[id] = 0
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
cmdDrop(id) {

    if(
hasjet[id]) {
        new 
clip,ammo
        
new weapon get_user_weapon(id,clip,ammo)
        if(
weapon == CSW_KNIFE) {
            
drop_jetpack(id)
            if(!
zp_get_user_zombie(id)){
                
entity_set_string(id,EV_SZ_viewmodel,"models/v_knife.mdl")
                
entity_set_string(id,EV_SZ_weaponmodel,"models/p_knife.mdl")
                }
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}

public 
drop_jetpack(player) {
    if(
hasjet[player]) {
        new 
Float:Aim[3],Float:origin[3]
        
VelocityByAim(player64Aim)
        
entity_get_vector(player,EV_VEC_origin,origin)
        
        
origin[0] += Aim[0]
        
origin[1] += Aim[1]
        
        new 
jetpack create_entity("info_target")
        
entity_set_string(jetpack,EV_SZ_classname,"zp_jp_jetpack")
        
entity_set_model(jetpack,"models/p_egon.mdl")    
        
        
entity_set_size(jetpack,Float:{-16.0,-16.0,-16.0},Float:{16.0,16.0,16.0})
        
entity_set_int(jetpack,EV_INT_solid,1)
        
        
entity_set_int(jetpack,EV_INT_movetype,6)
        
        
entity_set_vector(jetpack,EV_VEC_origin,origin)        
        
        
hasjet[player] = 0
        rocket
[player] = false
    
}    
}

public 
pfn_touch(ptrptd) {
    if(
is_valid_ent(ptr)) {
        new 
classname[32]
        
entity_get_string(ptr,EV_SZ_classname,classname,31)
        
        if(
equal(classname"zp_jp_jetpack")) {
            if(
is_valid_ent(ptd)) {
                new 
id ptd
                
if(id && id 34) {
                    if(!
hasjet[id] && !zp_get_user_zombie(id) && is_user_alive(id)) {
                        
                        
hasjet[id] = 1
                        g_flyEnergy
[id] = get_pcvar_num(cvar_fly_max_engery)
                        
rocket[id] = true
                        client_cmd
(id,"spk items/gunpickup2.wav")
                        
engclient_cmd(id,"weapon_knife")
                        
switchmodel(id)
                        
remove_entity(ptr)
                    }
                }
            }
        }else if(
equal(classname"zp_jp_rocket")) {
            new 
Float:fOrigin[3]
            new 
iOrigin[3]
            
entity_get_vector(ptrEV_VEC_originfOrigin)
            
FVecIVec(fOrigin,iOrigin)
            
jp_radius_damage(ptr)
                
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_EXPLOSION)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_short(explosion)
            
write_byte(55)
            
write_byte(15)
            
write_byte(0)
            
message_end()

                        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_EXPLOSION)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_short(explosion)
            
write_byte(65)
            
write_byte(15)
            
write_byte(0)
            
message_end()

                        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_EXPLOSION)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_short(explosion)
            
write_byte(85)
            
write_byte(15)
            
write_byte(0)
            
message_end()
                
            
message_begin(MSG_ALL,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_BEAMCYLINDER)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2]+350)
            
write_short(white)
            
write_byte(0)
            
write_byte(1)
            
write_byte(6)
            
write_byte(100)
            
write_byte(1)
            
write_byte(255)
            
write_byte(255)
            
write_byte(255)
            
write_byte(200)
            
write_byte(0)
            
message_end()

                        
message_begin(MSG_ALL,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_BEAMCYLINDER)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2]+450)
            
write_short(white)
            
write_byte(0)
            
write_byte(1)
            
write_byte(6)
            
write_byte(100)
            
write_byte(1)
            
write_byte(255)
            
write_byte(255)
            
write_byte(255)
            
write_byte(200)
            
write_byte(0)
            
message_end()

                        
message_begin(MSG_ALL,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_BEAMCYLINDER)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2]+650)
            
write_short(white)
            
write_byte(0)
            
write_byte(1)
            
write_byte(6)
            
write_byte(100)
            
write_byte(1)
            
write_byte(255)
            
write_byte(255)
            
write_byte(255)
            
write_byte(200)
            
write_byte(0)
            
message_end()
            
            if(
is_valid_ent(ptd)) {
                new 
classname2[32]
                
entity_get_string(ptd,EV_SZ_classname,classname2,31)
                
                if(
equal(classname2,"func_breakable"))
                    
force_use(ptr,ptd)
            }
            
            
remove_entity(ptr)
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
zp_user_infected_pre(playerinfector){
    
    
cmdDrop(player);
    
hasjet[player] = 0;
    
g_flyEnergy[player] = 0;
    
rocket[player] = false;
}

public 
zp_extra_item_selected(playeritemid){
    

    new 
clip,ammo
    
new weapon get_user_weapon(player,clip,ammo)
        
    if (
itemid == g_item_jetpack)
    {
        
client_print(playerprint_chat"[ZP] Press SPACE+CTRL to fly!")
        
hasjet[player] = 1
        g_flyEnergy
[player] = get_pcvar_num(cvar_fly_max_engery)
        
rocket[player] = true
        client_cmd
(player,"spk items/gunpickup2.wav")
        if(
weapon == CSW_KNIFE){
            
switchmodel(player)
        }
        else
        {
            
engclient_cmd(player,"weapon_knife"),switchmodel(player)
        }
    }
}

stock jp_radius_damage(entity) {
    new 
id entity_get_edict(entity,EV_ENT_owner)
    new 
packs,name[32];
    for(new 
133i++) {
        if(
is_user_alive(i)) {
            new 
dist floatround(entity_range(entity,i))
            
            if(
dist <= get_pcvar_num(cvar_Dmg_range)) {
                new 
hp get_user_health(i)
                new 
Float:damage get_pcvar_float(cvar_RocketDmg)-(get_pcvar_float(cvar_RocketDmg)/get_pcvar_float(cvar_Dmg_range))*float(dist)
                
                new 
Origin[3]
                
get_user_origin(i,Origin)
                
                if(
zp_get_user_zombie(id) != zp_get_user_zombie(i)) {
                        
get_user_name(i,name,31);
                        if(
damage>=800)
                            
packs 2;
                        else
                            
packs 1;
                            
                        if(
hp damage)
                        {
                            
                            
zp_set_user_ammo_packs idzp_get_user_ammo_packs id ) + packs );
                            
jp_take_damage(i,floatround(damage),Origin,DMG_BLAST)
                            
ColorChat(id,RED,"^x04[Zp]^x03 Damage to ^x04%s^x03 :: ^x04%i^x03 Damage !!"namefloatround(damage));

                        }
                        else
                        {
                            
log_kill(id,i,"Jetpack Rocket",0)
                            
//zp_set_user_ammo_packs ( id, zp_get_user_ammo_packs ( id ) + 5 );
                            
ColorChat(id,RED,"^x04[Zp]^x03 You killed ^x03 %s^x01 with Bazooka "name);
                        }
                    }
            }
        }
    }
}

stock log_kill(killervictimweapon[], headshot)
{
// code from MeRcyLeZZ
    
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
    
ExecuteHamB(Ham_Killedvictimkiller2// set last param to 2 if you want victim to gib
    
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)

    
    
message_begin(MSG_BROADCASTget_user_msgid("DeathMsg"))
    
write_byte(killer)
    
write_byte(victim)
    
write_byte(headshot)
    
write_string(weapon)
    
message_end()
//
    
    
if(get_user_team(killer)!=get_user_team(victim))
        
set_user_frags(killer,get_user_frags(killer) +1)
    if(
get_user_team(killer)==get_user_team(victim))
        
set_user_frags(killer,get_user_frags(killer) -1)
        
    new 
kname[32], vname[32], kauthid[32], vauthid[32], kteam[10], vteam[10]

    
get_user_name(killerkname31)
    
get_user_team(killerkteam9)
    
get_user_authid(killerkauthid31)
 
    
get_user_name(victimvname31)
    
get_user_team(victimvteam9)
    
get_user_authid(victimvauthid31)
        
    
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^""
    
knameget_user_userid(killer), kauthidkteam
     
vnameget_user_userid(victim), vauthidvteamweapon)

     return 
PLUGIN_CONTINUE;
}

stock jp_take_damage(victim,damage,origin[3],bit) {
    
message_begin(MSG_ONE,get_user_msgid("Damage"),{0,0,0},victim)
    
write_byte(21)
    
write_byte(20)
    
write_long(bit)
    
write_coord(origin[0])
    
write_coord(origin[1])
    
write_coord(origin[2])
    
message_end()
    
    
set_user_health(victim,get_user_health(victim)-damage)
}
public 
ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...)
{
    static 
message[256];

    switch(
type)
    {
        case 
YELLOW:{ // Yellow
        
            
message[0] = 0x01;
        }
        case 
GREEN:{// Green

            
message[0] = 0x04;
        }
        default:{ 
// White, Red, Blue
            
message[0] = 0x03;
        }
    }
    
vformat(message[1], 251msg4);

    
// Make sure message is not longer than 192 character. Will crash the server.
    
message[192] = '^0';
    new 
teamColorChangeindexMSG_Type;
    if(!
id)    {
        
index FindPlayer();
        
MSG_Type MSG_ALL;
    } else {
        
MSG_Type MSG_ONE;
        
index id;
    }
    
team get_user_team(index);    
    
ColorChange ColorSelection(indexMSG_Typetype);
    
ShowColorMessage(indexMSG_Typemessage);
    if(
ColorChange){
        
Team_Info(indexMSG_TypeTeamName[team]);
    }
}

ShowColorMessage(idtypemessage[]){
    
message_begin(type76_id);
    
write_byte(id)        
    
write_string(message);
    
message_end();    
}

Team_Info(idtypeteam[]){
    
message_begin(type86_id);
    
write_byte(id);
    
write_string(team);
    
message_end();
    return 
1;
}

ColorSelection(indextypeColor:Type){
    switch(
Type)    {
        case 
RED:        {
            return 
Team_Info(indextypeTeamName[1]);
        }
        case 
BLUE:        {
            return 
Team_Info(indextypeTeamName[2]);
        }
        case 
GREY:        {
            return 
Team_Info(indextypeTeamName[0]);
        }
    }
    return 
0;
}

FindPlayer(){
    new 
= -1;
    while(
<= MAXSLOTS){
        if(
is_user_connected(++i)){
            return 
i;
        }
    }

    return -
1;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
__________________
You will find everything u need :-
Catastrophe is offline
bashar beesho 1999
Junior Member
Join Date: Jun 2013
Old 06-26-2013 , 14:40   Re: Jetpack+Bazooka
Reply With Quote #9

Quote:
Originally Posted by Catastrophe View Post
Try:-

PHP Code:
#include <amxmodx>
#include <fun>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

#define PLUGINNAME        "Jetpack+Bazooka"
#define VERSION            "3.2"
#define AUTHOR            "B!gBud"

#define ACCESS_LEVEL    ADMIN_LEVEL_A
#define VOTE_ACCESS    ADMIN_CFG

#define TE_EXPLOSION    3
#define TE_BEAMFOLLOW    22
#define TE_BEAMCYLINDER    21

#define JETPACK_COST 50 // set how may ammopacks the Jatpack+Rocket cost

new ROCKET_MDL[64] = "models/rpgrocket.mdl"
new ROCKET_SOUND[64] = "weapons/rocketfire1.wav"
new getrocket[64] = "items/9mmclip2.wav"

new bool:fly[33] = false
new bool:rocket[33] = false
new bool:rksound[33] = false
new bool:shot[33] = false

new Float:gltime 0.0
new Float:last_Rocket[33] = 0.0
new Float:jp_cal[33] = 0.0
new Float:jp_soun[33] = 0.0
new flameexplosiontrailwhite
new g_flyEnergy[33], hasjet[33]
new 
cvar_jetpackcvar_jetpackSpeedcvar_jetpackUpSpeedcvar_jetpackAcrate ,cvar_RocketDelaycvar_RocketSpeedcvar_fly_max_engerycvar_fly_engerycvar_RocketDmgcvar_Dmg_rangecvar_regain_energyg_item_jetpackcvar_cal_timecvar_oneround

#define MAXSLOTS 32

enum Color{
    
GREEN 1// Yellow
    
YELLOW// Green Color
    
TEAM_COLOR// Red, grey, blue
    
GREY// grey
    
RED// Red
    
BLUE// Blue
}
new 
TeamName[][] = {
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

public 
plugin_init() {
    
register_plugin(PLUGINNAMEVERSIONAUTHOR)
    
    
g_item_jetpack zp_register_extra_item("Jetpack + Bazooka"JETPACK_COSTZP_TEAM_HUMAN)
    
register_clcmd("drop","cmdDrop")
        
    new 
ver[64]
    
format(ver,63,"%s v%s",PLUGINNAME,VERSION)
    
register_cvar("zp_jp_version",ver,FCVAR_SERVER)    
    
    
cvar_jetpack register_cvar("zp_jetpack""2")
    
    
cvar_jetpackSpeed=register_cvar("zp_jp_forward_speed","300.0")
    
cvar_jetpackUpSpeed=register_cvar("zp_jp_up_speed","35.0")
    
cvar_jetpackAcrate=register_cvar("zp_jp_accelerate","100.0")
    
    
cvar_RocketDelay=register_cvar("zp_jp_rocket_delay","12.0")
    
cvar_RocketSpeed=register_cvar("zp_jp_rocket_speed","1500")
    
cvar_RocketDmg=register_cvar("zp_jp_rocket_damage","1500")
    
cvar_Dmg_range=register_cvar("zp_jp_damage_radius","650")    
    
    
cvar_fly_max_engery register_cvar("zp_jp_max_engery""100")
    
cvar_fly_engery register_cvar("zp_jp_engery""10")
    
cvar_regain_energy register_cvar("zp_jp_regain_energy""3")
    
cvar_cal_time register_cvar("zp_jp_energy_cal""1.0")
    
cvar_oneround register_cvar("zp_jp_oneround""0")

    
    
register_event("CurWeapon""check_models""be")
    
register_event("DeathMsg""player_die""a")
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
    
register_forward(FM_StartFrame"fm_startFrame")
    
register_forward(FM_EmitSound"emitsound")
}

public 
plugin_precache() {
    
precache_model("models/p_egon.mdl")
    
precache_model("models/v_egon.mdl")
    
precache_model("models/w_egon.mdl")
    
precache_sound("jetpack.wav")
    
precache_sound("jp_blow.wav")
    
    
precache_model(ROCKET_MDL)
    
precache_sound(ROCKET_SOUND)
    
precache_sound(getrocket)
    
    
explosion precache_model("sprites/zerogxplode.spr")
    
trail precache_model("sprites/smoke.spr")
    
flame precache_model("sprites/xfireball3.spr")
    
white precache_model("sprites/white.spr")
}

public 
client_putinserver(id) {
    
fly[id] = false
    rocket
[id] = false
    hasjet
[id] = 0
    g_flyEnergy
[id] = 0
}

public 
client_disconnect(id) {
    
fly[id] = false
    rocket
[id] = false
    hasjet
[id] = 0
    g_flyEnergy
[id] = 0
}

public 
event_round_start()
{
    
remove_jetpacks();
    if (
get_pcvar_num(cvar_oneround) == 1) {
        for (new 
idid <= 32id++) hasjet[id] = 0g_flyEnergy[id] = 0,    fly[id] = false;
    }
}

public 
fm_startFrame(){
        
    
gltime get_gametime()
    static 
id
    
for (id 1id <= 32id++)
    {
        
jp_forward(id)
    }
    return 
FMRES_IGNORED 
}

public 
jp_forward(player) {
    
    if (!
is_user_connected(player) || !is_user_alive(player) || zp_get_user_zombie(player) || zp_get_user_nemesis(player) || zp_get_user_survivor(player))
        return 
FMRES_IGNORED        
        
    
if (!hasjet[player])
        return 
FMRES_IGNORED
    
    
if(jp_cal[player] < gltime){
        
jp_energy(player); jp_cal[player] = gltime get_pcvar_float(cvar_cal_time)
    }
    
    
check_rocket(player)
    
    new 
clip,ammo
    
new wpnid get_user_weapon(player,clip,ammo)
    if (
wpnid == CSW_KNIFE || wpnid != CSW_KNIFE){
        if(
get_pcvar_num(cvar_jetpack) == 1){
            if(!(
pev(playerpev_flags)&FL_ONGROUND) && pev(player,pev_button)&IN_ATTACK){
                if((
g_flyEnergy[player] > get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[player] <= get_pcvar_num(cvar_fly_max_engery))){
                    if(
jp_soun[player] < gltime){
                        
emit_sound(player,CHAN_ITEM,"jetpack.wav",1.0,ATTN_NORM,1,PITCH_HIGH)
                        
jp_soun[player] = gltime 1.0
                    
}
                }            
                else if((
g_flyEnergy[player] > 0) && (g_flyEnergy[player] < get_pcvar_num(cvar_fly_max_engery)*0.3)){
                    if(
jp_soun[player] < gltime){
                            
emit_sound(player,CHAN_ITEM,"jp_blow.wav",1.0,ATTN_NORM,1,PITCH_HIGH)
                            
jp_soun[player] = gltime 1.0
                    
}
                }
            }
            
human_fly(player)
            
attack(player)    
        }
        if((
pev(player,pev_button)&IN_ATTACK2)){
                
attack2(player)    
            }    
    }
    if((
get_pcvar_num(cvar_jetpack) == && !(pev(playerpev_flags)&FL_ONGROUND)) && (pev(player,pev_button)&IN_JUMP && pev(player,pev_button)&IN_DUCK)){            
        if((
g_flyEnergy[player] > get_pcvar_num(cvar_fly_max_engery)*0.3) && (g_flyEnergy[player] <= get_pcvar_num(cvar_fly_max_engery))){
            if(
jp_soun[player] < gltime){
                
emit_sound(player,CHAN_ITEM,"jetpack.wav",1.0,ATTN_NORM,1,PITCH_HIGH)
                
jp_soun[player] = gltime 1.0
            
}
        }                    
        else if((
g_flyEnergy[player] > 0) && (g_flyEnergy[player] < get_pcvar_num(cvar_fly_max_engery)*0.3)){
            if(
jp_soun[player] < gltime){
                
emit_sound(player,CHAN_ITEM,"jp_blow.wav",1.0,ATTN_NORM,1,PITCH_HIGH)
                
jp_soun[player] = gltime 1.0
            
}
        }
        
human_fly(player)
        
attack(player)
    }    
    
    return 
FMRES_IGNORED
}

public 
jp_energy(player) {
            
        if (!(
pev(playerpev_flags)&FL_ONGROUND) && pev(player,pev_button)&IN_ATTACK)    
        {
            
// Get our current velocity        
            
new clip,ammo
            
new wpnid get_user_weapon(player,clip,ammo)
            if (
wpnid == CSW_KNIFE
            {
            
// flying
            
if(g_flyEnergy[player] > get_pcvar_num(cvar_fly_max_engery)*0.09)
                
g_flyEnergy[player] = g_flyEnergy[player] - get_pcvar_num(cvar_fly_engery);     // Increase distance counter        
            
}
        }
        else if ((
get_pcvar_num(cvar_jetpack) == && !(pev(playerpev_flags)&FL_ONGROUND)) && (pev(player,pev_button)&IN_JUMP && pev(player,pev_button)&IN_DUCK))
        {
            if(
g_flyEnergy[player] > get_pcvar_num(cvar_fly_max_engery)*0.09)
                
g_flyEnergy[player] = g_flyEnergy[player] - get_pcvar_num(cvar_fly_engery);     // Increase distance counter    
        
}
        
// Walking/Runnig
        
if (pev(playerpev_flags) & FL_ONGROUND)    
            
g_flyEnergy[player] = g_flyEnergy[player] + get_pcvar_num(cvar_regain_energy);// Decrease distance counter
}

public 
attack(player) {
//code snippa from TS_Jetpack 1.0 - Jetpack plugin for The Specialists.
//http://forums.alliedmods.net/showthread.php?t=55709&highlight=jetpack
//By: Bad_Bud
    
if(fly[player])
    {    
        static 
Float:JetpackData[3]
        
pev(player,pev_velocity,JetpackData)
                    
        new 
fOrigin[3],Float:Aim[3]
        
VelocityByAim(player10Aim)
        
get_user_origin(player,fOrigin)
        
fOrigin[0] -= floatround(Aim[0])
        
fOrigin[1] -= floatround(Aim[1])
        
fOrigin[2] -= floatround(Aim[2])
        
        
        if((
pev(player,pev_button)&IN_FORWARD) && !(pev(playerpev_flags) & FL_ONGROUND))
            {
                
                
message_begin(MSG_ALL,SVC_TEMPENTITY)
                
write_byte(17
                
write_coord(fOrigin[0])
                
write_coord(fOrigin[1])
                
write_coord(fOrigin[2])
                
write_short(flame)
                
write_byte(8)
                
write_byte(70)
                
message_end()    
                
                static 
Float:Speed
                Speed
=floatsqroot(JetpackData[0]*JetpackData[0]+JetpackData[1]*JetpackData[1])
                    
                if(
Speed!=10.0)//Makes players only lay down if their speed isn't 0; if they are thrusting forward.
                
{
                    
set_pev(player,pev_gaitsequence,1)
                    
set_pev(player,pev_sequence,111)
                }
                    
                if(
Speed<get_pcvar_float(cvar_jetpackSpeed))
                    
Speed+=get_pcvar_float(cvar_jetpackAcrate)
                        
                static 
Float:JetpackData2[3]
                
pev(player,pev_angles,JetpackData2)
                
JetpackData2[2]=0.0//Remove the Z value/
                    
                
angle_vector(JetpackData2,ANGLEVECTOR_FORWARD,JetpackData2)
                
JetpackData2[0]*=Speed
                JetpackData2
[1]*=Speed
                    
                JetpackData
[0]=JetpackData2[0]
                
JetpackData[1]=JetpackData2[1]
            }
            
        if(
JetpackData[2]<get_pcvar_float(cvar_jetpackSpeed)&&JetpackData[2]>0.0)//Jetpacks get more power on the way down -- it helps landing.
                
JetpackData[2]+=get_pcvar_float(cvar_jetpackUpSpeed)
            else if(
JetpackData[2]<0.0)
                
JetpackData[2]+=(get_pcvar_float(cvar_jetpackUpSpeed)*1.15)
                    
        
set_pev(player,pev_velocity,JetpackData)
    }
}

public 
attack2(player) {
        
    if (
rocket[player])
    {
        
        new 
rocket create_entity("info_target")
        if(
rocket == 0) return PLUGIN_CONTINUE
        
        entity_set_string
(rocketEV_SZ_classname"zp_jp_rocket")
        
entity_set_model(rocketROCKET_MDL)
        
        
entity_set_size(rocketFloat:{0.00.00.0}, Float:{0.00.00.0})
        
entity_set_int(rocketEV_INT_movetypeMOVETYPE_FLY)
        
entity_set_int(rocketEV_INT_solidSOLID_BBOX)
        
        new 
Float:vSrc[3]
        
entity_get_vector(playerEV_VEC_originvSrc)
        
        new 
Float:Aim[3],Float:origin[3]
        
VelocityByAim(player64Aim)
        
entity_get_vector(player,EV_VEC_origin,origin)
        
        
vSrc[0] += Aim[0]
        
vSrc[1] += Aim[1]
        
entity_set_origin(rocketvSrc)
        
        new 
Float:velocity[3], Float:angles[3]
        
VelocityByAim(playerget_pcvar_num(cvar_RocketSpeed), velocity)
        
        
entity_set_vector(rocketEV_VEC_velocityvelocity)
        
vector_to_angle(velocityangles)
        
entity_set_vector(rocketEV_VEC_anglesangles)
        
entity_set_edict(rocket,EV_ENT_owner,player)
        
entity_set_float(rocketEV_FL_takedamage1.0)
        
        
set_pev(rocketpev_effectsEF_LIGHT)
        
set_pev(rocketpev_effectsEF_BRIGHTLIGHT)

                
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_BEAMFOLLOW)
        
write_short(rocket)
        
write_short(trail)
                
write_byte(20)
        
write_byte(25)
        
write_byte(224)
        
write_byte(224)
        
write_byte(255)
        
write_byte(255)
        
message_end()

        
emit_sound(rocketCHAN_WEAPONROCKET_SOUND1.0ATTN_NORM0PITCH_NORM)
        
        
shot[player] = true
        last_Rocket
[player] = gltime get_pcvar_num(cvar_RocketDelay)
    }
    return 
PLUGIN_CONTINUE
}

public 
check_models(id) {

    if (
zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_survivor(id))
        return 
FMRES_IGNORED
    
    
if(hasjet[id]) {
        new 
clip,ammo
        
new wpnid get_user_weapon(id,clip,ammo)
        
        if ( 
wpnid == CSW_KNIFE ) {
            
switchmodel(id)
        }
        return 
PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}

public 
switchmodel(id) {
    
entity_set_string(id,EV_SZ_viewmodel,"models/v_egon.mdl")
    
entity_set_string(id,EV_SZ_weaponmodel,"models/p_egon.mdl")
}

public 
remove_jetpacks() {
    new 
nextitem  find_ent_by_class(-1,"zp_jp_jetpack")
    while(
nextitem) {
        
remove_entity(nextitem)
        
nextitem find_ent_by_class(-1,"zp_jp_jetpack")
    }
    return 
PLUGIN_CONTINUE
}

public 
emitsound(entitychannel, const sample[]) {
    if(
is_user_alive(entity)) {
        new 
clip,ammo
        
new weapon get_user_weapon(entity,clip,ammo)
        
        if(
hasjet[entity] && weapon == CSW_KNIFE) {
            if(
equal(sample,"weapons/knife_slash1.wav")) return FMRES_SUPERCEDE
            
if(equal(sample,"weapons/knife_slash2.wav")) return FMRES_SUPERCEDE
            
            
if(equal(sample,"weapons/knife_deploy1.wav")) return FMRES_SUPERCEDE
            
if(equal(sample,"weapons/knife_hitwall1.wav")) return FMRES_SUPERCEDE
            
            
if(equal(sample,"weapons/knife_hit1.wav")) return FMRES_SUPERCEDE
            
if(equal(sample,"weapons/knife_hit2.wav")) return FMRES_SUPERCEDE
            
if(equal(sample,"weapons/knife_hit3.wav")) return FMRES_SUPERCEDE
            
if(equal(sample,"weapons/knife_hit4.wav")) return FMRES_SUPERCEDE
            
            
if(equal(sample,"weapons/knife_stab.wav")) return FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
}

public 
human_fly(player) {
    
    if (
g_flyEnergy[player] <= get_pcvar_num(cvar_fly_max_engery)*0.1)
    {
        
jp_off(player);    
    }
    if (
g_flyEnergy[player] > get_pcvar_num(cvar_fly_max_engery)*0.1)
    {
        
jp_on(player);
    }
}

public 
jp_on(player) {

    
fly[player] = true
    
}

public 
jp_off(player) {

    
fly[player] = false
    
}

public 
check_rocket(player) {
        
    if (
last_Rocket[player] > gltime)
    {    
        
rk_forbidden(player)
        
rksound[player] = true
    
}
    else
    {    

        if (
shot[player])
        {
            
rksound[player] = false
            shot
[player] = false
        
}
        
rk_sound(player)
        
rk_allow(player)
    }
    
}

public 
rk_allow(player) {
        
    
rocket[player] = true
}

public 
rk_forbidden(player) {

    
rocket[player] = false
    
}

public 
rk_sound(player) {

    if (!
rksound[player])
    {
        
engfunc(EngFunc_EmitSoundplayerCHAN_WEAPONgetrocket1.0ATTN_NORM0PITCH_NORM)
        
client_print(playerprint_center"** Reloaded & Ready **")
        
rksound[player] = true
    
}
    else if (
rksound[player])
    {
        
    }
    
}

public 
player_die() {
    
    new 
id read_data(2)
    if(
hasjet[id]) {
        
drop_jetpack(id)
        
hasjet[id] = 0
        rocket
[id] = false
        g_flyEnergy
[id] = 0
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
cmdDrop(id) {

    if(
hasjet[id]) {
        new 
clip,ammo
        
new weapon get_user_weapon(id,clip,ammo)
        if(
weapon == CSW_KNIFE) {
            
drop_jetpack(id)
            if(!
zp_get_user_zombie(id)){
                
entity_set_string(id,EV_SZ_viewmodel,"models/v_knife.mdl")
                
entity_set_string(id,EV_SZ_weaponmodel,"models/p_knife.mdl")
                }
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}

public 
drop_jetpack(player) {
    if(
hasjet[player]) {
        new 
Float:Aim[3],Float:origin[3]
        
VelocityByAim(player64Aim)
        
entity_get_vector(player,EV_VEC_origin,origin)
        
        
origin[0] += Aim[0]
        
origin[1] += Aim[1]
        
        new 
jetpack create_entity("info_target")
        
entity_set_string(jetpack,EV_SZ_classname,"zp_jp_jetpack")
        
entity_set_model(jetpack,"models/p_egon.mdl")    
        
        
entity_set_size(jetpack,Float:{-16.0,-16.0,-16.0},Float:{16.0,16.0,16.0})
        
entity_set_int(jetpack,EV_INT_solid,1)
        
        
entity_set_int(jetpack,EV_INT_movetype,6)
        
        
entity_set_vector(jetpack,EV_VEC_origin,origin)        
        
        
hasjet[player] = 0
        rocket
[player] = false
    
}    
}

public 
pfn_touch(ptrptd) {
    if(
is_valid_ent(ptr)) {
        new 
classname[32]
        
entity_get_string(ptr,EV_SZ_classname,classname,31)
        
        if(
equal(classname"zp_jp_jetpack")) {
            if(
is_valid_ent(ptd)) {
                new 
id ptd
                
if(id && id 34) {
                    if(!
hasjet[id] && !zp_get_user_zombie(id) && is_user_alive(id)) {
                        
                        
hasjet[id] = 1
                        g_flyEnergy
[id] = get_pcvar_num(cvar_fly_max_engery)
                        
rocket[id] = true
                        client_cmd
(id,"spk items/gunpickup2.wav")
                        
engclient_cmd(id,"weapon_knife")
                        
switchmodel(id)
                        
remove_entity(ptr)
                    }
                }
            }
        }else if(
equal(classname"zp_jp_rocket")) {
            new 
Float:fOrigin[3]
            new 
iOrigin[3]
            
entity_get_vector(ptrEV_VEC_originfOrigin)
            
FVecIVec(fOrigin,iOrigin)
            
jp_radius_damage(ptr)
                
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_EXPLOSION)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_short(explosion)
            
write_byte(55)
            
write_byte(15)
            
write_byte(0)
            
message_end()

                        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_EXPLOSION)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_short(explosion)
            
write_byte(65)
            
write_byte(15)
            
write_byte(0)
            
message_end()

                        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_EXPLOSION)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_short(explosion)
            
write_byte(85)
            
write_byte(15)
            
write_byte(0)
            
message_end()
                
            
message_begin(MSG_ALL,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_BEAMCYLINDER)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2]+350)
            
write_short(white)
            
write_byte(0)
            
write_byte(1)
            
write_byte(6)
            
write_byte(100)
            
write_byte(1)
            
write_byte(255)
            
write_byte(255)
            
write_byte(255)
            
write_byte(200)
            
write_byte(0)
            
message_end()

                        
message_begin(MSG_ALL,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_BEAMCYLINDER)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2]+450)
            
write_short(white)
            
write_byte(0)
            
write_byte(1)
            
write_byte(6)
            
write_byte(100)
            
write_byte(1)
            
write_byte(255)
            
write_byte(255)
            
write_byte(255)
            
write_byte(200)
            
write_byte(0)
            
message_end()

                        
message_begin(MSG_ALL,SVC_TEMPENTITY,iOrigin)
            
write_byte(TE_BEAMCYLINDER)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2]+650)
            
write_short(white)
            
write_byte(0)
            
write_byte(1)
            
write_byte(6)
            
write_byte(100)
            
write_byte(1)
            
write_byte(255)
            
write_byte(255)
            
write_byte(255)
            
write_byte(200)
            
write_byte(0)
            
message_end()
            
            if(
is_valid_ent(ptd)) {
                new 
classname2[32]
                
entity_get_string(ptd,EV_SZ_classname,classname2,31)
                
                if(
equal(classname2,"func_breakable"))
                    
force_use(ptr,ptd)
            }
            
            
remove_entity(ptr)
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
zp_user_infected_pre(playerinfector){
    
    
cmdDrop(player);
    
hasjet[player] = 0;
    
g_flyEnergy[player] = 0;
    
rocket[player] = false;
}

public 
zp_extra_item_selected(playeritemid){
    

    new 
clip,ammo
    
new weapon get_user_weapon(player,clip,ammo)
        
    if (
itemid == g_item_jetpack)
    {
        
client_print(playerprint_chat"[ZP] Press SPACE+CTRL to fly!")
        
hasjet[player] = 1
        g_flyEnergy
[player] = get_pcvar_num(cvar_fly_max_engery)
        
rocket[player] = true
        client_cmd
(player,"spk items/gunpickup2.wav")
        if(
weapon == CSW_KNIFE){
            
switchmodel(player)
        }
        else
        {
            
engclient_cmd(player,"weapon_knife"),switchmodel(player)
        }
    }
}

stock jp_radius_damage(entity) {
    new 
id entity_get_edict(entity,EV_ENT_owner)
    new 
packs,name[32];
    for(new 
133i++) {
        if(
is_user_alive(i)) {
            new 
dist floatround(entity_range(entity,i))
            
            if(
dist <= get_pcvar_num(cvar_Dmg_range)) {
                new 
hp get_user_health(i)
                new 
Float:damage get_pcvar_float(cvar_RocketDmg)-(get_pcvar_float(cvar_RocketDmg)/get_pcvar_float(cvar_Dmg_range))*float(dist)
                
                new 
Origin[3]
                
get_user_origin(i,Origin)
                
                if(
zp_get_user_zombie(id) != zp_get_user_zombie(i)) {
                        
get_user_name(i,name,31);
                        if(
damage>=800)
                            
packs 2;
                        else
                            
packs 1;
                            
                        if(
hp damage)
                        {
                            
                            
zp_set_user_ammo_packs idzp_get_user_ammo_packs id ) + packs );
                            
jp_take_damage(i,floatround(damage),Origin,DMG_BLAST)
                            
ColorChat(id,RED,"^x04[Zp]^x03 Damage to ^x04%s^x03 :: ^x04%i^x03 Damage !!"namefloatround(damage));

                        }
                        else
                        {
                            
log_kill(id,i,"Jetpack Rocket",0)
                            
//zp_set_user_ammo_packs ( id, zp_get_user_ammo_packs ( id ) + 5 );
                            
ColorChat(id,RED,"^x04[Zp]^x03 You killed ^x03 %s^x01 with Bazooka "name);
                        }
                    }
            }
        }
    }
}

stock log_kill(killervictimweapon[], headshot)
{
// code from MeRcyLeZZ
    
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
    
ExecuteHamB(Ham_Killedvictimkiller2// set last param to 2 if you want victim to gib
    
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)

    
    
message_begin(MSG_BROADCASTget_user_msgid("DeathMsg"))
    
write_byte(killer)
    
write_byte(victim)
    
write_byte(headshot)
    
write_string(weapon)
    
message_end()
//
    
    
if(get_user_team(killer)!=get_user_team(victim))
        
set_user_frags(killer,get_user_frags(killer) +1)
    if(
get_user_team(killer)==get_user_team(victim))
        
set_user_frags(killer,get_user_frags(killer) -1)
        
    new 
kname[32], vname[32], kauthid[32], vauthid[32], kteam[10], vteam[10]

    
get_user_name(killerkname31)
    
get_user_team(killerkteam9)
    
get_user_authid(killerkauthid31)
 
    
get_user_name(victimvname31)
    
get_user_team(victimvteam9)
    
get_user_authid(victimvauthid31)
        
    
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^""
    
knameget_user_userid(killer), kauthidkteam
     
vnameget_user_userid(victim), vauthidvteamweapon)

     return 
PLUGIN_CONTINUE;
}

stock jp_take_damage(victim,damage,origin[3],bit) {
    
message_begin(MSG_ONE,get_user_msgid("Damage"),{0,0,0},victim)
    
write_byte(21)
    
write_byte(20)
    
write_long(bit)
    
write_coord(origin[0])
    
write_coord(origin[1])
    
write_coord(origin[2])
    
message_end()
    
    
set_user_health(victim,get_user_health(victim)-damage)
}
public 
ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...)
{
    static 
message[256];

    switch(
type)
    {
        case 
YELLOW:{ // Yellow
        
            
message[0] = 0x01;
        }
        case 
GREEN:{// Green

            
message[0] = 0x04;
        }
        default:{ 
// White, Red, Blue
            
message[0] = 0x03;
        }
    }
    
vformat(message[1], 251msg4);

    
// Make sure message is not longer than 192 character. Will crash the server.
    
message[192] = '^0';
    new 
teamColorChangeindexMSG_Type;
    if(!
id)    {
        
index FindPlayer();
        
MSG_Type MSG_ALL;
    } else {
        
MSG_Type MSG_ONE;
        
index id;
    }
    
team get_user_team(index);    
    
ColorChange ColorSelection(indexMSG_Typetype);
    
ShowColorMessage(indexMSG_Typemessage);
    if(
ColorChange){
        
Team_Info(indexMSG_TypeTeamName[team]);
    }
}

ShowColorMessage(idtypemessage[]){
    
message_begin(type76_id);
    
write_byte(id)        
    
write_string(message);
    
message_end();    
}

Team_Info(idtypeteam[]){
    
message_begin(type86_id);
    
write_byte(id);
    
write_string(team);
    
message_end();
    return 
1;
}

ColorSelection(indextypeColor:Type){
    switch(
Type)    {
        case 
RED:        {
            return 
Team_Info(indextypeTeamName[1]);
        }
        case 
BLUE:        {
            return 
Team_Info(indextypeTeamName[2]);
        }
        case 
GREY:        {
            return 
Team_Info(indextypeTeamName[0]);
        }
    }
    return 
0;
}

FindPlayer(){
    new 
= -1;
    while(
<= MAXSLOTS){
        if(
is_user_connected(++i)){
            return 
i;
        }
    }

    return -
1;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
thhhhhhhhn nnnnnnnnnnnnnnnnnnnnnnnnnnnnx man you really help me thhhhhnxxxxx: )
bashar beesho 1999 is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 06-27-2013 , 01:48   Re: Jetpack+Bazooka
Reply With Quote #10

No problem
__________________
You will find everything u need :-
Catastrophe 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 18:47.


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