Raised This Month: $12 Target: $400
 3% 

Need help DoubleJump


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joez252
Member
Join Date: Apr 2019
Old 06-01-2020 , 09:03   Need help DoubleJump
Reply With Quote #1

Hello, i need add command to on and off DoubleJump...
PHP Code:
// Original Script from Peagus
// http://forums.alliedmods.net/showthread.php?p=895212

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#define PLUGIN_VERSION "1.3OPRC"

new    g_iJumps[MAXPLAYERS+1]
new    
g_iJumpMax
new    g_fLastButtons[MAXPLAYERS+1]
new    
g_fLastFlags[MAXPLAYERS+1]
new 
clientlevel[MAXPLAYERS+1]
new    
Handle:g_cvJumpBoost INVALID_HANDLE
new    Handle:g_cvJumpEnable INVALID_HANDLE
new    Handle:g_cvJumpMax INVALID_HANDLE
new Handle:g_cvJumpKnife INVALID_HANDLE
new    bool:g_bDoubleJump true
new    Float:g_flBoost    250.0

public Plugin:myinfo 
{
    
name "CS:GO Double Jump",
    
author "Darkranger,(original Script from Peagus)",
    
description "Double Jump for all Players!",
    
version PLUGIN_VERSION,
    
url "http://dark.asmodis.at"
}

public 
OnPluginStart()
{
    
CreateConVar("csgo_doublejump_version"PLUGIN_VERSION"CS:GO Double Jump Version"FCVAR_PLUGIN FCVAR_REPLICATED FCVAR_NOTIFY FCVAR_DONTRECORD)
    
g_cvJumpKnife CreateConVar("csgo_doublejump_knife""0",    "disable(0) / enable(1) double-jumping only on Knife Level for AR (GunGame)",FCVAR_PLUGINtrue0.0true1.0)
    
g_cvJumpEnable CreateConVar("csgo_doublejump_enabled""1",    "disable(0) / enable(1) double-jumping",FCVAR_PLUGIN)
    
g_cvJumpBoost CreateConVar("csgo_doublejump_boost""300.0""The amount of vertical boost to apply to double jumps",FCVAR_PLUGINtrue260.0true500.0)
    
g_cvJumpMax CreateConVar("csgo_doublejump_max""1""The maximum number of re-jumps allowed while already jumping",FCVAR_PLUGINtrue1.0true5.0)
    
AutoExecConfig(true"csgo_doublejump""csgo_doublejump")
    
    
HookConVarChange(g_cvJumpBoost,        convar_ChangeBoost)
    
HookConVarChange(g_cvJumpEnable,    convar_ChangeEnable)
    
HookConVarChange(g_cvJumpMax,        convar_ChangeMax)
    
g_bDoubleJump    GetConVarBool(g_cvJumpEnable)
    
g_flBoost        GetConVarFloat(g_cvJumpBoost)
    
g_iJumpMax        GetConVarInt(g_cvJumpMax)
    
HookEventEx("player_spawn"OnPlayerSpawnEventHookMode_Post)
}


public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_WeaponEquipPostOnWeaponEquipPost)
    
CreateTimer(20.0AnnounceclientTIMER_FLAG_NO_MAPCHANGE)
    
CreateTimer(35.0AnnounceclientTIMER_FLAG_NO_MAPCHANGE)
}

public 
OnWeaponEquipPost(clientweapon)
{
    
clientlevel[client] = 0
    
if (g_cvJumpKnife
    {
        if(
LastLevel(client) == true)
        {
            
clientlevel[client] = 1
        
}
    }    
}

public 
OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"))
    
clientlevel[client] = 0
    
if (GetConVarInt(g_cvJumpKnife) == 1)
    {
        if(
LastLevel(client) == true)
        {
            
clientlevel[client] = 1
        
}
    }    
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if (
g_bDoubleJump && HasAccess(client))
    
//if ((g_bDoubleJump) && (buttons & IN_FORWARD))
    
{
        if ((
g_cvJumpKnife) && ((clientlevel[client]) == 1)) 
        {
            
DoubleJump(client)
        }
        if (
GetConVarInt(g_cvJumpKnife) == 0)
        {
            
DoubleJump(client)
        }
    }
}


