Raised This Month: $32 Target: $400
 8% 

Jetpack


Post New Thread Reply   
 
Thread Tools Display Modes
TFC
Member
Join Date: Jul 2010
Old 07-25-2012 , 12:47   Re: Jetpack
Reply With Quote #161

Quote:
Originally Posted by TFC View Post
if they are spy cloked it does not work. and if heavy spins his gun it trys to do jetpack.

It can do to fix it?
I use this version http://forums.alliedmods.net/showpos...&postcount=128
__________________
sry for bad english!
TFC is offline
TFC
Member
Join Date: Jul 2010
Old 07-25-2012 , 12:49   Re: Jetpack
Reply With Quote #162

edit.
__________________
sry for bad english!

Last edited by TFC; 07-25-2012 at 12:50.
TFC is offline
PresidentEvil
AlliedModders Donor
Join Date: Jun 2012
Old 07-26-2012 , 19:23   Re: Jetpack
Reply With Quote #163

can you update this with admin flags, cuz in my css surf server people are just bind the key and flying around
__________________
PresidentEvil is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 07-26-2012 , 21:35   Re: Jetpack
Reply With Quote #164

Not sure if the author will update this or not since his last response was post #8... I didn't test it, give this a shot

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.1.0a"

#define MOVETYPE_WALK            2
#define MOVETYPE_FLYGRAVITY        5
#define MOVECOLLIDE_DEFAULT        0
#define MOVECOLLIDE_FLY_BOUNCE    1

#define LIFE_ALIVE    0

// ConVars
new Handle:sm_jetpack            INVALID_HANDLE;
new 
Handle:sm_jetpack_sound        INVALID_HANDLE;
new 
Handle:sm_jetpack_speed        INVALID_HANDLE;
new 
Handle:sm_jetpack_volume    INVALID_HANDLE;

// SendProp Offsets
new g_iLifeState    = -1;
new 
g_iMoveCollide    = -1;
new 
g_iMoveType        = -1;
new 
g_iVelocity        = -1;

// Soundfile
new String:g_sSound[255]    = "vehicles/airboat/fan_blade_fullthrottle_loop1.wav";

// Is Jetpack Enabled
new bool:g_bJetpacks[MAXPLAYERS 1]    = {false,...};
new 
bool:CanUseJetpacks[MAXPLAYERS 1] = {false,...};

// Timer For GameFrame
new Float:g_fTimer    0.0;

// MaxClients
new g_iMaxClients    0;

public 
Plugin:myinfo =
{
    
name "Jetpack",
    
author "Knagg0",
    
description "",
    
version PLUGIN_VERSION,
    
url "http://www.mfzb.de"
};

public 
OnPluginStart()
{
    
AutoExecConfig();
    
    
// Create ConVars
    
CreateConVar("sm_jetpack_version"PLUGIN_VERSION""FCVAR_PLUGIN FCVAR_REPLICATED FCVAR_NOTIFY);
    
sm_jetpack CreateConVar("sm_jetpack""1"""FCVAR_PLUGIN FCVAR_REPLICATED FCVAR_NOTIFY);
    
sm_jetpack_sound CreateConVar("sm_jetpack_sound"g_sSound""FCVAR_PLUGIN);
    
sm_jetpack_speed CreateConVar("sm_jetpack_speed""100"""FCVAR_PLUGIN);
    
sm_jetpack_volume CreateConVar("sm_jetpack_volume""0.5"""FCVAR_PLUGIN);

    
// Create ConCommands
    
RegConsoleCmd("+sm_jetpack"JetpackP""FCVAR_GAMEDLL);
    
RegConsoleCmd("-sm_jetpack"JetpackM""FCVAR_GAMEDLL);
    
    
// Find SendProp Offsets
    
if((g_iLifeState FindSendPropOffs("CBasePlayer""m_lifeState")) == -1)
        
LogError("Could not find offset for CBasePlayer::m_lifeState");
        
    if((
g_iMoveCollide FindSendPropOffs("CBaseEntity""movecollide")) == -1)
        
LogError("Could not find offset for CBaseEntity::movecollide");
        
    if((
g_iMoveType FindSendPropOffs("CBaseEntity""movetype")) == -1)
        
LogError("Could not find offset for CBaseEntity::movetype");
        
    if((
g_iVelocity FindSendPropOffs("CBasePlayer""m_vecVelocity[0]")) == -1)
        
LogError("Could not find offset for CBasePlayer::m_vecVelocity[0]");
}

