Raised This Month: $ Target: $400
 0% 

View Poll Results: How stupid am I for not solving this?
Very 8 100.00%
Slightly 0 0%
Voters: 8. You may not vote on this poll

Plugin doesn't even start because of "jump" not being a game event. Help?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ClassicHopper
Junior Member
Join Date: Jul 2017
Old 07-20-2017 , 10:39   Plugin doesn't even start because of "jump" not being a game event. Help?
Reply With Quote #1

Code:
[SM] Exception reported: Game event "jump" does not exist
I get this when I try to use a plugin I downloaded, called anti-bunny-hop.
Source code:
Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.0.1"

new Handle:cvar_ratio_threshold = INVALID_HANDLE;
new Handle:cvar_ratio_punish = INVALID_HANDLE;

public Plugin:myinfo = {
	name = "Anti Bunny Hop",
	author = "Mister_Magotchi",
	description = "Limits player jump speed based on weapon-specific maximum ground speed with configurable speed punishment.",
	version = PLUGIN_VERSION,
	url = ""
};

public OnPluginStart() {
  CreateConVar(
    "sm_anti_bunny_hop_version",
    PLUGIN_VERSION,
    "Anti Bunny Hop version",
    FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD
  );
  cvar_ratio_threshold = CreateConVar(
    "sm_anti_bunny_hop_ratio_threshold",
    "1.05",
    "Ratio of [air speed .1 seconds into jump] over [weapon-specific maximum ground speed] at which punishment should happen.  1.45 or greater seems safe.  0 disables plugin.",
    FCVAR_PLUGIN
  );
  cvar_ratio_punish = CreateConVar(
    "sm_anti_bunny_hop_ratio_punish",
    "-0.5",
    "Ratio of [speed after punishment] over [weapon-specific maximum ground speed].  Anything under 1.5 makes sense.  Setting equal to threshold limits speed to threshold without any punishment.",
    FCVAR_PLUGIN
  );
  HookEvent("jump", OnPlayerJump);
  AutoExecConfig(true, "anti-bunny-hop");
}

public OnPlayerJump(Handle:event, const String:name[], bool:dontBroadcast) {
  if (GetConVarBool(cvar_ratio_threshold)) {
    CreateTimer(0.1, ManageJumpSpeed, GetClientOfUserId(GetEventInt(event, "userid")));
  }
}

public Action:ManageJumpSpeed(Handle:timer, any:client) {
  new Float:velocity[3];
  GetEntPropVector(client, Prop_Data, "m_vecVelocity", velocity);
  new Float:max_ground_speed = GetEntPropFloat(client, Prop_Data, "m_flMaxspeed");
  if (FloatCompare(210.0, max_ground_speed) == 1) {
    max_ground_speed = 210.0;
  }
  new Float:ratio_max_to_current_speed = FloatDiv(max_ground_speed, GetVectorLength(velocity));
  //PrintToChat(client, "Threshold: %f - Current Speed Ratio: %f - Max Speed: %f - Current Speed: %f", GetConVarFloat(cvar_ratio_threshold), FloatDiv(1.0, ratio_max_to_current_speed), max_ground_speed, GetVectorLength(velocity)); //Ratio Test
  if (ratio_max_to_current_speed < FloatDiv(1.0, GetConVarFloat(cvar_ratio_threshold))) {
    ScaleVector(velocity, FloatMul(ratio_max_to_current_speed, GetConVarFloat(cvar_ratio_punish)));
    TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity);
  }
}
The part that keeps the plugin from running is in this "paragraph" of code
Code:
public OnPluginStart() {
  CreateConVar(
    "sm_anti_bunny_hop_version",
    PLUGIN_VERSION,
    "Anti Bunny Hop version",
    FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD
  );
  cvar_ratio_threshold = CreateConVar(
    "sm_anti_bunny_hop_ratio_threshold",
    "1.05",
    "Ratio of [air speed .1 seconds into jump] over [weapon-specific maximum ground speed] at which punishment should happen.  1.45 or greater seems safe.  0 disables plugin.",
    FCVAR_PLUGIN
  );
  cvar_ratio_punish = CreateConVar(
    "sm_anti_bunny_hop_ratio_punish",
    "-0.5",
    "Ratio of [speed after punishment] over [weapon-specific maximum ground speed].  Anything under 1.5 makes sense.  Setting equal to threshold limits speed to threshold without any punishment.",
    FCVAR_PLUGIN
  );
  HookEvent("jump", OnPlayerJump);
  AutoExecConfig(true, "anti-bunny-hop");
}
ClassicHopper is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 07-20-2017 , 10:44   Re: Plugin doesn't even start because of "jump" not being a game event. Help?
Reply With Quote #2

post in sourcemod forum not here...
__________________
Ayman Khaled is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-20-2017 , 10:45   Re: Plugin doesn't even start because of "jump" not being a game event. Help?
Reply With Quote #3

I think the main problem is that you think we, AmxModX coders, know the language SourceMod. Check the FAQ on source mod section, it shows how to register commands like jump.
eyal282 is offline
ClassicHopper
Junior Member
Join Date: Jul 2017
Old 07-20-2017 , 10:46   Re: Plugin doesn't even start because of "jump" not being a game event. Help?
Reply With Quote #4

Quote:
Originally Posted by eyal282 View Post
I think the main problem is that you think we, AmxModX coders, know the language SourceMod. Check the FAQ on source mod section, it shows how to register commands like jump.
Shit im a fucking moron i thought i was on sourcemod .-.
How do I delete this post in that case?

Last edited by ClassicHopper; 07-20-2017 at 10:46.
ClassicHopper 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:10.


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