stock DoubleJump(const any:client)
{
    new 
fCurFlags GetEntityFlags(client), fCurButtons GetClientButtons(client)
    if (
g_fLastFlags[client] & FL_ONGROUND)
    {
        if (!(
fCurFlags FL_ONGROUND) && !(g_fLastButtons[client] & IN_JUMP) && fCurButtons IN_JUMP)
        {
            
OriginalJump(client)
        }
    }
    else if (
fCurFlags FL_ONGROUND)
    {
        
Landed(client)
    }
    else if (!(
g_fLastButtons[client] & IN_JUMP) && fCurButtons IN_JUMP)
    {
        
ReJump(client)
    }
    
g_fLastFlags[client]    = fCurFlags
    g_fLastButtons
[client]    = fCurButtons
}

stock OriginalJump(const any:client)
{
    
g_iJumps[client]++
}

stock Landed(const any:client)
{
    
g_iJumps[client] = 0
}

stock ReJump(const any:client)
{
    if ( 
<= g_iJumps[client] <= g_iJumpMax)
    {
        
g_iJumps[client]++
        
decl Float:vVel[3]
        
GetEntPropVector(clientProp_Data"m_vecVelocity"vVel)
        
vVel[2] = g_flBoost
        TeleportEntity
(clientNULL_VECTORNULL_VECTORvVel)
    }
}

public 
convar_ChangeBoost(Handle:convar, const String:oldVal[], const String:newVal[])
{
    
g_flBoost StringToFloat(newVal)
}

public 
convar_ChangeEnable(Handle:convar, const String:oldVal[], const String:newVal[])
{
    if (
StringToInt(newVal) >= 1)
    {
        
g_bDoubleJump true
    
}
    else
    {
        
g_bDoubleJump false
    
}
}

public 
convar_ChangeMax(Handle:convar, const String:oldVal[], const String:newVal[])
{
    
g_iJumpMax StringToInt(newVal)
}

public 
bool:LastLevel(client)
{
        if(
IsValidClient(client) && IsPlayerAlive(client))
        {
                new 
weapon_count 0
                
for(new 0<= 4i++)
                {
                        new 
wpn GetPlayerWeaponSlot(clienti)
                        if(
wpn != -1)
                        {
                                
weapon_count++
                        }
                }
                if(
weapon_count == 1)
                {
                        
// hat nur das Messer!
                        
return true
                
}
                else
                {
                        
// noch weitere Waffen!
                        
return false
                
}
        }
        return 
false
}
 
public 
bool:IsValidClient(client)
{
        if ( !( 
<= client <= MaxClients ) || !IsClientInGame(client) )
        {
                return 
false
        
}
        return 
true
}

public 
Action:Announce(Handle:timerany:client)
{
    if (
GetConVarInt(g_cvJumpKnife) == 1)
    {
        if(
IsClientInGame(client) && !IsFakeClient(client))
        
PrintToChat(client"Double Jump on Knife Level is Enabled!")
    }
    if (
GetConVarInt(g_cvJumpKnife) == 0)
    {
        if(
IsClientInGame(client) && !IsFakeClient(client))
        
PrintToChat(client"[BTG]")
    }
    return 
Plugin_Handled
}

