I get the following error with this plugin that makes you invisible for 20 seconds:
[AMXX] [0] item_invisibilidad.sma::AddToFullPack (line 42)
[AMXX] Displaying debug trace (plugin "item_invisibilidad.amxx", version "1.0")
[AMXX] Run time error 4: index out of bounds
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fakemeta>
#include <jctf>
native Float:halflife_time()
new Float:fPtime[MAX_PLAYERS]
new bool:buyed[MAX_PLAYERS]
public plugin_init()
{
register_plugin("Item Invisibilidad", "1.0", "Sugisaki")
register_forward(FM_AddToFullPack, "AddToFullPack", 1)
register_event_ex("DeathMsg", "event_playerKilled", RegisterEvent_Global)
shop_add_item("MENU_SPITEMS_OP_1", 90, "buy_invisibility")
register_dictionary("jctf.txt")
}
public client_disconnected(id)
{
buyed[id] = false
}
public buy_invisibility(id)
{
if(buyed[id])
{
client_print_color(id, print_team_default, "^1[^4CTF^1] %L.", id, "PRINT_ITEM_USE")
return PLUGIN_HANDLED
}
fPtime[id] = halflife_time() + 20.0
buyed[id] = true
client_print_color(id, print_team_default, "^1[^4CTF^1] %L.", id, "PRINT_ITEM_INVISIBILITY_BUY")
return PLUGIN_CONTINUE
}
public AddToFullPack(es, e, ent, host, flags, player, set)
{
if(!player)
{
return
}
if(buyed[ent])
{
set_es(es, ES_Effects, EF_NODRAW)
client_print(ent, print_center, "%L", ent, "PRINT_I_ITEM", fPtime[ent] - halflife_time(), (fPtime[ent] - halflife_time() > 1.9 ? "s" : ""))
if(halflife_time() >= fPtime[ent] - 0.1)
{
client_print_color(ent, print_team_default, "^1[^4CTF^1] %L.", ent, "PRINT_ITEM_INVISIBILITY_END")
buyed[ent] = false
}
}
}
public event_playerKilled()
{
new v = read_data(2)
if(buyed[v])
{
buyed[v] = false
}
}
Any solutions?