Raised This Month: $12 Target: $400
 3% 

Parachute


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MeliMeli
Senior Member
Join Date: Apr 2022
Location: Brazil
Old 05-07-2022 , 22:01   Parachute
Reply With Quote #1

Hello, I downloaded a parachute plugin, but when the player is infected and uses antidote the parachute disappears, I realized that the native was missing in .sma, I tried some ways but I only had errors. Can anyone help?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

#define _PLUGIN         "[ZP] Parachute VIP"
#define _VERSION             "2.0"
#define _AUTHOR           "H.RED.ZONE/VIP Version By KyuuBloodCS A.K.A Kyuuxen"

#define PARACHUTE_MODEL "models/parachute.mdl"

#define MAX_PLAYERS    32

#define MarkUserHasParachute(%0)    g_bitHasParachute |= (1<<(%0&31))
#define ClearUserHasParachute(%0)    g_bitHasParachute &= ~(1<<(%0&31))
#define HasUserParachute(%0)        g_bitHasParachute & (1<<(%0&31))

new g_bitHasParachute 

new g_iUserParachute[MAX_PLAYERS+1]

new 
Float:g_flEntityFrame[MAX_PLAYERS+1]

new 
g_iModelIndex
new g_pCvarFallSpeed

new const PARACHUTE_CLASS[] = "parachute"

enum {
    
deploy,
    
idle,
    
detach
}

public 
plugin_init() {
    
register_plugin(_PLUGIN_VERSION_AUTHOR)

    
g_pCvarFallSpeed register_cvar("parachute_fallspeed""30")

    
register_forwardFM_CmdStart"fw_Start" )
    
    
RegisterHam(Ham_Spawn"player""Ham_CBasePlayer_Spawn_Post"1)
    
RegisterHam(Ham_Killed"player""Ham_CBasePlayer_Killed_Post"1)
}

public 
plugin_precache() {
    
g_iModelIndex precache_model(PARACHUTE_MODEL)
}

public 
client_putinserver(id) {
    if( 
HasUserParachute(id) ) {
        new 
iEnt g_iUserParachute[id]
        if( 
iEnt ) {
            
RemoveUserParachute(idiEnt)
        }
        
ClearUserHasParachute(id)
    }
}

public 
client_disconnected(id) {
    if( 
HasUserParachute(id) ) {
        new 
iEnt g_iUserParachute[id]
        if( 
iEnt ) {
            
RemoveUserParachute(idiEnt)
        }
        
ClearUserHasParachute(id)
    }
}

public 
zp_user_infected_post(id)
{
    if( 
HasUserParachute(id) ) {
        new 
iEnt g_iUserParachute[id]
        if( 
iEnt ) {
            
RemoveUserParachute(idiEnt)
        }
        
ClearUserHasParachute(id)
    }
}

public 
Ham_CBasePlayer_Killed_Postid ) {
    if( 
HasUserParachute(id) ) {
        new 
iEnt g_iUserParachute[id]
        if( 
iEnt ) {
            
RemoveUserParachute(idiEnt)
        }
        
ClearUserHasParachute(id)
    }
}

public 
Ham_CBasePlayer_Spawn_Post(id) {
    if(
is_user_admin(id) ) {
        if( 
HasUserParachute(id) ) {
            new 
iEnt g_iUserParachute[id]
            if( 
iEnt ) {
                
RemoveUserParachute(idiEnt)
            }
        }
        
MarkUserHasParachute(id)
    }
}

RemoveUserParachute(idiEnt) {
    
engfunc(EngFunc_RemoveEntityiEnt)
    
g_iUserParachute[id] = 0
}