stock bool:HasAccess(client)
{
    if(
CheckCommandAccess(client"sm_vip"0false))
    {
        return 
true;
    }
    return 
false;

joez252 is offline
Cruze
Veteran Member
Join Date: May 2017
Old 06-14-2020 , 02:07   Re: Need help DoubleJump
Reply With Quote #2

Player can toggle their double jump ability by typing !doublejump.

If you want to toggle double jump for all players : sm_rcon "csgo_doublejump_enabled" 0/1
PHP Code:
// Original Script from Peagus
// http://forums.alliedmods.net/showthread.php?p=895212

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#define PLUGIN_VERSION "1.31OPRC"

new    g_iJumps[MAXPLAYERS+1]
new    
g_iJumpMax
new    g_fLastButtons[MAXPLAYERS+1]
new    
g_fLastFlags[MAXPLAYERS+1]
new 
clientlevel[MAXPLAYERS+1]
new    
Handle:g_cvJumpBoost INVALID_HANDLE
new    Handle:g_cvJumpEnable INVALID_HANDLE
new    Handle:g_cvJumpMax INVALID_HANDLE
new Handle:g_cvJumpKnife INVALID_HANDLE
new    bool:g_bDoubleJump true
new    Float:g_flBoost    250.0
new bool:g_bDB[MAXPLAYERS+1] = {true, ...};

public 
Plugin:myinfo 
{
    
name "CS:GO Double Jump",
    
author "Darkranger,(original Script from Peagus)",
    
description "Double Jump for all Players!",
    
version PLUGIN_VERSION,
    
url "http://dark.asmodis.at"
}

public 
OnPluginStart()
{
    
CreateConVar("csgo_doublejump_version"PLUGIN_VERSION"CS:GO Double Jump Version"FCVAR_PLUGIN FCVAR_REPLICATED FCVAR_NOTIFY FCVAR_DONTRECORD)
    
g_cvJumpKnife CreateConVar("csgo_doublejump_knife""0",    "disable(0) / enable(1) double-jumping only on Knife Level for AR (GunGame)",FCVAR_PLUGINtrue0.0true1.0)
    
g_cvJumpEnable CreateConVar("csgo_doublejump_enabled""1",    "disable(0) / enable(1) double-jumping",FCVAR_PLUGIN)
    
g_cvJumpBoost CreateConVar("csgo_doublejump_boost""300.0""The amount of vertical boost to apply to double jumps",FCVAR_PLUGINtrue260.0true500.0)
    
g_cvJumpMax CreateConVar("csgo_doublejump_max""1""The maximum number of re-jumps allowed while already jumping",FCVAR_PLUGINtrue1.0true5.0)
    
AutoExecConfig(true"csgo_doublejump""csgo_doublejump")
    
    
HookConVarChange(g_cvJumpBoost,        convar_ChangeBoost)
    
HookConVarChange(g_cvJumpEnable,    convar_ChangeEnable)
    
HookConVarChange(g_cvJumpMax,        convar_ChangeMax)
    
g_bDoubleJump    GetConVarBool(g_cvJumpEnable)
    
g_flBoost        GetConVarFloat(g_cvJumpBoost)
    
g_iJumpMax        GetConVarInt(g_cvJumpMax)
    
HookEventEx("player_spawn"OnPlayerSpawnEventHookMode_Post)
    
RegConsoleCmd("sm_doublejump"Command_DB"Toggle double jump");
}

public 
Action:Command_DB(clientargs)
{
    if(!
g_bDoubleJump || !HasAccess(client))
    {
        return 
Plugin_Handled;
    }
    
g_bDB[client] = !g_bDB[client];
    
PrintToChat(client"You have %s double jump."g_bDB[client] == ? "enabled":"disabled");
    return 
Plugin_Handled;
}

public 
OnMapStart()
{
      for(new 
0MaxClientsi++)
          
g_bDB[i] = true;
}


public 
OnClientPutInServer(client)
{
    
g_bDB[client] = true;
    
SDKHook(clientSDKHook_WeaponEquipPostOnWeaponEquipPost)
    
CreateTimer(20.0AnnounceclientTIMER_FLAG_NO_MAPCHANGE)
    
CreateTimer(35.0AnnounceclientTIMER_FLAG_NO_MAPCHANGE)
}

public 
OnWeaponEquipPost(clientweapon)
{
    
clientlevel[client] = 0
    
if (g_cvJumpKnife
    {
        if(
LastLevel(client) == true)
        {
            
clientlevel[client] = 1
        
}
    }    
}

public 
OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"))
    
clientlevel[client] = 0
    
if (GetConVarInt(g_cvJumpKnife) == 1)
    {
        if(
LastLevel(client) == true)
        {
            
clientlevel[client] = 1
        
}
    }    
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if (
g_bDoubleJump && HasAccess(client) && g_bDB[client])
    
//if ((g_bDoubleJump) && (buttons & IN_FORWARD))
    
{
        if ((
g_cvJumpKnife) && ((clientlevel[client]) == 1)) 
        {
            
DoubleJump(client)
        }
        if (
GetConVarInt(g_cvJumpKnife) == 0)
        {
            
DoubleJump(client)
        }
    }
}


stock DoubleJump(const any:client)
{
    new 
fCurFlags GetEntityFlags(client), fCurButtons GetClientButtons(client)
    if (
g_fLastFlags[client] & FL_ONGROUND)
    {
        if (!(
fCurFlags FL_ONGROUND) && !(g_fLastButtons[client] & IN_JUMP) && fCurButtons IN_JUMP)
        {
            
OriginalJump(client)
        }
    }
    else if (
fCurFlags FL_ONGROUND)
    {
        
Landed(client)
    }
    else if (!(
g_fLastButtons[client] & IN_JUMP) && fCurButtons IN_JUMP)
    {
        
ReJump(client)
    }
    
g_fLastFlags[client]    = fCurFlags
    g_fLastButtons
[client]    = fCurButtons
}

stock OriginalJump(const any:client)
{
    
g_iJumps[client]++
}

stock Landed(const any:client)
{
    
g_iJumps[client] = 0
}

stock ReJump(const any:client)
{
    if ( 
<= g_iJumps[client] <= g_iJumpMax)
    {
        
g_iJumps[client]++
        
decl Float:vVel[3]
        
GetEntPropVector(clientProp_Data"m_vecVelocity"vVel)
        
vVel[2] = g_flBoost
        TeleportEntity
(clientNULL_VECTORNULL_VECTORvVel)
    }
}

public 
convar_ChangeBoost(Handle:convar, const String:oldVal[], const String:newVal[])
{
    
g_flBoost StringToFloat(newVal)
}

public 
convar_ChangeEnable(Handle:convar, const String:oldVal[], const String:newVal[])
{
    if (
StringToInt(newVal) >= 1)
    {
        
g_bDoubleJump true
    
}
    else
    {
        
g_bDoubleJump false
    
}
}

public 
convar_ChangeMax(Handle:convar, const String:oldVal[], const String:newVal[])
{
    
g_iJumpMax StringToInt(newVal)
}

public 
bool:LastLevel(client)
{
        if(
IsValidClient(client) && IsPlayerAlive(client))
        {
                new 
weapon_count 0
                
for(new 0<= 4i++)
                {
                        new 
wpn GetPlayerWeaponSlot(clienti)
                        if(
wpn != -1)
                        {
                                
weapon_count++
                        }
                }
                if(
weapon_count == 1)
                {
                        
// hat nur das Messer!
                        
return true
                
}
                else
                {
                        
// noch weitere Waffen!
                        
return false
                
}
        }
        return 
false
}
 
public 
bool:IsValidClient(client)
{
        if ( !( 
<= client <= MaxClients ) || !IsClientInGame(client) )
        {
                return 
false
        
}
        return 
true
}

public 
Action:Announce(Handle:timerany:client)
{
    if (
GetConVarInt(g_cvJumpKnife) == 1)
    {
        if(
IsClientInGame(client) && !IsFakeClient(client))
        
PrintToChat(client"Double Jump on Knife Level is Enabled!")
    }
    if (
GetConVarInt(g_cvJumpKnife) == 0)
    {
        if(
IsClientInGame(client) && !IsFakeClient(client))
        
PrintToChat(client"[BTG]")
    }
    return 
Plugin_Handled
}

stock bool:HasAccess(client)
{
    if(
CheckCommandAccess(client"sm_vip"0false))
    {
        return 
true;
    }
    return 
false;

__________________
Taking paid private requests! Contact me

Last edited by Cruze; 06-14-2020 at 02:15. Reason: Some details
Cruze is offline
WinCher58
Junior Member
Join Date: Nov 2020
Old 01-25-2021 , 15:15   Re: Need help DoubleJump
Reply With Quote #3

Quote:
Originally Posted by Cruze View Post
Player can toggle their double jump ability by typing !doublejump.

If you want to toggle double jump for all players : sm_rcon "csgo_doublejump_enabled" 0/1
PHP Code:
// Original Script from Peagus
// http://forums.alliedmods.net/showthread.php?p=895212

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#define PLUGIN_VERSION "1.31OPRC"

new    g_iJumps[MAXPLAYERS+1]
new    
g_iJumpMax
new    g_fLastButtons[MAXPLAYERS+1]
new    
g_fLastFlags[MAXPLAYERS+1]
new 
clientlevel[MAXPLAYERS+1]
new    
Handle:g_cvJumpBoost INVALID_HANDLE
new    Handle:g_cvJumpEnable INVALID_HANDLE
new    Handle:g_cvJumpMax INVALID_HANDLE
new Handle:g_cvJumpKnife INVALID_HANDLE
new    bool:g_bDoubleJump true
new    Float:g_flBoost    250.0
new bool:g_bDB[MAXPLAYERS+1] = {true, ...};

public 
Plugin:myinfo 
{
    
name "CS:GO Double Jump",
    
author "Darkranger,(original Script from Peagus)",
    
description "Double Jump for all Players!",
    
version PLUGIN_VERSION,
    
url "http://dark.asmodis.at"
}

public 
OnPluginStart()
{
    
CreateConVar("csgo_doublejump_version"PLUGIN_VERSION"CS:GO Double Jump Version"FCVAR_PLUGIN FCVAR_REPLICATED FCVAR_NOTIFY FCVAR_DONTRECORD)
    
g_cvJumpKnife CreateConVar("csgo_doublejump_knife""0",    "disable(0) / enable(1) double-jumping only on Knife Level for AR (GunGame)",FCVAR_PLUGINtrue0.0true1.0)
    
g_cvJumpEnable CreateConVar("csgo_doublejump_enabled""1",    "disable(0) / enable(1) double-jumping",FCVAR_PLUGIN)
    
g_cvJumpBoost CreateConVar("csgo_doublejump_boost""300.0""The amount of vertical boost to apply to double jumps",FCVAR_PLUGINtrue260.0true500.0)
    
g_cvJumpMax CreateConVar("csgo_doublejump_max""1""The maximum number of re-jumps allowed while already jumping",FCVAR_PLUGINtrue1.0true5.0)
    
AutoExecConfig(true"csgo_doublejump""csgo_doublejump")
    
    
HookConVarChange(g_cvJumpBoost,        convar_ChangeBoost)
    
HookConVarChange(g_cvJumpEnable,    convar_ChangeEnable)
    
HookConVarChange(g_cvJumpMax,        convar_ChangeMax)
    
g_bDoubleJump    GetConVarBool(g_cvJumpEnable)
    
g_flBoost        GetConVarFloat(g_cvJumpBoost)
    
g_iJumpMax        GetConVarInt(g_cvJumpMax)
    
HookEventEx("player_spawn"OnPlayerSpawnEventHookMode_Post)
    
RegConsoleCmd("sm_doublejump"Command_DB"Toggle double jump");
}

public 
Action:Command_DB(clientargs)
{
    if(!
g_bDoubleJump || !HasAccess(client))
    {
        return 
Plugin_Handled;
    }
    
g_bDB[client] = !g_bDB[client];
    
PrintToChat(client"You have %s double jump."g_bDB[client] == ? "enabled":"disabled");
    return 
Plugin_Handled;
}

public 
OnMapStart()
{
      for(new 
0MaxClientsi++)
          
g_bDB[i] = true;
}


public 
OnClientPutInServer(client)
{
    
g_bDB[client] = true;
    
SDKHook(clientSDKHook_WeaponEquipPostOnWeaponEquipPost)
    
CreateTimer(20.0AnnounceclientTIMER_FLAG_NO_MAPCHANGE)
    
CreateTimer(35.0AnnounceclientTIMER_FLAG_NO_MAPCHANGE)
}

public 
OnWeaponEquipPost(clientweapon)
{
    
clientlevel[client] = 0
    
if (g_cvJumpKnife
    {
        if(
LastLevel(client) == true)
        {
            
clientlevel[client] = 1
        
}
    }    
}

public 
OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"))
    
clientlevel[client] = 0
    
if (GetConVarInt(g_cvJumpKnife) == 1)
    {
        if(
LastLevel(client) == true)
        {
            
clientlevel[client] = 1
        
}
    }    
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if (
g_bDoubleJump && HasAccess(client) && g_bDB[client])
    
//if ((g_bDoubleJump) && (buttons & IN_FORWARD))
    
{
        if ((
g_cvJumpKnife) && ((clientlevel[client]) == 1)) 
        {
            
DoubleJump(client)
        }
        if (
GetConVarInt(g_cvJumpKnife) == 0)
        {
            
DoubleJump(client)
        }
    }
}


stock DoubleJump(const any:client)
{
    new 
fCurFlags GetEntityFlags(client), fCurButtons GetClientButtons(client)
    if (
g_fLastFlags[client] & FL_ONGROUND)
    {
        if (!(
fCurFlags FL_ONGROUND) && !(g_fLastButtons[client] & IN_JUMP) && fCurButtons IN_JUMP)
        {
            
OriginalJump(client)
        }
    }
    else if (
fCurFlags FL_ONGROUND)
    {
        
Landed(client)
    }
    else if (!(
g_fLastButtons[client] & IN_JUMP) && fCurButtons IN_JUMP)
    {
        
ReJump(client)
    }
    
g_fLastFlags[client]    = fCurFlags
    g_fLastButtons
[client]    = fCurButtons
}

stock OriginalJump(const any:client)
{
    
g_iJumps[client]++
}

stock Landed(const any:client)
{
    
g_iJumps[client] = 0
}

stock ReJump(const any:client)
{
    if ( 
<= g_iJumps[client] <= g_iJumpMax)
    {
        
g_iJumps[client]++
        
decl Float:vVel[3]
        
GetEntPropVector(clientProp_Data"m_vecVelocity"vVel)
        
vVel[2] = g_flBoost
        TeleportEntity
(clientNULL_VECTORNULL_VECTORvVel)
    }
}

public 
convar_ChangeBoost(Handle:convar, const String:oldVal[], const String:newVal[])
{
    
g_flBoost StringToFloat(newVal)
}

public 
convar_ChangeEnable(Handle:convar, const String:oldVal[], const String:newVal[])
{
    if (
StringToInt(newVal) >= 1)
    {
        
g_bDoubleJump true
    
}
    else
    {
        
g_bDoubleJump false
    
}
}

public 
convar_ChangeMax(Handle:convar, const String:oldVal[], const String:newVal[])
{
    
g_iJumpMax StringToInt(newVal)
}

public 
bool:LastLevel(client)
{
        if(
IsValidClient(client) && IsPlayerAlive(client))
        {
                new 
weapon_count 0
                
for(new 0<= 4i++)
                {
                        new 
wpn GetPlayerWeaponSlot(clienti)
                        if(
wpn != -1)
                        {
                                
weapon_count++
                        }
                }
                if(
weapon_count == 1)
                {
                        
// hat nur das Messer!
                        
return true
                
}
                else
                {
                        
// noch weitere Waffen!
                        
return false
                
}
        }
        return 
false
}
 
public 
bool:IsValidClient(client)
{
        if ( !( 
<= client <= MaxClients ) || !IsClientInGame(client) )
        {
                return 
false
        
}
        return 
true
}

public 
Action:Announce(Handle:timerany:client)
{
    if (
GetConVarInt(g_cvJumpKnife) == 1)
    {
        if(
IsClientInGame(client) && !IsFakeClient(client))
        
PrintToChat(client"Double Jump on Knife Level is Enabled!")
    }
    if (
GetConVarInt(g_cvJumpKnife) == 0)
    {
        if(
IsClientInGame(client) && !IsFakeClient(client))
        
PrintToChat(client"[BTG]")
    }
    return 
Plugin_Handled
}

stock bool:HasAccess(client)
{
    if(
CheckCommandAccess(client"sm_vip"0false))
    {
        return 
true;
    }
    return 
false;

default double bounce is on, can we turn it off?
WinCher58 is offline
Cruze
Veteran Member
Join Date: May 2017
Old 02-01-2021 , 12:00   Re: Need help DoubleJump
Reply With Quote #4

PHP Code:
// http://forums.alliedmods.net/showthread.php?p=895212

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#define PLUGIN_VERSION "1.31OPRC"

new    g_iJumps[MAXPLAYERS+1]
new    
g_iJumpMax
new    g_fLastButtons[MAXPLAYERS+1]
new    
g_fLastFlags[MAXPLAYERS+1]
new 
clientlevel[MAXPLAYERS+1]
new    
Handle:g_cvJumpBoost INVALID_HANDLE
new    Handle:g_cvJumpEnable INVALID_HANDLE
new    Handle:g_cvJumpMax INVALID_HANDLE
new Handle:g_cvJumpKnife INVALID_HANDLE
new    bool:g_bDoubleJump true
new    Float:g_flBoost    250.0
new bool:g_bDB[MAXPLAYERS+1] = {false, ...};

public 
Plugin:myinfo 
{
    
name "CS:GO Double Jump",
    
author "Darkranger,(original Script from Peagus)",
    
description "Double Jump for all Players!",
    
version PLUGIN_VERSION,
    
url "http://dark.asmodis.at"
}

public 
OnPluginStart()
{
    
CreateConVar("csgo_doublejump_version"PLUGIN_VERSION"CS:GO Double Jump Version"FCVAR_PLUGIN FCVAR_REPLICATED FCVAR_NOTIFY FCVAR_DONTRECORD)
    
g_cvJumpKnife CreateConVar("csgo_doublejump_knife""0",    "disable(0) / enable(1) double-jumping only on Knife Level for AR (GunGame)",FCVAR_PLUGINtrue0.0true1.0)
    
g_cvJumpEnable CreateConVar("csgo_doublejump_enabled""1",    "disable(0) / enable(1) double-jumping",FCVAR_PLUGIN)
    
g_cvJumpBoost CreateConVar("csgo_doublejump_boost""300.0""The amount of vertical boost to apply to double jumps",FCVAR_PLUGINtrue260.0true500.0)
    
g_cvJumpMax CreateConVar("csgo_doublejump_max""1""The maximum number of re-jumps allowed while already jumping",FCVAR_PLUGINtrue1.0true5.0)
    
AutoExecConfig(true"csgo_doublejump""csgo_doublejump")
    
    
HookConVarChange(g_cvJumpBoost,        convar_ChangeBoost)
    
HookConVarChange(g_cvJumpEnable,    convar_ChangeEnable)
    
HookConVarChange(g_cvJumpMax,        convar_ChangeMax)
    
g_bDoubleJump    GetConVarBool(g_cvJumpEnable)
    
g_flBoost        GetConVarFloat(g_cvJumpBoost)
    
g_iJumpMax        GetConVarInt(g_cvJumpMax)
    
HookEventEx("player_spawn"OnPlayerSpawnEventHookMode_Post)
    
RegConsoleCmd("sm_doublejump"Command_DB"Toggle double jump");
}

public 
Action:Command_DB(clientargs)
{
    if(!
g_bDoubleJump || !HasAccess(client))
    {
        return 
Plugin_Handled;
    }
    
g_bDB[client] = !g_bDB[client];
    
PrintToChat(client"You have %s double jump."g_bDB[client] == ? "enabled":"disabled");
    return 
Plugin_Handled;
}

public 
OnMapStart()
{
      for(new 
0MaxClientsi++)
          
g_bDB[i] = false;
}


public 
OnClientPutInServer(client)
{
    
g_bDB[client] = false;
    
SDKHook(clientSDKHook_WeaponEquipPostOnWeaponEquipPost)
    
CreateTimer(20.0AnnounceclientTIMER_FLAG_NO_MAPCHANGE)
    
CreateTimer(35.0AnnounceclientTIMER_FLAG_NO_MAPCHANGE)
}

public 
OnWeaponEquipPost(clientweapon)
{
    
clientlevel[client] = 0
    
if (g_cvJumpKnife
    {
        if(
LastLevel(client) == true)
        {
            
clientlevel[client] = 1
        
}
    }    
}

public 
OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"))
    
clientlevel[client] = 0
    
if (GetConVarInt(g_cvJumpKnife) == 1)
    {
        if(
LastLevel(client) == true)
        {
            
clientlevel[client] = 1
        
}
    }    
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if (
g_bDoubleJump && HasAccess(client) && g_bDB[client])
    
//if ((g_bDoubleJump) && (buttons & IN_FORWARD))
    
{
        if ((
g_cvJumpKnife) && ((clientlevel[client]) == 1)) 
        {
            
DoubleJump(client)
        }
        if (
GetConVarInt(g_cvJumpKnife) == 0)
        {
            
DoubleJump(client)
        }
    }
}


stock DoubleJump(const any:client)
{
    new 
fCurFlags GetEntityFlags(client), fCurButtons GetClientButtons(client)
    if (
g_fLastFlags[client] & FL_ONGROUND)
    {
        if (!(
fCurFlags FL_ONGROUND) && !(g_fLastButtons[client] & IN_JUMP) && fCurButtons IN_JUMP)
        {
            
OriginalJump(client)
        }
    }
    else if (
fCurFlags FL_ONGROUND)
    {
        
Landed(client)
    }
    else if (!(
g_fLastButtons[client] & IN_JUMP) && fCurButtons IN_JUMP)
    {
        
ReJump(client)
    }
    
g_fLastFlags[client]    = fCurFlags
    g_fLastButtons
[client]    = fCurButtons
}

stock OriginalJump(const any:client)
{
    
g_iJumps[client]++
}

stock Landed(const any:client)
{
    
g_iJumps[client] = 0
}

stock ReJump(const any:client)
{
    if ( 
<= g_iJumps[client] <= g_iJumpMax)
    {
        
g_iJumps[client]++
        
decl Float:vVel[3]
        
GetEntPropVector(clientProp_Data"m_vecVelocity"vVel)
        
vVel[2] = g_flBoost
        TeleportEntity
(clientNULL_VECTORNULL_VECTORvVel)
    }
}

public 
convar_ChangeBoost(Handle:convar, const String:oldVal[], const String:newVal[])
{
    
g_flBoost StringToFloat(newVal)
}

public 
convar_ChangeEnable(Handle:convar, const String:oldVal[], const String:newVal[])
{
    if (
StringToInt(newVal) >= 1)
    {
        
g_bDoubleJump true
    
}
    else
    {
        
g_bDoubleJump false
    
}
}

public 
convar_ChangeMax(Handle:convar, const String:oldVal[], const String:newVal[])
{
    
g_iJumpMax StringToInt(newVal)
}

public 
bool:LastLevel(client)
{
        if(
IsValidClient(client) && IsPlayerAlive(client))
        {
                new 
weapon_count 0
                
for(new 0<= 4i++)
                {
                        new 
wpn GetPlayerWeaponSlot(clienti)
                        if(
wpn != -1)
                        {
                                
weapon_count++
                        }
                }
                if(
weapon_count == 1)
                {
                        
// hat nur das Messer!
                        
return true
                
}
                else
                {
                        
// noch weitere Waffen!
                        
return false
                
}
        }
        return 
false
}
 
public 
bool:IsValidClient(client)
{
        if ( !( 
<= client <= MaxClients ) || !IsClientInGame(client) )
        {
                return 
false
        
}
        return 
true
}

public 
Action:Announce(Handle:timerany:client)
{
    if (
GetConVarInt(g_cvJumpKnife) == 1)
    {
        if(
IsClientInGame(client) && !IsFakeClient(client))
        
PrintToChat(client"Double Jump on Knife Level is Enabled!")
    }
    if (
GetConVarInt(g_cvJumpKnife) == 0)
    {
        if(
IsClientInGame(client) && !IsFakeClient(client))
        
PrintToChat(client"[BTG]")
    }
    return 
Plugin_Handled
}

stock bool:HasAccess(client)
{
    if(
CheckCommandAccess(client"sm_vip"0false))
    {
        return 
true;
    }
    return 
false;

__________________
Taking paid private requests! Contact me
Cruze is offline
loko15
Junior Member
Join Date: Oct 2020
Old 02-02-2021 , 06:19   Re: Need help DoubleJump
Reply With Quote #5

I cant compile this
loko15 is offline
Reply


Thread Tools
Display Modes

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 18:40.


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