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

[REQ] Bhop limit zephyrus store


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nades
BANNED
Join Date: Oct 2020
Location: Usa
Old 09-10-2021 , 08:24   [REQ] Bhop limit zephyrus store
Reply With Quote #1

Hello, i want limit jumps and cooldown 15 sec to reload and makes bhop again for zephyrus store.

Store:
Code:
#if defined STANDALONE_BUILD
#include <sourcemod>
#include <sdktools>

#include <store>
#include <zephstocks>

new bool:GAME_TF2 = false;
#endif

#if defined STANDALONE_BUILD
public OnPluginStart()
#else
public Bunnyhop_OnPluginStart()
#endif
{
#if defined STANDALONE_BUILD
	// TF2 is unsupported
	new String:m_szGameDir[32];
	GetGameFolderName(m_szGameDir, sizeof(m_szGameDir));
	if(strcmp(m_szGameDir, "tf")==0)
		GAME_TF2 = true;
#endif
	Store_RegisterHandler("bunnyhop", "", Bunnyhop_OnMapStart, Bunnyhop_Reset, Bunnyhop_Config, Bunnyhop_Equip, Bunnyhop_Remove, true);
}

public Bunnyhop_OnMapStart()
{
}

public Bunnyhop_Reset()
{
}

public Bunnyhop_Config(&Handle:kv, itemid)
{
	Store_SetDataIndex(itemid, 0);
	return true;
}

public Bunnyhop_Equip(client, id)
{
	return -1;
}

public Bunnyhop_Remove(client, id)
{
}

#if defined STANDALONE_BUILD
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
#else
public Action:Bunnyhop_OnPlayerRunCmd(client, &buttons)
#endif
{
	new m_iEquipped = Store_GetEquippedItem(client, "bunnyhop");
	if(m_iEquipped < 0)
		return Plugin_Continue;

	new m_iWater = GetEntProp(client, Prop_Data, "m_nWaterLevel");
	if (IsPlayerAlive(client))
		if (buttons & IN_JUMP)
			if (m_iWater <= 1)
				if (!(GetEntityMoveType(client) & MOVETYPE_LADDER))
				{
					if(!GAME_TF2)
						SetEntPropFloat(client, Prop_Send, "m_flStamina", 0.0);
					if (!(GetEntityFlags(client) & FL_ONGROUND))
						buttons &= ~IN_JUMP;
				}

	return Plugin_Continue;
}

ex bhop with cooldown and limits :
Code:
#include <sourcemod>
#include <sdktools>
#include <vip_core>

#pragma semicolon 1
#pragma newdecls required

#define VIP_Bh "cd_bhop"

public Plugin myinfo =
{
	name = "[VIP] Bhop Regulable",
	author = "LansRus",
	version = "1.0.0",
	url = "vk.com/kokovr"
};

int g_iJumpsCount[MAXPLAYERS+1],
	g_iCountDown[MAXPLAYERS+1],
	g_iFinalCount[MAXPLAYERS+1],
	g_iRecentCount[MAXPLAYERS+1],
	g_iNoVipJumpsCount,
	g_iCountDownTime;

float g_fDelay;

public void OnPluginStart()
{
	HookEvent("round_start", eRS);

	ConVar
	hCvar = CreateConVar("sm_bhop_novip_jumps", "0", "Количество прыжков для обычных игроков"); hCvar.AddChangeHook(OnCountChange);
	g_iNoVipJumpsCount = hCvar.IntValue;

	hCvar = CreateConVar("sm_bhop_countdown", "15", "Время перезарядки в секундах, -1 до следующего раунда"); hCvar.AddChangeHook(OnTimeChange);
	g_iCountDownTime = hCvar.IntValue;

	hCvar = CreateConVar("sm_bhop_delay", "0.4", "Задержка перед тем как прыжок будет считаться первым"); hCvar.AddChangeHook(OnDelayChange);
	g_fDelay = hCvar.FloatValue;

	AutoExecConfig(true, "bhop");

	if (VIP_IsVIPLoaded())
	{
		VIP_OnVIPLoaded();
	}

	for (int i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i))
		{

			if (VIP_IsClientVIP(i))
			{
				VIP_OnVIPClientLoaded(i);
			}
			else
			{
				OnClientPutInServer(i);
			}
		}
	}
}

public void OnPluginEnd() 
{
	if(CanTestFeatures() && GetFeatureStatus(FeatureType_Native, "VIP_UnregisterFeature") == FeatureStatus_Available)
	{
		VIP_UnregisterFeature(VIP_Bh);
	}
}

public void VIP_OnVIPLoaded()
{
	VIP_RegisterFeature(VIP_Bh, INT, HIDE);
}

