AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Make developer fly? [zp 4.3] (https://forums.alliedmods.net/showthread.php?t=229838)

SkumTomteN 11-15-2013 16:23

Make developer fly? [zp 4.3]
 
Can i make so only me can fly?, or only give me an invisible parachute, i just want it to fit my model.

http://i.imgur.com/nAC9EAQ.jpg

ANTICHRISTUS 11-15-2013 17:37

Re: Make developer fly? [zp 4.3]
 
  • if you want an invisible parachute, search this keyword (don't edit) in my posts: parachute+null
  • if you want it only for you, edit the flag in the .sma

DarkGod 11-16-2013 09:05

Re: Make developer fly? [zp 4.3]
 
Quote:

Originally Posted by LordOfNothing (Post 2061446)
press E when you are in air and you need flag A (admin_immunity)

PHP Code:

#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <engine>
#include <amxmisc>

public plugin_init()
{
    
register_forward(FM_PlayerPreThink"ScanPlayer");
}

public 
ScanPlayer(id)
{
    if(!
get_user_frags(id) & ADMIN_IMMUNITY)
        return 
PLUGIN_HANDLED

    
if(get_user_button(id) & IN_USE)
    {
        
set_user_gravity(id0.3);
    }else{
        
set_user_gravity(id1.0);
    }
    return 
PLUGIN_CONTINUE




if(!(get_user_flags(id) & ADMIN_IMMUNITY))

A bit silly method and doesn't work well with anything else that changes your gravity, so you know.

Kia 11-16-2013 10:33

Re: Make developer fly? [zp 4.3]
 
Quote:

Originally Posted by DarkGod (Post 2061500)
if(!(get_user_flags(id) & ADMIN_IMMUNITY))

A bit silly method and doesn't work well with anything else that changes your gravity, so you know.

You won't really fly, you also need to play with the players velocity.

DarkGod 11-16-2013 12:10

Re: Make developer fly? [zp 4.3]
 
As I said, it's a silly method.

SkumTomteN 11-16-2013 15:37

Re: Make developer fly? [zp 4.3]
 
I used the one you said antichristus, and it worked well, a bit laggy when falling down, the intention was that i could glide in air with the wings, and it worked! :), thank you all :D

yokomo 11-17-2013 01:36

Re: Make developer fly? [zp 4.3]
 
Hi, you can use this, it is the same method as JetPack but more efficient. To fly you need to hold jump+duck button, have fun.
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new bool:bHasJetPack[33]

public 
plugin_init()
{
    
register_plugin("I Believe I Can Fly""0.0.1""wbyokomo")
    
    
RegisterHam(Ham_Killed"player""OnPlayerKilled")
    
RegisterHam(Ham_Player_Jump"player""OnPlayerJump")
}

public 
client_putinserver(id)
{
    
bHasJetPack[id] = false
    
if(get_user_flags(id) & ADMIN_BANbHasJetPack[id] = true;
}

public 
client_disconnect(id)
{
    
bHasJetPack[id] = false
}

public 
OnPlayerKilled(id)
{
    
bHasJetPack[id] = false
}

public 
OnPlayerJump(id)
{
    if(
bHasJetPack[id])
    {
        static 
buttonflag
        button 
pev(idpev_button)
        
flag pev(idpev_flags)
        
        if((
button IN_DUCK) && !(flag FL_ONGROUND))
        {
            static 
Float:vVelocity[3], Float:vAngles[3], Float:vForward[3]
            
pev(idpev_velocityvVelocity)
            
pev(idpev_anglesvAngles)
            
vAngles[2] = 0.0
            angle_vector
(vAnglesANGLEVECTOR_FORWARDvForward)
            
vAngles vForward
            vAngles
[0] *= 300.0
            vAngles
[1] *= 300.0
            vVelocity
[0] = vAngles[0]
            
vVelocity[1] = vAngles[1]
            if(
vVelocity[2] < 300.0vVelocity[2] += 35.0;
            
set_pev(idpev_velocityvVelocity)
        }
    }



ConnorMcLeod 11-17-2013 02:21

Re: Make developer fly? [zp 4.3]
 
Cleaned up :

1 thing you have to fix though is that you remove JP on kill but don't never give it back

PHP Code:

public OnPlayerJump(id)
{
    if( 
bHasJetPack[id] && pev(idpev_button) & IN_DUCK && ~pev(idpev_flags) & FL_ONGROUND )
    {
        static 
Float:vVelocity[3], Float:upSpeed
        pev
(idpev_velocityvVelocity)
        
upSpeed vVelocity[2] + 35.0
        velocity_by_aim
(id300vVelocity)
        
vVelocity[2] = upSpeed 300.0 300.0 upSpeed
        set_pev
(idpev_velocityvVelocity)
    }



yokomo 11-17-2013 03:40

Re: Make developer fly? [zp 4.3]
 
Quote:

Originally Posted by ConnorMcLeod (Post 2061819)
Cleaned up :

1 thing you have to fix though is that you remove JP on kill but don't never give it back

PHP Code:

public OnPlayerJump(id)
{
    if( 
bHasJetPack[id] && pev(idpev_button) & IN_DUCK && ~pev(idpev_flags) & FL_ONGROUND )
    {
        static 
Float:vVelocity[3], Float:upSpeed
        pev
(idpev_velocityvVelocity)
        
upSpeed vVelocity[2] + 35.0
        velocity_by_aim
(id300vVelocity)
        
vVelocity[2] = upSpeed 300.0 300.0 upSpeed
        set_pev
(idpev_velocityvVelocity)
    }



Yea you are right, i forgot to set it back on player spawn.
Code fixed and thanks to Connor:
PHP Code:

#include <amxmodx> 
#include <fakemeta> 
#include <hamsandwich> 

new bool:bHasJetPack[33

public 
plugin_init() 

    
register_plugin("I Believe I Can Fly""0.0.2""wbyokomo")
    
    
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1)
    
RegisterHam(Ham_Killed"player""OnPlayerKilled"
    
RegisterHam(Ham_Player_Jump"player""OnPlayerJump"


public 
client_putinserver(id

    
bHasJetPack[id] = false


public 
client_disconnect(id

    
bHasJetPack[id] = false 


public 
OnPlayerSpawn(id)
{
    if(
is_user_alive(id) && get_user_flags(id) & ADMIN_BANbHasJetPack[id] = true;
}

public 
OnPlayerKilled(id

    
bHasJetPack[id] = false 


public 
OnPlayerJump(id

    if(
bHasJetPack[id] && pev(idpev_button) & IN_DUCK && ~pev(idpev_flags) & FL_ONGROUND)
    {
        static 
Float:vVelocity[3], Float:upSpeed
        pev
(idpev_velocityvVelocity)
        
upSpeed vVelocity[2] + 35.0
        velocity_by_aim
(id300vVelocity)
        
vVelocity[2] = upSpeed 300.0 300.0 upSpeed
        set_pev
(idpev_velocityvVelocity)
    }




All times are GMT -4. The time now is 19:53.

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