Restore map's original state without restart

Сообщения
9
Реакции
3
[ ENGLISH THREAD ]

I am removing map's spawn weapon like awp_india gives players AWP by default with engfunc and finding and removing that entity

Код:
engfunc (EngFunc_RemoveEntity, engfunc (EngFunc_FindEntityByString, -1, "classname", "player_weaponstrip"));
engfunc (EngFunc_RemoveEntity, engfunc (EngFunc_FindEntityByString, -1, "classname", "game_player_equip"));
But the thing is i want to restore original map state after sometime with some command without map restart, can anyone suggest how can i do that? (Maybe retrieving value of weapons from that entity and provide it again or how)
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
DiGiTaL,
Код:
#pragma semicolon 1

#include <amxmodx>
#include <hamsandwich>
#include <reapi>

new bool:g_bSomeState;

public plugin_init()
{
    register_plugin("", "1.0.0", "fl0wer");

    new mapName[32];
    get_mapname(mapName, charsmax(mapName));

    if (!equal(mapName, "awp_india"))
        return;

    register_clcmd("say /gg", "@gg");

    RegisterHookChain(RG_CBasePlayer_OnSpawnEquip, "@CBasePlayer_OnSpawnEquip_Pre", false);

    RegisterHam(Ham_Use, "multi_manager", "@CBaseEntity_Use_Pre", false);
    RegisterHam(Ham_Use, "player_weaponstrip", "@CBaseEntity_Use_Pre", false);
}

@gg()
{
    g_bSomeState ^= true;
    // sv_restart 1
}

@CBasePlayer_OnSpawnEquip_Pre(id, bool:addDefault, bool:equipGame)
{
    if (!g_bSomeState)
        return;

    SetHookChainArg(3, ATYPE_BOOL, false);
}

@CBaseEntity_Use_Pre(id, activator, caller, USE_TYPE:useType, Float:value)
{
    if (!g_bSomeState)
        return HAM_IGNORED;

    return HAM_SUPERCEDE;
}
Also you can use [Enable/Disable][HookChain/HamForward] depend on your states.
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу