←  Szukam pluginu

AMXX.pl: Support AMX Mod X i SourceMod

»

Plugin ograniczający podwójne skoki


Best Answer KoRrNiK 22.02.2021 23:42

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich> 

#pragma semicolon 	1

new const PLUGIN[] 	 = 	"Limit skokow";
new const VERSION[] 	 = 	"v1.0";
new const AUTHOR[] 	 = 	"KoRrNiK";

new userJump[33];
new userLimitJump[33];

new const additionalJump = 	1;   // Ilość dodatkowych skoków
new const limitJump 	 = 	3;           // Ilość powtórzeń

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_forward(FM_CmdStart, "cmdStart");
	RegisterHam(Ham_Spawn, "player", "spawnHam", 1);
}

public spawnHam(id){ 
	
	if(!is_user_alive(id)) return;
	
	userLimitJump[id] = limitJump;
	userJump[id] = additionalJump;
	
}

public cmdStart(id, uc_handle){
	
	if (!is_user_alive(id)) return FMRES_IGNORED;
	
	static Float:velocity[3], button, oldButton, flags;

	button 		= 	get_uc(uc_handle, UC_Buttons);
	oldButton 	= 	pev(id, pev_oldbuttons);
	flags 		= 	pev(id, pev_flags);
	
	if ((button & IN_JUMP) && !(flags & FL_ONGROUND) && !(oldButton & IN_JUMP) && userJump[id]) {
		if(userLimitJump[id] >= 0){
			userJump[id]--;
			pev(id, pev_velocity, velocity);
			velocity[2] = random_float(265.0, 285.0);
			set_pev(id, pev_velocity, velocity);
		}
	} else {
		if (flags & FL_ONGROUND){
			if(!userJump[id]) userLimitJump[id]--;
			userJump[id] = additionalJump;
		}
	}
	return FMRES_IGNORED;
}
Trzymaj :) Go to the full post

  • +
  • -
Shabaddy's Photo Shabaddy 22.02.2021

Witam!

Szukam pluginu lub funkcji dzięki, której mógłbym ograniczyć podwójne skoki dla SVIPa na serwerze - dokładniej chodzi mi o to, aby gracz X posiadający SVIP'a mógł skoczyć podwójnie naprzykład tylko 3 razy.

Z góry dzięki za pomoc!

Quote

  • +
  • -
Best Answer KoRrNiK's Photo KoRrNiK 22.02.2021

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich> 

#pragma semicolon 	1

new const PLUGIN[] 	 = 	"Limit skokow";
new const VERSION[] 	 = 	"v1.0";
new const AUTHOR[] 	 = 	"KoRrNiK";

new userJump[33];
new userLimitJump[33];

new const additionalJump = 	1;   // Ilość dodatkowych skoków
new const limitJump 	 = 	3;           // Ilość powtórzeń

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_forward(FM_CmdStart, "cmdStart");
	RegisterHam(Ham_Spawn, "player", "spawnHam", 1);
}

public spawnHam(id){ 
	
	if(!is_user_alive(id)) return;
	
	userLimitJump[id] = limitJump;
	userJump[id] = additionalJump;
	
}

public cmdStart(id, uc_handle){
	
	if (!is_user_alive(id)) return FMRES_IGNORED;
	
	static Float:velocity[3], button, oldButton, flags;

	button 		= 	get_uc(uc_handle, UC_Buttons);
	oldButton 	= 	pev(id, pev_oldbuttons);
	flags 		= 	pev(id, pev_flags);
	
	if ((button & IN_JUMP) && !(flags & FL_ONGROUND) && !(oldButton & IN_JUMP) && userJump[id]) {
		if(userLimitJump[id] >= 0){
			userJump[id]--;
			pev(id, pev_velocity, velocity);
			velocity[2] = random_float(265.0, 285.0);
			set_pev(id, pev_velocity, velocity);
		}
	} else {
		if (flags & FL_ONGROUND){
			if(!userJump[id]) userLimitJump[id]--;
			userJump[id] = additionalJump;
		}
	}
	return FMRES_IGNORED;
}
Trzymaj :)
Quote