CreateParachute(id) {
    static 
iszInfoTarget
    
if( !iszInfoTarget ) {
        
iszInfoTarget engfunc(EngFunc_AllocString"info_target")
    }

    new 
iEnt engfunc(EngFunc_CreateNamedEntityiszInfoTarget)
    if( 
iEnt 0) {
        static 
iszClass 0
        
if( !iszClass ) {
            
iszClass engfunc(EngFunc_AllocStringPARACHUTE_CLASS)
        }
        
set_pev_string(iEntpev_classnameiszClass)
        
set_pev(iEntpev_aimentid)
        
set_pev(iEntpev_ownerid)
        
set_pev(iEntpev_movetypeMOVETYPE_FOLLOW)

        static 
iszModel 0
        
if( !iszModel ) {
            
iszModel engfunc(EngFunc_AllocStringPARACHUTE_MODEL)
        }
        
set_pev_string(iEntpev_modeliszModel)
        
set_pev(iEntpev_modelindexg_iModelIndex)

        
set_pev(iEntpev_sequencedeploy)
        
set_pev(iEntpev_gaitsequence1)
        
set_pev(iEntpev_frame0.0)
        
g_flEntityFrame[id] = 0.0
        g_iUserParachute
[id] = iEnt
        MarkUserHasParachute
(id)
        new 
Float:fVecOrigin[3]
        
pev(idpev_originfVecOrigin)
        
        return 
iEnt
    
}
    return 
0
}

public 
fw_Start(id) {
    if( ~
HasUserParachute(id) || !is_user_admin(id) && !is_user_alive(id) ) {
        return
    }

    new 
Float:flFrame
    
new iEnt g_iUserParachute[id]

    if(
iEnt && pev(idpev_flags) & FL_ONGROUND) {

        if( 
pev(iEntpev_sequence) != detach ) {
            
set_pev(iEntpev_sequencedetach)
            
set_pev(iEntpev_gaitsequence1)
            
set_pev(iEntpev_frame0.0)
            
g_flEntityFrame[id] = 0.0
            set_pev
(iEntpev_animtime0.0)
            
set_pev(iEntpev_framerate0.0)
            return
        }

        
pev(iEntpev_frameflFrame)
        if( 
flFrame 252.0 ) {
            
RemoveUserParachute(idiEnt)
            return
        }

        
flFrame += 2.0

        g_flEntityFrame
[id] = flFrame
        set_pev
(iEntpev_frameflFrame)

        return
    }

    if( 
pev(idpev_button) & IN_USE ) {
        new 
Float:fVecVelocity[3], Float:fVelocity_z
        pev
(idpev_velocityfVecVelocity)
        
fVelocity_z fVecVelocity[2]

        if( 
fVelocity_z 0.0 ) {
            if(
iEnt <= 0) {
                
iEnt CreateParachute(id)
            }

            
fVelocity_z floatmin(fVelocity_z 15.0, -get_pcvar_float(g_pCvarFallSpeed))
            
fVecVelocity[2] = fVelocity_z
            set_pev
(idpev_velocityfVecVelocity)

            if( 
pev(iEntpev_sequence) == deploy ) {
                
flFrame g_flEntityFrame[id]++

                if( 
flFrame 100.0 ) {
                    
set_pev(iEntpev_animtime0.0)
                    
set_pev(iEntpev_framerate0.4)
                    
set_pev(iEntpev_sequenceidle)
                    
set_pev(iEntpev_gaitsequence1)
                    
set_pev(iEntpev_frame0.0)
                    
g_flEntityFrame[id] = 0.0
                
}
                else {
                    
set_pev(iEntpev_frameflFrame)
                }
            }
        }
        else if(
iEnt 0) {
            
RemoveUserParachute(idiEnt)
        }
    }
    else if( 
iEnt && pev(idpev_oldbuttons) & IN_USE ) {
        
RemoveUserParachute(idiEnt)
    }

MeliMeli is offline
OW3R
Junior Member
Join Date: Sep 2021
Old 05-20-2022 , 10:26   Re: Parachute
Reply With Quote #2

Quote:
Originally Posted by MeliMeli View Post
Hello, I downloaded a parachute plugin, but when the player is infected and uses antidote the parachute disappears, I realized that the native was missing in .sma, I tried some ways but I only had errors. Can anyone help?

PHP Code:

#include <zombieplague>

public zp_user_infected_post(id)
{
    if( 
HasUserParachute(id) ) {
        new 
iEnt g_iUserParachute[id]
        if( 
iEnt ) {
            
RemoveUserParachute(idiEnt)
        }
        
ClearUserHasParachute(id)
    }

Try deleting the codes I specified.
OW3R 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 11:22.


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