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

Parachute 1.3 (KRoTaL)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ZEDD_Intensity
Senior Member
Join Date: Jun 2016
Old 06-16-2018 , 17:13   Re: Parachute 1.3 (KRoTaL)
Reply With Quote #11

Quote:
Originally Posted by anash View Post
Any way to make parachute only for admins ?
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>

new para_ent[33]
new 
pDetachpFallSpeedpEnabled

#define PARACHUTE_LEVEL ADMIN_LEVEL_B

public plugin_init()
{
    
register_plugin("Parachute""1.3""KRoT@L/JTP10181")
    
pEnabled register_cvar("sv_parachute""1" )
    
pFallSpeed register_cvar("parachute_fallspeed""70")
    
pDetach register_cvar("parachute_detach""1")
    
    
register_event("DeathMsg""death_event""a")
    
    
//Setup jtp10181 CVAR
    
new cvarString[256], shortName[16]
    
copy(shortName,15,"chute")
    
    
register_cvar("jtp10181","",FCVAR_SERVER|FCVAR_SPONLY)
    
get_cvar_string("jtp10181",cvarString,255)
    
    if (
strlen(cvarString) == 0) {
        
formatex(cvarString,255,shortName)
        
set_cvar_string("jtp10181",cvarString)
    }
    else if (
contain(cvarString,shortName) == -1) {
        
format(cvarString,255,"%s,%s",cvarStringshortName)
        
set_cvar_string("jtp10181",cvarString)
    }
}

public 
plugin_natives()
{
    
set_module_filter("module_filter")
    
set_native_filter("native_filter")
}

public 
module_filter(const module[])
{
    if (!
cstrike_running() && equali(module"cstrike")) {
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
native_filter(const name[], indextrap)
{
    if (!
trap) return PLUGIN_HANDLED
    
    
return PLUGIN_CONTINUE
}

public 
plugin_precache()
{
    
precache_model("models/parachute.mdl")
}

public 
client_putinserver(id)
{
    
parachute_reset(id)
}

public 
client_disconnect(id)
{
    
parachute_reset(id)
}

public 
death_event()
{
    new 
id read_data(2)
    if(
<= id <= 32)
    
parachute_reset(id)
}

parachute_reset(id)
{
    if(
para_ent[id] > 0) {
        if (
is_valid_ent(para_ent[id])) {
            
remove_entity(para_ent[id])
        }
    }
    
    if (
is_user_alive(id)) set_user_gravity(id1.0)
    
    
para_ent[id] = 0
}

public 
client_PreThink(id)
{
    
//parachute.mdl animation information
    //0 - deploy - 84 frames
    //1 - idle - 39 frames
    //2 - detach - 29 frames
    
    
if (!get_pcvar_num(pEnabled)) return
    if (!
is_user_alive(id) || !access(id,PARACHUTE_LEVEL)) return
    
    new 
Float:fallspeed get_pcvar_float(pFallSpeed) * -1.0
    
new Float:frame
    
    
new button get_user_button(id)
    new 
oldbutton get_user_oldbutton(id)
    new 
flags get_entity_flags(id)
    
    if (
para_ent[id] > && (flags FL_ONGROUND)) {
        
        if (
get_pcvar_num(pDetach)) {
            
            if (
get_user_gravity(id) == 0.1set_user_gravity(id1.0)
            
            if (
entity_get_int(para_ent[id],EV_INT_sequence) != 2) {
                
entity_set_int(para_ent[id], EV_INT_sequence2)
                
entity_set_int(para_ent[id], EV_INT_gaitsequence1)
                
entity_set_float(para_ent[id], EV_FL_frame0.0)
                
entity_set_float(para_ent[id], EV_FL_fuser10.0)
                
entity_set_float(para_ent[id], EV_FL_animtime0.0)
                
entity_set_float(para_ent[id], EV_FL_framerate0.0)
                return
            }
            
            
frame entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0
            entity_set_float
(para_ent[id],EV_FL_fuser1,frame)
            
entity_set_float(para_ent[id],EV_FL_frame,frame)
            
            if (
frame 254.0) {
                
remove_entity(para_ent[id])
                
para_ent[id] = 0
            
}
        }
        else {
            
remove_entity(para_ent[id])
            
set_user_gravity(id1.0)
            
para_ent[id] = 0
        
}
        
        return
    }
    
    if (
button IN_USE) {
        
        new 
Float:velocity[3]
        
entity_get_vector(idEV_VEC_velocityvelocity)
        
        if (
velocity[2] < 0.0) {
            
            if(
para_ent[id] <= 0) {
                
para_ent[id] = create_entity("info_target")
                if(
para_ent[id] > 0) {
                    
entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
                    
entity_set_edict(para_ent[id], EV_ENT_aimentid)
                    
entity_set_edict(para_ent[id], EV_ENT_ownerid)
                    
entity_set_int(para_ent[id], EV_INT_movetypeMOVETYPE_FOLLOW)
                    
entity_set_model(para_ent[id], "models/parachute.mdl")
                    
entity_set_int(para_ent[id], EV_INT_sequence0)
                    
entity_set_int(para_ent[id], EV_INT_gaitsequence1)
                    
entity_set_float(para_ent[id], EV_FL_frame0.0)
                    
entity_set_float(para_ent[id], EV_FL_fuser10.0)
                }
            }
            
            if (
para_ent[id] > 0) {
                
                
entity_set_int(idEV_INT_sequence3)
                
entity_set_int(idEV_INT_gaitsequence1)
                
entity_set_float(idEV_FL_frame1.0)
                
entity_set_float(idEV_FL_framerate1.0)
                
set_user_gravity(id0.1)
                
                
velocity[2] = (velocity[2] + 40.0 fallspeed) ? velocity[2] + 40.0 fallspeed
                entity_set_vector
(idEV_VEC_velocityvelocity)
                
                if (
entity_get_int(para_ent[id],EV_INT_sequence) == 0) {
                    
                    
frame entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0
                    entity_set_float
(para_ent[id],EV_FL_fuser1,frame)
                    
entity_set_float(para_ent[id],EV_FL_frame,frame)
                    
                    if (
frame 100.0) {
                        
entity_set_float(para_ent[id], EV_FL_animtime0.0)
                        
entity_set_float(para_ent[id], EV_FL_framerate0.4)
                        
entity_set_int(para_ent[id], EV_INT_sequence1)
                        
entity_set_int(para_ent[id], EV_INT_gaitsequence1)
                        
entity_set_float(para_ent[id], EV_FL_frame0.0)
                        
entity_set_float(para_ent[id], EV_FL_fuser10.0)
                    }
                }
            }
        }
        else if (
para_ent[id] > 0) {
            
remove_entity(para_ent[id])
            
set_user_gravity(id1.0)
            
para_ent[id] = 0
        
}
    }
    else if ((
oldbutton IN_USE) && para_ent[id] > ) {
        
remove_entity(para_ent[id])
        
set_user_gravity(id1.0)
        
para_ent[id] = 0
    
}

PHP Code:
#define PARACHUTE_LEVEL ADMIN_LEVEL_B 
Kind Regards,
ZEDD
__________________
ZEDD_Intensity is offline
 



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:08.


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