Raised This Month: $ Target: $400
 0% 

not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Intouchable
Senior Member
Join Date: Mar 2012
Old 03-17-2012 , 06:59   not working
Reply With Quote #1

Code:
#define ADMINACCESS ADMIN_CHAT

new const parachute_model[] = "models/parachute.mdl"

new bool:has_parachute[33]
new para_ent[33]
new parachute_FallSpeed, parachute_Detach


public plugin_init() 
{
        parachute_FallSpeed = register_cvar("parachute_fallspeed", "30")
        parachute_Detach = register_cvar("parachute_detach", "1")

        register_forward(FM_PlayerPreThink,"PlayerPree_Think");
}

public plugin_precache()
    engfunc(EngFunc_PrecacheModel, parachute_model)

public item_enabled(id) {
    has_parachute[id] = true
}
 
public PlayerPree_Think(id)
{
    if (!is_user_alive(id) || !has_parachute[id] || !(get_user_flags(id) & ADMIN_LEVEL_H))
        return
 
    new Float:fallspeed = get_pcvar_float(parachute_FallSpeed) * -1.0
    new Float:frame
 
    new button = pev(id, pev_button)
    new oldbutton = pev(id, pev_oldbuttons)
    new flags = pev(id, pev_flags)
 
    if (para_ent[id] > 0 && (flags & FL_ONGROUND)) 
    {
        set_view(id, CAMERA_NONE)
        
        if (get_pcvar_num(parachute_Detach)) 
        {
            if ( pev(para_ent[id],pev_sequence) != 2 ) 
            {
                set_pev(para_ent[id], pev_sequence, 2)
                set_pev(para_ent[id], pev_gaitsequence, 1)
                set_pev(para_ent[id], pev_frame, 0.0)
                set_pev(para_ent[id], pev_fuser1, 0.0)
                set_pev(para_ent[id], pev_animtime, 0.0)
                return
            }
            
            pev(para_ent[id],pev_fuser1, frame)
            frame += 2.0
            set_pev(para_ent[id],pev_fuser1,frame)
            set_pev(para_ent[id],pev_frame,frame)
            
            if ( frame > 254.0 )
            {
                engfunc(EngFunc_RemoveEntity, para_ent[id])
                para_ent[id] = 0
            }
        }
        else 
        {
            engfunc(EngFunc_RemoveEntity, para_ent[id])
            para_ent[id] = 0
        }
        return
    }
 
    if ((button & IN_USE) && (get_user_team(id) == 2) && (get_user_flags(id) & ADMINACCESS)) 
    {
        new Float:velocity[3]
        pev(id, pev_velocity, velocity)
        
        if (velocity[2] < 0.0) 
        {
            if(para_ent[id] <= 0) 
            {
                para_ent[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
                
                if(para_ent[id] > 0) 
                {
                    set_pev(para_ent[id],pev_classname,"parachute")
                    set_pev(para_ent[id], pev_aiment, id)
                    set_pev(para_ent[id], pev_owner, id)
                    set_pev(para_ent[id], pev_movetype, MOVETYPE_FOLLOW)
                    engfunc(EngFunc_SetModel, para_ent[id], parachute_model)
                    set_pev(para_ent[id], pev_sequence, 0)
                    set_pev(para_ent[id], pev_gaitsequence, 1)
                    set_pev(para_ent[id], pev_frame, 0.0)
                    set_pev(para_ent[id], pev_fuser1, 0.0)
                }
            }
            
            if (para_ent[id] > 0) 
            {
                set_pev(id, pev_sequence, 3)
                set_pev(id, pev_gaitsequence, 1)
                set_pev(id, pev_frame, 1.0)
                set_pev(id, pev_framerate, 1.0)
            
                velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
                set_pev(id, pev_velocity, velocity)
                
                if (pev(para_ent[id],pev_sequence) == 0) 
                {
                    pev(para_ent[id],pev_fuser1, frame)
                    frame += 1.0
                    set_pev(para_ent[id],pev_fuser1,frame)
                    set_pev(para_ent[id],pev_frame,frame)
                    
                    if (frame > 100.0) 
                    {
                        set_pev(para_ent[id], pev_animtime, 0.0)
                        set_pev(para_ent[id], pev_framerate, 0.4)
                        set_pev(para_ent[id], pev_sequence, 1)
                        set_pev(para_ent[id], pev_gaitsequence, 1)
                        set_pev(para_ent[id], pev_frame, 0.0)
                        set_pev(para_ent[id], pev_fuser1, 0.0)
                    }
                }
            }
        }
        
        else if (para_ent[id] > 0) 
        {
            engfunc(EngFunc_RemoveEntity, para_ent[id])
            para_ent[id] = 0
        }
    }
    
    else if ((oldbutton & IN_USE) && para_ent[id] > 0 ) 
    {
        engfunc(EngFunc_RemoveEntity, para_ent[id])
        para_ent[id] = 0
    }
}
Why not working parachute when i pushing 'e'?

Last edited by Intouchable; 03-17-2012 at 13:13.
Intouchable is offline
Xvil
BANNED
Join Date: Feb 2012
Old 03-17-2012 , 08:09   Re: not working
Reply With Quote #2

To Use parachute with pushing 'e'

use this:
PHP Code:
#include <amxmodx>

public plugin_init() {
    
register_clcmd("+use""use_parachute")
}

public 
use_parachute(id// the player(id) is pushing e
{
    
// .....

Xvil is offline
Intouchable
Senior Member
Join Date: Mar 2012
Old 03-17-2012 , 08:14   Re: not working
Reply With Quote #3

Quote:
Originally Posted by Xvil View Post
To Use parachute with pushing 'e'

use this:
PHP Code:
#include <amxmodx>

public plugin_init() {
    
register_clcmd("+use""use_parachute")
}

public 
use_parachute(id// the player(id) is pushing e
{
    
// .....

Where i post the code there automatically using 'e', but when i pushing the 'e' the parachute doesn't appeas
Intouchable is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 03-17-2012 , 09:45   Re: not working
Reply With Quote #4

Quote:
Originally Posted by Xvil View Post
To Use parachute with pushing 'e'

use this:
PHP Code:
#include <amxmodx>

public plugin_init() {
    
register_clcmd("+use""use_parachute")
}

public 
use_parachute(id// the player(id) is pushing e
{
    
// .....

NO!

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "[R]ak"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forward(FM_PlayerPostThink"fw_PlayerPostThink")
    
//OR
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
}

public 
fw_PlayerPostThink(id) {                //POST
    
    
if( is_user_aliveid ) && pev(idpev_oldbuttons) & IN_USE ) {
        
//CODE CODE
    
}
}

//OR

public fw_PlayerPreThink(id) {                  //PRE
    
    
if( is_user_aliveid ) && pev(idpev_button) & IN_USE ) { 
        
//CODE CODE
    
}

__________________

www.amxmodx-es.com

Steam: Luchokoldo

Last edited by rak; 03-17-2012 at 10:10.
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
Intouchable
Senior Member
Join Date: Mar 2012
Old 03-17-2012 , 10:07   Re: not working
Reply With Quote #5

Can you post with fulll code? Because not working -.-. No errors in the server console...
Intouchable is offline
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 03-17-2012 , 11:27   Re: not working
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>

#define ADMINACCESS ADMIN_CHAT

new bool:has_parachute[33]
new 
para_ent[33]
new 
pDetachpFallSpeedpEnabled

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

public 
plugin_init()
{
    
pEnabled register_cvar("sv_parachute""1" )
    
pFallSpeed register_cvar("parachute_fallspeed""100")
    
pDetach register_cvar("parachute_detach""1")
    
    
register_event("ResetHUD""newSpawn""be")
    
register_event("DeathMsg""death_event""a")

}

public 
client_connect(id)
  
parachute_reset(id)

public 
client_disconnect(id)
  
parachute_reset(id)
  
public 
newSpawn(id)
{
    if(
para_ent[id] > 0)
    {
        
remove_entity(para_ent[id])
        
fm_set_user_gravity(id1.0)
        
para_ent[id] = 0
    
}
    
has_parachute[id] = true;
}
  
public 
death_event()
{
    new 
id read_data(2)
    
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))
      
fm_set_user_gravity(id1.0)
    
    
has_parachute[id] = false
    para_ent
[id] = 0
}

public 
client_PreThink(id)
{
    if (!
get_pcvar_num(pEnabled)) return
    if (!
is_user_alive(id) || !has_parachute[id] || !(get_user_flags(id) & ADMIN_LEVEL_H)) 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 (
fm_get_user_gravity(id) == 0.1fm_set_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])
            
fm_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)
                
fm_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])
            
