AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ExecuteHamB (https://forums.alliedmods.net/showthread.php?t=160147)

KamiN 06-25-2011 13:15

ExecuteHamB
 
This line has no effect, why?
Code:

ExecuteHamB(Ham_Use, g_Buttons[i], 0, 0, 1, 1.0)
Code:

#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fakemeta>
#include <amxmisc>
 
#define CELL_RADIUS Float:500.0
 
new g_Buttons[10], Trie:g_CellManagers
 
public plugin_precache()
{
    g_CellManagers = TrieCreate()
}
 
public plugin_init()
{
    register_plugin("something", "0.1", "somebody")
    register_clcmd("say /open", "jail_open");
    setup_buttons()
}
 
public jail_open()
{
    static i
    for(i = 0; i < sizeof(g_Buttons); i++)
    {
        if(g_Buttons[i])
        {
            ExecuteHamB(Ham_Use, g_Buttons[i], 0, 0, 1, 1.0)
            entity_set_float(g_Buttons[i], EV_FL_frame, 0.0)
        }
    }
}
 
public setup_buttons()
{
    new ent[3]
    new Float:origin[3]
    new info[32]
    new pos
 
    while((pos <= sizeof(g_Buttons)) && (ent[0] = engfunc(EngFunc_FindEntityByString, ent[0], "classname", "info_player_deathmatch")))
    {
        pev(ent[0], pev_origin, origin)
        while((ent[1] = engfunc(EngFunc_FindEntityInSphere, ent[1], origin, CELL_RADIUS)))
        {
            if(!is_valid_ent(ent[1]))
                continue
         
            entity_get_string(ent[1], EV_SZ_classname, info, charsmax(info))
            if(!equal(info, "func_door"))
                continue
         
            entity_get_string(ent[1], EV_SZ_targetname, info, charsmax(info))
            if(!info[0])
                continue
         
            if(TrieKeyExists(g_CellManagers, info))
            {
                TrieGetCell(g_CellManagers, info, ent[2])
            }
            else
            {
                ent[2] = engfunc(EngFunc_FindEntityByString, 0, "target", info)
            }
         
            if(is_valid_ent(ent[2]) && (in_array(ent[2], g_Buttons, sizeof(g_Buttons)) < 0))
            {
                g_Buttons[pos] = ent[2]
                pos++
                break
            }
        }
    }
    TrieDestroy(g_CellManagers)
}
 
stock in_array(needle, data[], size)
{
    for(new i = 0; i < size; i++)
    {
        if(data[i] == needle)
            return i
    }
    return -1
}


nikhilgupta345 06-25-2011 13:28

Re: ExecuteHamB
 
#include <hamsandwich> at the top


All times are GMT -4. The time now is 23:34.

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