AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   two plugins with one velocity (https://forums.alliedmods.net/showthread.php?t=207200)

Miko000000 01-31-2013 00:51

two plugins with one velocity
 
Hello. Im working on my own jailbreak plugin. But i have one problem. See code
There is part of prethink. All is good working but when player buy both (multijump,bhop) somethink went wrong. Is there any way how solve this problem ?
Code:

public client_PreThink(id)
{
    if(g_bhop == true)
    {
        set_pev(id, pev_fuser2, 0.0)
        if(pev(id, pev_button) & 2)
        {
        new flags = pev(id, pev_flags)
       
        if(flags & FL_WATERJUMP)
        return PLUGIN_CONTINUE
        if(pev(id, pev_waterlevel) >= 2)
        return PLUGIN_CONTINUE
        if(!(flags & FL_ONGROUND))
        return PLUGIN_CONTINUE
       
        new Float:velocity[3]
        pev(id, pev_velocity, velocity)
        velocity[2] += 260.0
        set_pev(id, pev_velocity, velocity)
        set_pev(id, pev_gaitsequence, 6)
        } 
    }
    if(g_multijump == true)
    {
        if(!is_user_alive(id)) return PLUGIN_CONTINUE
        if(!(get_user_flags( id ) &  ADMIN_ADMIN)) return PLUGIN_CONTINUE
        new nbut = get_user_button(id)
        new obut = get_user_oldbutton(id)
        if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
        {
            if(jumpnum[id] < 1)
            {
                dojump[id] = true
                jumpnum[id]++
                return PLUGIN_CONTINUE
            }
        }
        if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
        {
            jumpnum[id] = 0
            return PLUGIN_CONTINUE
        }
    }
    return PLUGIN_CONTINUE
}   


public client_PostThink(id)
{
    if(g_multijump == true)
    {
    if(!is_user_alive(id)) return PLUGIN_CONTINUE
    if(!(get_user_flags( id ) & ACCESS_ADMIN)) return PLUGIN_CONTINUE
    if(dojump[id] == true)
    {
        new Float:velocity[3]   
        entity_get_vector(id,EV_VEC_velocity,velocity)
        velocity[2] = random_float(265.0,285.0)
        entity_set_vector(id,EV_VEC_velocity,velocity)
        dojump[id] = false
        return PLUGIN_CONTINUE
    }
    }
    return PLUGIN_CONTINUE
}


jimaway 01-31-2013 12:08

Re: two plugins with one velocity
 
try this:
Code:
public client_PreThink(id) {     if(g_multijump == true)     {         if(!is_user_alive(id)) return PLUGIN_CONTINUE         if(!(get_user_flags( id ) &  ADMIN_ADMIN)) return PLUGIN_CONTINUE         new nbut = get_user_button(id)         new obut = get_user_oldbutton(id)         if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))         {             if(jumpnum[id] < 1)             {                 dojump[id] = true                 jumpnum[id]++                 return PLUGIN_CONTINUE             }         }         if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))         {             jumpnum[id] = 0         }     }     if(g_bhop == true)     {         set_pev(id, pev_fuser2, 0.0)         if(pev(id, pev_button) & 2)         {         new flags = pev(id, pev_flags)                 if(flags & FL_WATERJUMP)          return PLUGIN_CONTINUE         if(pev(id, pev_waterlevel) >= 2)         return PLUGIN_CONTINUE         if(!(flags & FL_ONGROUND))         return PLUGIN_CONTINUE                 new Float:velocity[3]         pev(id, pev_velocity, velocity)         velocity[2] += 260.0         set_pev(id, pev_velocity, velocity)         set_pev(id, pev_gaitsequence, 6)         }       }     return PLUGIN_CONTINUE }

Miko000000 01-31-2013 16:25

Re: two plugins with one velocity
 
Thank you very much. All is working !


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

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