fm_set_user_gravity(id1.0)
            
para_ent[id] = 0
        
}
    }
    else if ((
oldbutton IN_USE) && para_ent[id] > && (get_user_team(id) == 2) && (get_user_flags(id) & ADMINACCESS))
    {
        
remove_entity(para_ent[id])
        
fm_set_user_gravity(id1.0)
        
para_ent[id] = 0
    
}



stock Float:fm_get_user_gravity(index)
{
    new 
Float:gravity;
    
pev(indexpev_gravitygravity);
    
    return 
gravity;
}

stock fm_set_user_gravity(indexFloat:gravity 1.0)
{
    
set_pev(indexpev_gravitygravity);
    
    return 
1;


Last edited by bazhenov93; 03-17-2012 at 11:32.
bazhenov93 is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 03-17-2012 , 12:46   Re: not working
Reply With Quote #7

Quote:
Originally Posted by rak View Post
NO!

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "[R]ak"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forward(FM_PlayerPostThink"fw_PlayerPostThink")
    
//OR
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
}

public 
fw_PlayerPostThink(id) {                //POST
    
    
if( is_user_aliveid ) && pev(idpev_oldbuttons) & IN_USE ) {
        
//CODE CODE
    
}
}

//OR

public fw_PlayerPreThink(id) {                  //PRE
    
    
if( is_user_aliveid ) && pev(idpev_button) & IN_USE ) { 
        
//CODE CODE
    
}