public void OnCountChange(ConVar hConVar, const char[] sOldValue, const char[] sNewValue)
{
	g_iNoVipJumpsCount = hConVar.IntValue;
}

public void OnTimeChange(ConVar hConVar, const char[] sOldValue, const char[] sNewValue)
{
	g_iCountDownTime = hConVar.IntValue;
}

public void OnDelayChange(ConVar hConVar, const char[] sOldValue, const char[] sNewValue)
{
	g_fDelay = hConVar.FloatValue;
}

public void VIP_OnVIPClientLoaded(int iClient)
{
	g_iJumpsCount[iClient] = VIP_GetClientFeatureInt(iClient, VIP_Bh);

	if (!g_iJumpsCount[iClient])
	{
		g_iJumpsCount[iClient] = g_iNoVipJumpsCount;
	}

	g_iFinalCount[iClient] = g_iRecentCount[iClient] = 0;
}

public void OnClientPutInServer(int iClient)
{
	//if (!bIsVIP)
	//{
	g_iJumpsCount[iClient] = g_iNoVipJumpsCount;
	//}

	g_iFinalCount[iClient] = g_iRecentCount[iClient] = 0;
}

/*
public void VIP_OnVIPClientAdded(int iClient, int iAdmin)
{
	g_iJumpsCount[iClient] = VIP_GetClientFeatureInt(iClient, FEATURE);

	if (!g_iJumpsCount[iClient])
	{
		g_iJumpsCount[iClient] = g_iNoVipJumpsCount;
	}
}*/

public void VIP_OnVIPClientRemoved(int iClient, const char[] szReason, int iAdmin)
{
	g_iJumpsCount[iClient] = g_iNoVipJumpsCount;
}

public Action eRS(Event hEvent, const char[] sName, bool bDontBroadcast)
{
	for (int i = 1; i <= MaxClients; i++)
	{
		if (g_iCountDown[i] == -1)
		{
			g_iCountDown[i] = g_iFinalCount[i] = g_iRecentCount[i] = 0;
		}
	}
}

public Action OnPlayerRunCmd(int iClient, int& iButtons)
{
	if (!IsPlayerAlive(iClient) || !(iButtons & IN_JUMP) || !g_iJumpsCount[iClient])
	{
		return;
	}

	if (g_iCountDown[iClient] && (g_iCountDown[iClient] == -1 || g_iCountDown[iClient] > GetTime()))
	{
		return;
	}

	static float fJumpDelay[MAXPLAYERS+1]; static bool bIsJumping[MAXPLAYERS+1];

	float fTickedTime = GetTickedTime();

	if (!(GetEntityFlags(iClient) & FL_ONGROUND) && !(GetEntityMoveType(iClient) & MOVETYPE_LADDER) && (GetEntProp(iClient, Prop_Data, "m_nWaterLevel") <= 1)) 
	{
		if (fTickedTime > fJumpDelay[iClient])
		{
			if (g_iRecentCount[iClient] > 2)
			{
				g_iFinalCount[iClient] += g_iRecentCount[iClient];
			}

			g_iRecentCount[iClient] = 0;

			if (g_iRecentCount[iClient] + g_iFinalCount[iClient] >= g_iJumpsCount[iClient])
			{
				g_iRecentCount[iClient] = g_iFinalCount[iClient] = 0;
				g_iCountDown[iClient] = g_iCountDownTime == -1 ? g_iCountDownTime:GetTime()+g_iCountDownTime;
				PrintToChat(iClient, g_iCountDownTime == -1 ? "[V.I.P] You have reached your bhop limit for this round":"[V.I.P] You have reached your bhop limit, recharge %i seconds", g_iCountDownTime);
			}
		}

		fJumpDelay[iClient] = fTickedTime + g_fDelay;

		bIsJumping[iClient] = true;
		iButtons &= ~IN_JUMP;
	}

	if (bIsJumping[iClient] && GetEntityFlags(iClient) & FL_ONGROUND)
	{
		bIsJumping[iClient] = false;

		if (g_iRecentCount[iClient]++ + g_iFinalCount[iClient] >= g_iJumpsCount[iClient])
		{
			g_iRecentCount[iClient] = g_iFinalCount[iClient] = 0;
			g_iCountDown[iClient] = g_iCountDownTime == -1 ? g_iCountDownTime:GetTime()+g_iCountDownTime;
			PrintToChat(iClient, g_iCountDownTime == -1 ? "[V.I.P] You have reached your bhop limit for this round":"[V.I.P] You've reached your bhop limit, recharge %i seconds", g_iCountDownTime);
		}
	}
}
nades is offline
Send a message via ICQ to nades Send a message via AIM to nades Send a message via Yahoo to nades Send a message via Skype™ to nades
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 10:45.


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