public 
OnMapStart()
{
    
g_fTimer 0.0;
    
g_iMaxClients GetMaxClients();
}

public 
OnConfigsExecuted()
{
    
GetConVarString(sm_jetpack_soundg_sSoundsizeof(g_sSound));
    
PrecacheSound(g_sSoundtrue);
}

public 
OnGameFrame()
{
    if(
GetConVarBool(sm_jetpack) && g_fTimer GetGameTime() - 0.075)
    {
        
g_fTimer GetGameTime();
        
        for(new 
1<= g_iMaxClientsi++)
        {
            if(
g_bJetpacks[i] && CanUseJetpacks[i])
            {
                if(!
IsAlive(i)) StopJetpack(i);
                else 
AddVelocity(iGetConVarFloat(sm_jetpack_speed));
            }
        }
    }
}

public 
OnClientPostAdminCheck(client)
{
    if (
CheckCommandAccess(client"allow_jetpack"ADMFLAG_CUSTOM1))
    {
        
CanUseJetpacks[client] = true;
    }
}

public 
OnClientDisconnect(client)
{
    if (
IsClientInGame(client))
    {
        
StopJetpack(client);
        
CanUseJetpacks[client] = false;
    }
}

public 
Action:JetpackP(clientargs)
{
    if (!
CanUseJetpacks[client])
        return 
Plugin_Continue;
    
    if(
GetConVarBool(sm_jetpack) && !g_bJetpacks[client] && IsAlive(client))
    {
        new 
Float:vecPos[3];
        
GetClientAbsOrigin(clientvecPos);
        
EmitSoundToAll(g_sSoundclientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGSGetConVarFloat(sm_jetpack_volume), SNDPITCH_NORMAL, -1vecPosNULL_VECTORtrue0.0);
        
SetMoveType(clientMOVETYPE_FLYGRAVITYMOVECOLLIDE_FLY_BOUNCE);
        
g_bJetpacks[client] = true;
    }
    
    return 
Plugin_Continue;
}

public 
Action:JetpackM(clientargs)
{
    if (!
CanUseJetpacks[client])
        return 
Plugin_Continue;
    
    
StopJetpack(client);
    return 
Plugin_Continue;
}

StopJetpack(client)
{
    if(
g_bJetpacks[client])
    {
        if(
IsAlive(client)) SetMoveType(clientMOVETYPE_WALKMOVECOLLIDE_DEFAULT);
        
StopSound(clientSNDCHAN_AUTOg_sSound);
        
g_bJetpacks[client] = false;
    }
}

SetMoveType(clientmovetypemovecollide)
{
    if(
g_iMoveType == -1) return;
    
SetEntData(clientg_iMoveTypemovetype);
    if(
g_iMoveCollide == -1) return;
    
SetEntData(clientg_iMoveCollidemovecollide);
}

AddVelocity(clientFloat:speed)
{
    if(
g_iVelocity == -1) return;
    
    new 
Float:vecVelocity[3];
    
GetEntDataVector(clientg_iVelocityvecVelocity);
    
    
vecVelocity[2] += speed;

    
TeleportEntity(clientNULL_VECTORNULL_VECTORvecVelocity);
}