Yours isnt much better... (but would work lol)

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

const m_afButtonPressed 246;
const 
m_afButtonReleased 247;

public 
plugin_init()
{
    
RegisterHam(Ham_ObjectCaps"player""fwdObjectCaps"); // Player Presses Use
}

public 
fwdObjectCaps(id)
{
    if(
get_pdata_int(idm_afButtonPressed5) & IN_USE)
    {
        
client_print(idprint_chat"You pressed Use key");
    }
    if(
get_pdata_int(idm_afButtonReleased5) & IN_USE)
    {
        
client_print(idprint_chat"You released use key");
    }

By default im pretty sure that plugin already uses the +use command to deploy the chute so our posts are pointless. it uses client_prethink forward. But I couldnt get the chute to work while back either..

Last edited by Doc-Holiday; 03-17-2012 at 12:49.
Doc-Holiday is offline
Intouchable
Senior Member
Join Date: Mar 2012
Old 03-17-2012 , 13:12   Re: not working
Reply With Quote #8

I need to know how fix this parachute... No need key press..
PHP Code:
#define ADMINACCESS ADMIN_CHAT

new const parachute_model[] = "models/parachute.mdl"

new bool:has_parachute[33]
new 
para_ent[33]
new 
parachute_FallSpeedparachute_Detach


public plugin_init() 
{
        
parachute_FallSpeed register_cvar("parachute_fallspeed""30")
        
parachute_Detach register_cvar("parachute_detach""1")

        
register_forward(FM_PlayerPreThink,"PlayerPree_Think");
}

public 
plugin_precache()
    
engfunc(EngFunc_PrecacheModelparachute_model)

public 
item_enabled(id) {
    
has_parachute[id] = true
}
 
public 
PlayerPree_Think(id)
{
    if (!
is_user_alive(id) || !has_parachute[id] || !(get_user_flags(id) & ADMIN_LEVEL_H))
        return
 
    new 
Float:fallspeed get_pcvar_float(parachute_FallSpeed) * -1.0
    
new Float:frame
 
    
new button pev(idpev_button)
    new 
oldbutton pev(idpev_oldbuttons)
    new 
flags pev(idpev_flags)
 
    if (
para_ent[id] > && (flags FL_ONGROUND)) 
    {
        
set_view(idCAMERA_NONE)
        
        if (
get_pcvar_num(parachute_Detach)) 
        {
            if ( 
pev(para_ent[id],pev_sequence) != 
            {
                
set_pev(para_ent[id], pev_sequence2)
                
set_pev(para_ent[id], pev_gaitsequence1)
                
set_pev(para_ent[id], pev_frame0.0)
                
set_pev(para_ent[id], pev_fuser10.0)
                
set_pev(para_ent[id], pev_animtime0.0)
                return
            }
            
            
pev(para_ent[id],pev_fuser1frame)
            
frame += 2.0
            set_pev
(para_ent[id],pev_fuser1,frame)
            
set_pev(para_ent[id],pev_frame,frame)
            
            if ( 
frame 254.0 )
            {
                
engfunc(EngFunc_RemoveEntitypara_ent[id])
                
para_ent[id] = 0
            
}
        }
        else 
        {
            
engfunc(EngFunc_RemoveEntitypara_ent[id])
            
para_ent[id] = 0
        
}
        return
    }
 
    if ((
button IN_USE) && (get_user_team(id) == 2) && (get_user_flags(id) & ADMINACCESS)) 
    {
        new 
Float:velocity[3]
        
pev(idpev_velocityvelocity)
        
        if (
velocity[2] < 0.0
        {
            if(
para_ent[id] <= 0
            {
                
para_ent[id] = engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
                
                if(
para_ent[id] > 0
                {
                    
set_pev(para_ent[id],pev_classname,"parachute")
                    
set_pev(para_ent[id], pev_aimentid)
                    
set_pev(para_ent[id], pev_ownerid)
                    
set_pev(para_ent[id], pev_movetypeMOVETYPE_FOLLOW)
                    
engfunc(EngFunc_SetModelpara_ent[id], parachute_model)
                    
set_pev(para_ent[id], pev_sequence0)
                    
set_pev(para_ent[id], pev_gaitsequence1)
                    
set_pev(para_ent[id], pev_frame0.0)
                    
set_pev(para_ent[id], pev_fuser10.0)
                }
            }
            
            if (
para_ent[id] > 0
            {
                
set_pev(idpev_sequence3)
                
set_pev(idpev_gaitsequence1)
                
set_pev(idpev_frame1.0)
                
set_pev(idpev_framerate1.0)
            
                
velocity[2] = (velocity[2] + 40.0 fallspeed) ? velocity[2] + 40.0 fallspeed
                set_pev
(idpev_velocityvelocity)
                
                if (
pev(para_ent[id],pev_sequence) == 0
                {
                    
pev(para_ent[id],pev_fuser1frame)
                    
frame += 1.0
                    set_pev
(para_ent[id],pev_fuser1,frame)
                    
set_pev(para_ent[id],pev_frame,frame)
                    
                    if (
frame 100.0
                    {
                        
set_pev(para_ent[id], pev_animtime0.0)
                        
set_pev(para_ent[id], pev_framerate0.4)
                        
set_pev(para_ent[id], pev_sequence1)
                        
set_pev(para_ent[id], pev_gaitsequence1)
                        
set_pev(para_ent[id], pev_frame0.0)
                        
set_pev(para_ent[id], pev_fuser10.0)
                    }
                }
            }
        }
        
        else if (
para_ent[id] > 0
        {
            
engfunc(EngFunc_RemoveEntitypara_ent[id])
            
para_ent[id] = 0
        
}
    }
    
    else if ((
oldbutton IN_USE) && para_ent[id] > 
    {
        
engfunc(EngFunc_RemoveEntitypara_ent[id])
        
para_ent[id] = 0
    
}


Last edited by Intouchable; 03-17-2012 at 13:15.
Intouchable is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-17-2012 , 14:03   Re: not working
Reply With Quote #9

Quote:
Originally Posted by Xvil View Post
To Use parachute with pushing 'e'

use this:
PHP Code:
#include <amxmodx>

public plugin_init() {
    
register_clcmd("+use""use_parachute")
}

public 
use_parachute(id// the player(id) is pushing e
{
    
// .....

Please stop trying to help. That is in no way correct.
__________________
fysiks is online now
Intouchable
Senior Member
Join Date: Mar 2012
Old 03-17-2012 , 14:48   Re: not working
Reply With Quote #10

So someone can help me or not?
Intouchable is offline
Reply



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 20:39.


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