AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved fly plugin help (https://forums.alliedmods.net/showthread.php?t=345348)

vres 01-06-2024 11:24

fly plugin help
 
Can you edit this code? It should function like a hook plugin, for example, with a command like bind c +fly

And if it's not too much trouble for you, could you also add amx_givefly and amx_takefly features? The fly ability given to the player should be permanent and should not be removed when they leave the server.

thank you

Code:

public client_PreThink(id) 
{

    if( is_user_alive(id) )
    {
        new Float:fAim[3]
        VelocityByAim(id , 500, fAim)
       
        if( !(get_user_button(id) & IN_JUMP) )
            set_user_velocity(id, fAim)
    }
    return PLUGIN_CONTINUE
}


Uzviseni Bog 01-06-2024 14:05

Re: fly plugin help
 
Buddy, no one will help you if you don't properly leave the entire code, not just a part of it, I believe you are not the author of that code, if you were, you would know how to solve it. Once again, post the entire code.

vres 01-06-2024 15:31

Re: fly plugin help
 
Quote:

Originally Posted by Uzviseni Bog (Post 2815673)
Buddy, no one will help you if you don't properly leave the entire code, not just a part of it, I believe you are not the author of that code, if you were, you would know how to solve it. Once again, post the entire code.

this is everything

Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "me"


public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
       
}

public client_PreThink(id) 
{

    if( is_user_alive(id) )
    {
        new Float:fAim[3]
        VelocityByAim(id , 500, fAim)
       
        if( !(get_user_button(id) & IN_JUMP) )
            set_user_velocity(id, fAim)
    }
    return PLUGIN_CONTINUE
}

It already works like this

Uzviseni Bog 01-06-2024 15:43

Re: fly plugin help
 
Quote:

Originally Posted by vres (Post 2815681)
this is everything

Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "me"


public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
       
}

public client_PreThink(id) 
{

    if( is_user_alive(id) )
    {
        new Float:fAim[3]
        VelocityByAim(id , 500, fAim)
       
        if( !(get_user_button(id) & IN_JUMP) )
            set_user_velocity(id, fAim)
    }
    return PLUGIN_CONTINUE
}

It already works like this



What do you actually want? Do you want a hook that will be bound with the command 'bind c +fly' instead of 'bind c +hook', and to be given to certain players through a command?

vres 01-06-2024 16:11

Re: fly plugin help
 
Quote:

Originally Posted by Uzviseni Bog (Post 2815683)
What do you actually want? Do you want a hook that will be bound with the command 'bind c +fly' instead of 'bind c +hook', and to be given to certain players through a command?

If you've tried this code, you can see that the player can fly. I want it to work like a hook plugin, meaning it should activate with a command like +fly when the 'c' key is pressed, and the code should stop running when the 'c' key is released. In essence, I want it to function as a hook plugin with +fly and -fly commands.

Additionally, I want to be able to give and take this flying ability permanently to/from a player using the amx_givefly and amx_takefly commands. Even if the player logs out and logs back in, they should still have this ability, as it is stored as a permanent feature for that specific player.

sample hook plugin

https://forums.alliedmods.net/showthread.php?t=52304

fysiks 01-06-2024 19:13

Re: fly plugin help
 
If you want it to work like that plugin, you simply need to look at how that plugin does what you want it to do. This is the Scripting Help forum meaning that you are the one writing the plugin. You have all you need in the Hook plugin to implement the +command feature that you're asking for.

Try using the hook plugin as a basis and create your own plugin for your feature. If you run into a specific issue, post your latest version of the code with a specific question. It should be quite simple actually. If your code above works as you want functionally, simply replace the button check with a boolean check that gets set by the +/- commands.

Regarding the "permanent access", that's a whole different thing. You can find other plugins that save things like this (e.g. using nVault). So, after you get the main plugin functions working, start working on this part and post a new thread if you have specific issues.

Natsheh 01-07-2024 16:26

Re: fly plugin help
 
This request already exist instead its phrased as "jetpack" its an item you can use to fly.

vres 01-07-2024 20:06

Re: SOLVED plugin help
 
I finally managed to do it and it works very well, thank you for your answers.


All times are GMT -4. The time now is 00:33.

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