bool:IsAlive(client)
{
    if(
g_iLifeState != -&& GetEntData(clientg_iLifeState1) == LIFE_ALIVE)
        return 
true;

    return 
false;

set to player must have admin flag custom1, but can be overridden with allow_jetpack
__________________
View my Plugins | Donate

Last edited by TnTSCS; 07-26-2012 at 21:36.
TnTSCS is offline
waylaidwanderer
SourceMod Donor
Join Date: Aug 2012
Old 10-18-2012 , 01:07   Re: Jetpack
Reply With Quote #165

Is it possible with this plugin to give access to just jetpack to my moderators (limited admin) but deny them access to sm_jetpack_give or sm_jetpack_take?

I have sm_jetpack_adminonly set to 1, but it seems like there's no override for making "+jetpack" for a certain flag only ("c" for example).
I know I can deny access to sm_jetpack_give/take using overrides, but then this doesn't let my mods use jetpack.

And if I set sm_jetpack_adminonly to 0, everyone can now use jetpack. As stated before, I don't know the override for the jetpack. If I could find that, it would make things so much easier.

Quote:
Originally Posted by naris View Post
I have modifed the jetpack plugin again to have variable fuel consumption depending on class (for TF2 and DoD). I also added the rockettrail effect for TF2.

So now it is:

This plugin adds a 'jetpack' which allows players to fly around the map by binding a key to +jetpack.

CVARS:
  • sm_jetpack
    • Enables/disables this plugin
    • Default: "1"
  • sm_jetpack_adminonly
    • Only allows admins to have jetpacks?
    • Default: "0"
  • sm_jetpack_team
    • team restriction (0=all use, 2 or 3 to only allowed specified team to have a jetpack
    • Default: "0"
  • sm_jetpack_onspawn
    • Give players a jetpack when they spawn?
    • Default: "1"
  • sm_jetpack_announce
    • This will enable announcements that jetpacks are available
    • Default: "0"
  • sm_jetpack_start_sound
    • Jetpack start sound file
    • Default: ""
    • TF2 Default: "weapons/flame_thrower_airblast.wav"
  • sm_jetpack_stop_sound
    • Jetpack stop sound file
    • Default: ""
    • TF2 Default: "weapons/flame_thrower_end.wav"
  • sm_jetpack_loop_sound
    • Jetpack loop sound file
    • Default: "vehicles/airboat/fan_blade_fullthrottle_loop1.wav"
    • TF2 Default: "weapons/flame_thrower_loop.wav"
  • sm_jetpack_empty_sound
    • Jetpack empty sound file
    • Default: "common/bugreporter_failed.wav"
    • TF2 Default: "weapons/syringegun_reload_air2.wav"
  • sm_jetpack_refuel_sound
    • Jetpack refuel sound file
    • Default: "hl1/fvox/activated.wav"
  • sm_jetpack_volume
    • Jetpack sound volume
    • Default: "0.5"
  • sm_jetpack_speed
    • Jetpack speed
    • Velocity.z that will be added each "jetpack frame"
    • Default: "100"
  • sm_jetpack_gravity
    • Set to 1 to have gravity affect the jetpack (MOVETYPE_FLYGRAVITY), 0 for no gravity (MOVETYPE_FLY).
    • Default: "1"
  • sm_jetpack_fuel
    • Jetpack fuel
    • Amount of fuel to start with (-1 == unlimited)
    • Default: "-1"
  • sm_jetpack_max_refuels
    • Number of times the jetpack can be refueled (-1 == unlimited)
    • Default: "-1"
  • sm_jetpack_refueling_time
    • Amount of time to wait before refueling
    • Default: "30.0"

TF2 CVARS:
  • sm_jetpack_noflag
    • Prevent TF2 flag carrier from using the jetpack?
    • Default: "1"
  • sm_jetpack_rate_scout
    • Rate at which the jetpack consumes fuel for scouts
    • Default: "1"
  • sm_jetpack_rate_sniper
    • Rate at which the jetpack consumes fuel for snipers
    • Default: "1"
  • sm_jetpack_rate_soldier
    • Rate at which the jetpack consumes fuel for soldiers
    • Default: "1"
  • sm_jetpack_rate_demo
    • Rate at which the jetpack consumes fuel for demo men
    • Default: "1"
  • sm_jetpack_rate_medic
    • Rate at which the jetpack consumes fuel for medics
    • Default: "1"
  • sm_jetpack_rate_heavy
    • Rate at which the jetpack consumes fuel for heavys
    • Default: "2"
  • sm_jetpack_rate_pyro
    • Rate at which the jetpack consumes fuel for pyros
    • Default: "1"
  • sm_jetpack_rate_spy
    • Rate at which the jetpack consumes fuel for spys
    • Default: "1"
  • sm_jetpack_rate_engineer
    • Rate at which the jetpack consumes fuel for engineers
    • Default: "1"

DOD CVARS:
  • sm_jetpack_rate_rifleman
    • Rate at which the jetpack consumes fuel for riflemen
    • Default: "1"
  • sm_jetpack_rate_assault
    • Rate at which the jetpack consumes fuel for assault
    • Default: "1"
  • sm_jetpack_rate_support
    • Rate at which the jetpack consumes fuel for support
    • Default: "1"
  • sm_jetpack_rate_sniper
    • Rate at which the jetpack consumes fuel for snipers
    • Default: "1"
  • sm_jetpack_rate_mg_type
    • Rate at which the jetpack consumes fuel for machine gunners
    • Default: "2"
  • sm_jetpack_rate_rocket
    • Rate at which the jetpack consumes fuel for rocket men
    • Default: "1"

OTHER MODS CVAR:
  • sm_jetpack_rate
    • Rate at which the jetpack consumes fuel
    • Default: "1"


Native Interface:
PHP Code:
/**
 * Assume control of the Jetpack plugin
 *
 * @param plugin_only     Set to 1 to assume complete control of the jetpack.
 * @param announce         Announce status changes to the player.
 * @return                none
 */
native ControlJetpack(bool:plugin_only=true);

/**
 * Get the jetpack indicator of the player
 *
 * @param index     Client index
 * @return            true if the player has a jetpack
 */
native bool:HasJetpack(client);

/**
 * Returns if the player's jetpack is on
 *
 * @param index     Client index
 * @return            true if the player's jetpack is on
 */
native bool:IsJetpackOn(client);

/**
 * Get the jetpack fuel amount of the player
 *
 * @param index     Client index
 * @return            amount of fuel the jetpack has
 */
native GetJetpackFuel(client);

/**
 * Get the fuel consumption rate for the jetpack of the player
 *
 * @param index     Client index
 * @return            Rate at which the jetpack consumes fuel
 */
native GetJetpackRate(client);

/**
 * Get the refueling time for the jetpack of the player
 *
 * @param index     Client index
 * @return            Refueling time for the jetpack
 */
native Float:GetJetpackRefuelingTime(client);

/**
 * Set fuel for the jetpack of the player
 *
 * @param index     Client index
 * @param fuel         Amount of fuel for the jetpack (-1 == infinate)
 * @param refuels    Number of times the jetpack can be refueled (-1 == infinate)
 * @return            none
 */
native SetJetpackFuel(clientfuel=-1refuels=-1);

/**
 * Set the fuel consumption rate for the jetpack of the player
 *
 * @param index     Client index
 * @param rate      Rate at which the jetpack consumes fuel (-1 == use class convars)
 * @return            none
 */
native SetJetpackRate(clientrate=-1);

/**
 * Set the refueling time for the jetpack of the player
 *
 * @param index     Client index
 * @param time         Refueling time for the jetpack
 * @return            none
 */
native SetJetpackRefuelingTime(clientFloat:fuel);

/**
 * Give a jetpack to the player
 *
 * @param index             Client index
 * @param fuel                 Amount of fuel for the jetpack (-1 == infinate)
 * @param refueling_time    Refueling time for the jetpack
 * @param max_refuels        Number of times the jetpack can be refueled (-1 == infinate)
 * @param rate              Rate at which the jetpack consumes fuel (per game frame)
 * @param explode           jetpack explodes on death if true
 * @param burn              jetpack burns enemies if true
 * @return                    amount of fuel the jetpack has
 */
native GiveJetpack(clientfuel=-1Float:refueling_time=0.0max_refuels=-1,
                   
rate=-1bool:explode=falsebool:burn=false);

/**
 * Take the jetpack from the player
 *
 * @param index     Client index
 * @return            none
 */
native TakeJetpack(client);

/**
 * Give jetpack fuel to the player
 *
 * @param index     Client index
 * @param fuel         Amount of fuel to add to the jetpack (-1 == infinate)
 * @param refuels    Number of refuels to add to the jetpack (-1 == infinate)
 * @return            amount of fuel the jetpack has
 */
native GiveJetpackFuel(clientfuel=-1refuels=-1);

/**
 * Take fuel from the jetpack of the player
 *
 * @param index     Client index
 * @param fuel         Amount of fuel to remove from the jetpack (-1 == all)
 * @param refuels    Number of refuels to remove from the jetpack (-1 == all)
 * @return            amount of fuel the jetpack has
 */
native TakeJetpackFuel(clientfuel=-1refuels=-1);

/**
 * Start the jetpack (bind to a keydown)
 *
 * @param index     Client index
 * @return            none
 */
native StartJetpack(client);

/**
 * Stop the jetpack (bind to a keyup)
 *
 * @param index     Client index
 * @return            none
 */
native StopJetpack(client);

/**
 * Gets called when the Jetpack is started
 *
 * @param client: The index of the client that used the jetpack.
 * @return          Plugin_Stop will prevent the jetpack from starting.
 */
forward Action:OnJetpack(client);

/**
 * Gets called when a Jetpack burns someone
 *
 * @param victim: The index of the victim to be set fire
 * @param client: The index of the client that is using the jetpack
 * @param damage: The damage to be done to the victim, can be changed.
 * @return          Plugin_Stop will prevent the jetpack from burning the victim.
 */
forward Action:OnJetpackBurn(victimclient, &damage);

/**
 * Gets called when a Jetpack explodes
 *
 * @param victim: The index of the victim of the explosion
 * @param client: The index of the client that exploded
 * @param damage: The damage to be done to the victim, can be changed.
 * @return          Plugin_Stop will prevent the jetpack from injuring the victim.
 */
forward Action:OnJetpackExplode(victimclient, &damage); 
Change log
1/3/2011 - v2.2
  • Fix refuel issues.

1/25/2011 - v2.3
  • Fixed jetpacks persisting when using convars and sm_jetpack is enabled and then disabled.
  • Fixed Fuel Rate getting set to 0, resulting in infinite fuel when using convars.
  • Fixed invalid convar handle error when a player spawns and the class isn't set (is 0) in TF2, when using convars.

6/22/2012 - v3.0
  • Added convars to allow/disallow jetpacks based on class
  • Changed jetpack to be activate by holing down JUMP (spacebar), +jetpack can still be used.
  • Added burn enemies and explode features to jetpack
  • Added burn and explode parameters to GiveJetpack()
  • Added a cookie to disable using +JUMP to activate the jetpack
  • Change GetJetpack()'s rate rate to default to -1
  • Change jetpack explode range and damage to vary depending on amount of remaining fuel.
  • Changed jetpack to create a light entity in addition to the particle effects
  • Added getref param to ztf2grabs's HasObject() native.
  • Changed jetpack to not activate if the players MoveType == MOVETYPE_NONE
  • Renamed GetJetpack() primitive to HasJetpack()
  • Added IsJetpackOn() primitive to jetpack
  • Fixed stand alone jetpack having no fuel instead of infinite fuel when sm_jetpack_fuel == -1
  • Fixed bug in jetpack when using convars to set fuel, rate and enable/disable
  • Fixed bug in jetpack when using convars to set enable/disable
  • Don't allow jetpack while taunting, dazed, cloaked, dead ringered, heavy firing or sniper zoomed.
  • Updated jetpack to use the ResourceManager
  • Changed jetpack to actually use the sm_jetpack_stop_sound
  • Added AUTO_DOWNLOAD to ResourceManger::SetupSound() to set download flag depending on if the file starts wit the name of one of the built in sound directories
  • Changed jetpack, ubershield & hgrsource to precache sounds OnConfigsExecuted().


6/26/2012 - v3.1
  • Fixed jetpack flames
  • Added OnJetpackBurn() & OnJetpackExplode() forwards
  • Added sm_jetpack_burn_range, sm_jetpack_burn_damage, sm_jetpack_explode_fuel,
  • sm_jetpack_explode_range & sm_jetpack_explode_damage convars
  • Renamed jetpack::SetMoveType() to SetMoveCollideType()
  • Changed jetpack to check SourceCraft immunities before exploding or burning enemies
  • Added damage parameter to OnJetpackBurn() & OnJetpackExplode()
  • Changed CreateFlameAttack() to call DamagePlayer() (or HurtPlayer() if available)
  • Changed jetpack to call ztf2grab::HasObject() to disallow players toting sentries and other buildings from using it.
  • Fixed Property "m_bBurning" not found errors.
waylaidwanderer is offline
Skippy
Senior Member
Join Date: Nov 2011
Old 11-11-2012 , 20:59   Re: Jetpack
Reply With Quote #166

What everyone has been wondering is how can we change so people can just toggle their jetpack by typing !jetpack.

I am having this problem. I don't want the people to be allowed to give jetpack to other people. I just want them to toggle it for themselves. I tried allowing the players to access the "sm_jetpack_give @me" and it didn't work. So can someone help everyone in need to figure out how to toggle it for just yourself and not having access to the give and take commands.
Skippy is offline
waylaidwanderer
SourceMod Donor
Join Date: Aug 2012
Old 11-12-2012 , 22:43   Re: Jetpack
Reply With Quote #167

Quote:
Originally Posted by Skippy View Post
What everyone has been wondering is how can we change so people can just toggle their jetpack by typing !jetpack.

I am having this problem. I don't want the people to be allowed to give jetpack to other people. I just want them to toggle it for themselves. I tried allowing the players to access the "sm_jetpack_give @me" and it didn't work. So can someone help everyone in need to figure out how to toggle it for just yourself and not having access to the give and take commands.
Why would you need to toggle it? Just bind +jetpack to a key you don't press a lot. If the problem is that jetpack is activated by jumping, you can type "sm_settings" to turn that off.
waylaidwanderer is offline
Skippy
Senior Member
Join Date: Nov 2011
Old 11-12-2012 , 23:32   Re: Jetpack
Reply With Quote #168

Quote:
Originally Posted by waylaidwanderer View Post
Why would you need to toggle it? Just bind +jetpack to a key you don't press a lot. If the problem is that jetpack is activated by jumping, you can type "sm_settings" to turn that off.
What? I'm talking about turning the jetpack on by yourself. Like typing !jp and the jetpack will work for you. Right now you have to type /jetpack_give <name>. I don't want to type in other names. I only want to type /jetpack and it will turn on jetpack for me.

And yes I tried changing the command of sm_jetpack_give @me to sm_jetpack and to be able to have access to the give command you will be able to give the jetpack to everyone else.
Skippy is offline
waylaidwanderer
SourceMod Donor
Join Date: Aug 2012
Old 11-13-2012 , 17:05   Re: Jetpack
Reply With Quote #169

Quote:
Originally Posted by Skippy View Post
Right now you have to type /jetpack_give <name>.
Not if you have this enabled:

Quote:
Originally Posted by naris View Post
I have modifed the jetpack plugin again to have variable fuel consumption depending on class (for TF2 and DoD). I also added the rockettrail effect for TF2.

So now it is:

This plugin adds a 'jetpack' which allows players to fly around the map by binding a key to +jetpack.

CVARS:
  • sm_jetpack_onspawn
    • Give players a jetpack when they spawn?
    • Default: "1"
Oh yeah, and you don't have to worry about accidentally triggering it either. Refer to my previous post.

Last edited by waylaidwanderer; 11-13-2012 at 17:05.
waylaidwanderer is offline
Skippy
Senior Member
Join Date: Nov 2011
Old 11-13-2012 , 19:58   Re: Jetpack
Reply With Quote #170

Quote:
Originally Posted by waylaidwanderer View Post
Not if you have this enabled:



Oh yeah, and you don't have to worry about accidentally triggering it either. Refer to my previous post.
Okay you aren't getting what I'm asking.

I want this for a donator benefit. When I give the donators access to the jetpack give command they can give it to other people too. I don't want everyone to spawn with it because then it will give it to non-donators. I want the donators to type !jetpack and it turns on the jetpack then they type !jetpack again to turn off the jetpack.
Skippy 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 23:05.


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