Заявка за редакция на [zp]multijump

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Отговори
Потребителски аватар

Автор на темата
FFiiinnggeerrr
Потребител
Потребител
Мнения: 20
Регистриран: 30 апр 2017, 23:48

Заявка за редакция на [zp]multijump

Мнение от FFiiinnggeerrr » 13 май 2019, 00:26

Ако може да ми го направите multijumpa да е Free за зомбитата и хора да имат двоен скок без да се купува

Код: Избери всички

/*================================================================================
	
	-------------------------------------------
	-*- [ZP] Extra Item: Multijump 1.0 -*-
	-------------------------------------------
	
	~~~~~~~~~~~~~~~
	- Description -
	~~~~~~~~~~~~~~~
	
	This item/upgrade allows humans to jump multiple times, even being in mid air.
	Each upgrade adds one jump.
	
	By default there is no maximum of jumps in mid air.
	
	Credits to:
	twistedeuphoria
	Dabbi
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague.inc>

/*================================================================================
 [Plugin Customization]
=================================================================================*/

new const g_item_name[] = { "Multijump (+1)" };
const g_item_cost = 5;
new g_maxJumps = 0; // maximum amount of jumps in mid air. If set to 0 then it is infinitely

/*============================================================================*/

new jumpnum[33] = 0;
new bool:dojump[33] = false;
new g_itemid_multijump;
new g_multijumps[33] = 0;

public plugin_init()
{
	register_plugin("[ZP] Extra Item: Multijump", "1.0", "pharse");
	
	g_itemid_multijump = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN);
	
	register_forward(FM_PlayerPreThink, "FW_PlayerPreThink");
	register_forward(FM_PlayerPostThink, "FW_PlayerPostThink");
	
	register_event("HLTV", "EVENT_round_start", "a", "1=0", "2=0");
}

public FW_PlayerPreThink(id)
{
	if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_multijumps[id]) return PLUGIN_CONTINUE
	new nbut = pev(id,pev_button);
	new obut = pev(id,pev_oldbuttons);
	if((nbut & IN_JUMP) && !(pev(id,pev_flags) & FL_ONGROUND) && !(obut & IN_JUMP))
	{
		if(jumpnum[id] < g_multijumps[id])
		{
			dojump[id] = true;
			jumpnum[id]++;
			return PLUGIN_CONTINUE
		}
	}
	if((nbut & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND))
	{
		jumpnum[id] = 0;
		return PLUGIN_CONTINUE
	}
	return PLUGIN_CONTINUE
}

public FW_PlayerPostThink(id)
{
	if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_multijumps[id]) return PLUGIN_CONTINUE
	if(dojump[id] == true)
	{
		new Float:velocity[3];
		pev(id,pev_velocity,velocity);
		velocity[2] = random_float(265.0,285.0);
		set_pev(id,pev_velocity,velocity)
		dojump[id] = false
		return PLUGIN_CONTINUE
	}
	return PLUGIN_CONTINUE
}	

// Player buys our upgrade, add one multijump
public zp_extra_item_selected(player, itemid)
{
	if (itemid == g_itemid_multijump){
		if (g_multijumps[player] < g_maxJumps || !g_maxJumps){
			g_multijumps[player]++;
			if (g_maxJumps)
				client_print(player, print_center, "Now you can jump %d / %d times in mid air.", g_multijumps[player], g_maxJumps);
			else
				client_print(player, print_center, "Now you can jump %d times in mid air.", g_multijumps[player]);
		}
		else
			client_print(player, print_center, "You can't jump more than %d times in mid air!", g_maxJumps);
	}
}

// Reset multijump for all players on newround
public EVENT_round_start()
{
	for (new id; id <= 32; id++) g_multijumps[id] = false;
}

Потребителски аватар

EMOTO2.COM emoto2
Потребител
Потребител
Мнения: 66
Регистриран: 11 яну 2018, 17:02
Се отблагодари: 1 път
Получена благодарност: 1 път
Контакти:

Заявка за редакция на [zp]multijump

Мнение от EMOTO2.COM emoto2 » 13 май 2019, 00:48

Код: Избери всички

#include <amxmodx>
#include <amxmisc>
#include <engine>

#define ADMINACCESS ADMIN_LEVEL_H

new jumpnum[33] = 0
new bool:dojump[33] = false

public plugin_init()
{
    register_plugin("Multi jump","1.1","twistedeuphoria")
    register_cvar("amx_maxjumps","1")
    register_cvar("amx_mjadminonly","0")
}

public client_putinserver(id)
{
    jumpnum[id] = 0
    dojump[id] = false
}

public client_disconnect(id)
{
    jumpnum[id] = 0
    dojump[id] = false
}

public client_PreThink(id)
{
    if(!is_user_alive(id)) return PLUGIN_CONTINUE
    if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
    new nbut = get_user_button(id)
    new obut = get_user_oldbutton(id)
    if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
    {
        if(jumpnum[id] < get_cvar_num("amx_maxjumps"))
        {
            dojump[id] = true
            jumpnum[id]++
            return PLUGIN_CONTINUE
        }
    }
    if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
    {
        jumpnum[id] = 0
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}

public client_PostThink(id)
{
    if(!is_user_alive(id)) return PLUGIN_CONTINUE
    if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
    if(dojump[id] == true)
    {
        new Float:velocity[3]    
        entity_get_vector(id,EV_VEC_velocity,velocity)
        velocity[2] = random_float(265.0,285.0)
        entity_set_vector(id,EV_VEC_velocity,velocity)
        dojump[id] = false
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}
Изображение
Изображение
Изображение
Изображение
Изображение

Отговори

Върни се в “Заявки за плъгини”

Кой е на линия

Потребители, разглеждащи този форум: Няма регистрирани потребители и 1 гост