Участник
- Сообщения
- 2,491
- Реакции
- 2,795
- Помог
- 61 раз(а)
А если он зафейлит каким то чудесным образом, то можем и вовсе не выйти из цикла!TrieIterDestroy(iter)
Последнее редактирование модератором:
А если он зафейлит каким то чудесным образом, то можем и вовсе не выйти из цикла!TrieIterDestroy(iter)
#define FOR_ITERATE_TRIE(%0, %1) for(%0 = TrieIterCreate(%1); !TrieIterEnded(%0); TrieIterNext(%0))
funk()
new TrieIter:iter;
FOR_ITERATE_TRIE(iter, some_trie)
{}
TrieIterDestroy(iter);
stock Float:GetUserVelocity(idUser)
{
new Float:vecVelocity[3];
entity_get_vector(idUser, EV_VEC_velocity, vecVelocity);
vecVelocity[2] = 0.0; // set Z-axis velocity to zero
return vector_length(vecVelocity);
}
vecVelocity[0] = 0.0;
vecVelocity[1] = 0.0;
#include <amxmodx>
#include <amxmisc>
#include <reapi>
#define PLUGIN "Zone Delete"
#define VERSION "1.0"
#define AUTHOR "JASON"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHookChain(RG_CSGameRules_GetPlayerSpawnSpot, "PlayerSpawnPost", true)
}
public PlayerSpawnPost()
{
new const szRemoveEntities[][] =
{
"func_hostage_rescue",
"info_hostage_rescue",
"func_bomb_target",
"info_bomb_target",
"func_vip_safetyzone",
"info_vip_start",
"func_escapezone",
"hostage_entity",
"monster_scientist",
"func_buyzone"
};
for(new iCount = 0, iSize = sizeof(szRemoveEntities); iCount < iSize; iCount++)
{
rg_remove_entity(szRemoveEntities[iCount]);
}
}
rg_remove_entity(const Zone[])
{
new iEntity = 0;
while ((iEntity = rg_find_ent_by_class(iEntity, Zone)))
{
set_entvar(iEntity, var_flags, get_entvar(iEntity, var_flags) | FL_KILLME);
set_entvar(iEntity, var_nextthink, get_gametime());
}
set_member_game(m_bMapHasBuyZone, true);
set_member_game(m_bMapHasBombZone, false);
}
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <reapi>
#define PLUGIN ""
#define VERSION ""
#define AUTHOR ""
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHookChain(RG_CSGameRules_CheckMapConditions, "CheckMapCondition", true);
GameInit_BlockZone();
}
public GameInit_BlockZone()
{
CheckMapCondition()
}
public CheckMapCondition()
{
new const szRemoveEntities[][] =
{
"func_hostage_rescue",
"info_hostage_rescue",
"func_bomb_target",
"info_bomb_target",
"func_vip_safetyzone",
"info_vip_start",
"func_escapezone",
"hostage_entity",
"monster_scientist",
"func_buyzone"
};
for(new iCount = 0, iSize = sizeof(szRemoveEntities); iCount < iSize; iCount++)
{
rg_remove_entity(szRemoveEntities[iCount]);
}
log_amx("Zone Disable");
return HC_SUPERCEDE;
}
rg_remove_entity(const Zone[])
{
new iEntity = 0;
while ((iEntity = rg_find_ent_by_class(iEntity, Zone)))
{
set_entvar(iEntity, var_flags, get_entvar(iEntity, var_flags) | FL_KILLME);
set_entvar(iEntity, var_nextthink, get_gametime());
}
set_member_game(m_bMapHasBuyZone, true);
set_member_game(m_bMapHasBombZone, false);
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
if(get_member_game(m_bMapHasBuyZone))
{
rg_remove_zone("func_buyzone")
}
else
{
set_member_game(m_bMapHasBuyZone,true);
}
RegisterHookChain(RG_CSGameRules_CheckMapConditions, "CheckMapConditions");
}
public CheckMapConditions()
{
return HC_SUPERCEDE;
}
rg_remove_zone(const Zone[])
{
new entityIndex = 0;
while ((entityIndex = rg_find_ent_by_class(entityIndex, Zone)))
{
set_entvar(entityIndex, var_flags, get_entvar(entityIndex, var_flags) | FL_KILLME);
}
}
// Designate the desired amount of buy time for each round. (in minutes)
// -1 - means no time limit
// 0 - disable buy
//
// Default value: "1.5"
mp_buytime 0.25
// https://github.com/s1lentq/ReGameDLL_CS/blob/3a8b0d13303c7cdc26d2d4dc878dc4b85237d8b8/regamedll/dlls/wpn_shared/wpn_xm1014.cpp#L185
stock UTIL_ShotgunIdle( const pItem, const iMaxClip, const iAnimIdle, const Float: flAnimIdleTime, const iAnimReloadEnd, const Float: flAnimReloadEndTime, const szSoundReloadEnd[ ] )
{
new pPlayer = get_member( pItem, m_pPlayer );
new iClip = get_member( pItem, m_Weapon_iClip );
new iAmmoType = get_member( pItem, m_Weapon_iPrimaryAmmoType );
new iAmmo = get_member( pPlayer, m_rgAmmo, iAmmoType );
new iSpecialReload = get_member( pItem, m_Weapon_fInSpecialReload );
if ( get_member( pItem, m_Weapon_flTimeWeaponIdle ) > 0.0 )
return;
if ( !iClip && !iSpecialReload && iAmmo ) ExecuteHamB( Ham_Weapon_Reload, pItem );
else if ( iSpecialReload )
{
if ( iClip != iMaxClip && iAmmo ) ExecuteHamB( Ham_Weapon_Reload, pItem );
else
{
UTIL_SendWeaponAnim( pPlayer, iAnimReloadEnd );
rh_emit_sound2( pPlayer, 0, CHAN_ITEM, szSoundReloadEnd, .pitch = 85 + random_num( 0, 31 ) );
set_member( pItem, m_Weapon_fInSpecialReload, 0 );
set_member( pItem, m_Weapon_flTimeWeaponIdle, flAnimReloadEndTime );
}
}
else
{
UTIL_SendWeaponAnim( pPlayer, iAnimIdle );
set_member( pItem, m_Weapon_flTimeWeaponIdle, flAnimIdleTime );
}
}
// https://github.com/s1lentq/ReGameDLL_CS/blob/3a8b0d13303c7cdc26d2d4dc878dc4b85237d8b8/regamedll/dlls/weapons.cpp#L1400
stock UTIL_ShotgunReload( const pItem, const iMaxClip, const iAnimReloadStart, const Float: flReloadStartDelay, const szSoundReloadStart[ ], const iAnimReload, const Float: flReloadDelay, const szSoundReload[ ] )
{
new pPlayer = get_member( pItem, m_pPlayer );
new iClip = get_member( pItem, m_Weapon_iClip );
new iAmmoType = get_member( pItem, m_Weapon_iPrimaryAmmoType );
new iAmmo = get_member( pPlayer, m_rgAmmo, iAmmoType );
new iSpecialReload = get_member( pItem, m_Weapon_fInSpecialReload );
if ( !iAmmo || iClip >= iMaxClip || get_member( pItem, m_Weapon_flNextPrimaryAttack ) > 0.0 )
return;
switch ( iSpecialReload )
{
case 0:
{
rg_set_animation( pPlayer, PLAYER_RELOAD );
UTIL_SendWeaponAnim( pPlayer, iAnimReloadStart );
rh_emit_sound2( pPlayer, 0, CHAN_ITEM, szSoundReloadStart, .pitch = 85 + random_num( 0, 31 ) );
iSpecialReload = 1;
set_member( pPlayer, m_flNextAttack, flReloadStartDelay );
set_member( pItem, m_Weapon_flNextPrimaryAttack, flReloadStartDelay );
set_member( pItem, m_Weapon_flNextSecondaryAttack, flReloadStartDelay );
set_member( pItem, m_Weapon_flTimeWeaponIdle, flReloadStartDelay );
}
case 1:
{
if ( get_member( pItem, m_Weapon_flNextPrimaryAttack ) > 0.0 )
return;
UTIL_SendWeaponAnim( pPlayer, iAnimReload );
rh_emit_sound2( pPlayer, 0, CHAN_ITEM, szSoundReload, .pitch = 85 + random_num( 0, 31 ) );
iSpecialReload = 2;
set_member( pItem, m_Weapon_flTimeWeaponIdle, flReloadDelay );
}
case 2:
{
if ( get_member( pItem, m_Weapon_flTimeWeaponIdle ) > 0.0 )
return;
iSpecialReload = 1;
set_member( pItem, m_Weapon_iClip, ++iClip );
set_member( pPlayer, m_rgAmmo, --iAmmo, iAmmoType )
}
}
set_member( pItem, m_Weapon_fInSpecialReload, iSpecialReload );
}
#include "cellarray.inc"
enum Queue {
Invalid_Queue = 0
};
stock Queue: QueueCreate(const cellsize = 1) {
return Queue: ArrayCreate(cellsize);
}
stock QueueDestroy(&Queue: which) {
return ArrayDestroy(Array: which);
}
stock QueueClear(const &Queue: which) {
ArrayClear(Array: which);
}
stock Queue: QueueClone(const &Queue: which) {
return ArrayClone(Array: which);
}
stock QueuePushCell(const &Queue: which, const any: value) {
return ArrayPushCell(Array: which, any: value);
}
stock QueuePushString(const &Queue: which, const value[]) {
return ArrayPushString(Array: which, value);
}
stock QueuePushArray(const &Queue: which, const any: value[], const size = -1) {
return ArrayPushArray(Array: which, value, size);
}
stock any: QueuePopCell(const &Queue: which) {
new any: value = ArrayGetCell(Array: which, 0);
ArrayDeleteItem(Array: which, 0);
return value;
}
stock QueuePopString(const &Queue: which, buffer[], const maxlength) {
new charCount = ArrayGetString(Array: which, 0, buffer, maxlength);
ArrayDeleteItem(Array: which, 0);
return charCount;
}
stock QueuePopArray(const &Queue: which, buffer[], const size) {
new cellCount = ArrayGetArray(Array: which, 0, buffer, size);
ArrayDeleteItem(Array: which, 0);
return cellCount;
}
stock any: QueueFrontCell(const &Queue: which) {
new any: value = ArrayGetCell(Array: which, 0);
return value;
}
stock QueueFrontString(const &Queue: which, buffer[], const maxlength) {
new charCount = ArrayGetString(Array: which, 0, buffer, maxlength);
return charCount;
}
stock QueueFrontArray(const &Queue: which, buffer[], const size) {
new cellCount = ArrayGetArray(Array: which, 0, buffer, size);
return cellCount;
}
stock any: QueueRearCell(const &Queue: which) {
new any: value = ArrayGetCell(Array: which, QueueSize(which) - 1);
return value;
}
stock QueueRearString(const &Queue: which, buffer[], const maxlength) {
new charCount = ArrayGetString(Array: which, QueueSize(which) - 1, buffer, maxlength);
return charCount;
}
stock QueueRearArray(const &Queue: which, buffer[], const size) {
new cellCount = ArrayGetArray(Array: which, QueueSize(which) - 1, buffer, size);
return cellCount;
}
stock QueueSize(const &Queue: which) {
return ArraySize(Array: which);
}
#include "amxmodx.inc"
#include "cellqueue.inc"
public plugin_init() {
QueueClone_test()
QueueCell_test();
QueueCell_float_test();
QueueString_test();
QueueArray_test();
QueueFront_test();
QueueRear_test();
QueueClear_test();
}
QueueClone_test() {
new Queue: queue = QueueCreate();
QueuePushCell(queue, 1);
QueuePushCell(queue, 2);
QueuePushCell(queue, 3);
new Queue: cloneQueue = QueueClone(queue);
for(new i, size = QueueSize(cloneQueue); i < size; i++) {
server_print("----------- QueueClone_test (%i/%i) = %i", i, QueueSize(cloneQueue), QueuePopCell(cloneQueue));
}
QueueDestroy(queue);
QueueDestroy(cloneQueue);
}
QueueCell_test() {
new Queue: queue = QueueCreate();
QueuePushCell(queue, 1);
QueuePushCell(queue, 2);
QueuePushCell(queue, 3);
for(new i, size = QueueSize(queue); i < size; i++) {
server_print("----------- QueueCell_test (%i/%i) = %i", i, QueueSize(queue), QueuePopCell(queue));
}
QueueDestroy(queue);
}
QueueCell_float_test() {
new Queue: queue = QueueCreate();
QueuePushCell(queue, 1.234);
QueuePushCell(queue, 2.345);
QueuePushCell(queue, 3.456);
for(new i, size = QueueSize(queue); i < size; i++) {
server_print("----------- QueueCell_float_test (%i/%i) = %f", i, QueueSize(queue), QueuePopCell(queue));
}
QueueDestroy(queue);
}
QueueString_test() {
const LEN = 16;
new Queue: queue = QueueCreate(.cellsize = LEN);
QueuePushString(queue, "123");
QueuePushString(queue, "456");
QueuePushString(queue, "789");
for(new i, size = QueueSize(queue); i < size; i++) {
new buffer[LEN], cellsCount;
cellsCount = QueuePopString(queue, buffer, charsmax(buffer));
server_print("----------- QueueString_test (%i/%i) = `%s` (cellsCount=%i)", i, QueueSize(queue), buffer, cellsCount);
}
QueueDestroy(queue);
}
QueueArray_test() {
const LEN = 8;
new arr1[LEN] = { 1, ... };
new arr2[LEN] = { 2, ... };
new arr3[LEN] = { 3, ... };
new Queue: queue = QueueCreate(.cellsize = LEN);
QueuePushArray(queue, arr1);
QueuePushArray(queue, arr2);
QueuePushArray(queue, arr3);
for(new i, size = QueueSize(queue); i < size; i++) {
new buffer[LEN], cellsCount;
cellsCount = QueuePopArray(queue, buffer, charsmax(buffer));
new out[128];
for(new j; j < cellsCount; j++) {
strcat(out, fmt("%i", buffer[i]), charsmax(out));
}
server_print("----------- QueueArray_test (%i/%i) = `{%s}` (cellsCount=%i)", i, QueueSize(queue), out, cellsCount);
}
QueueDestroy(queue);
}
QueueFront_test() {
new Queue: queue = QueueCreate();
QueuePushCell(queue, 1);
QueuePushCell(queue, 2);
QueuePushCell(queue, 3);
for(new i, size = QueueSize(queue); i < size; i++) {
server_print("----------- QueueFront_test (%i/%i) = %i", i, QueueSize(queue), QueueFrontCell(queue));
}
QueueDestroy(queue);
}
QueueRear_test() {
new Queue: queue = QueueCreate();
QueuePushCell(queue, 1);
QueuePushCell(queue, 2);
QueuePushCell(queue, 3);
for(new i, size = QueueSize(queue); i < size; i++) {
server_print("----------- QueueRear_test (%i/%i) = %i", i, QueueSize(queue), QueueRearCell(queue));
}
QueueDestroy(queue);
}
QueueClear_test() {
new Queue: queue = QueueCreate();
QueuePushCell(queue, 1);
QueuePushCell(queue, 2);
QueuePushCell(queue, 3);
server_print("----------- QueueClear_test GeneratedSize=%i", QueueSize(queue));
QueueClear(queue);
server_print("----------- QueueClear_test AfterClearSize=%i", QueueSize(queue));
QueueDestroy(queue);
}
----------- QueueClone_test (0/2) = 1
----------- QueueClone_test (1/1) = 2
----------- QueueClone_test (2/0) = 3
----------- QueueCell_test (0/2) = 1
----------- QueueCell_test (1/1) = 2
----------- QueueCell_test (2/0) = 3
----------- QueueCell_float_test (0/2) = 1.233999
----------- QueueCell_float_test (1/1) = 2.345000
----------- QueueCell_float_test (2/0) = 3.456000
----------- QueueString_test (0/2) = `123` (cellsCount=3)
----------- QueueString_test (1/1) = `456` (cellsCount=3)
----------- QueueString_test (2/0) = `789` (cellsCount=3)
----------- QueueArray_test (0/2) = `{1111111}` (cellsCount=7)
----------- QueueArray_test (1/1) = `{2222222}` (cellsCount=7)
----------- QueueArray_test (2/0) = `{3333333}` (cellsCount=7)
----------- QueueFront_test (0/3) = 1
----------- QueueFront_test (1/3) = 1
----------- QueueFront_test (2/3) = 1
----------- QueueRear_test (0/3) = 3
----------- QueueRear_test (1/3) = 3
----------- QueueRear_test (2/3) = 3
----------- QueueClear_test GeneratedSize=3
----------- QueueClear_test AfterClearSize=0