#include <amxmodx>
#include <fakemeta>
#include <engine>
#define MIN -10.0,-10.0,0.0
#define MAX 10.0,10.0,25.0
#define InditasiIdo 60
new const PLUGIN[] = "Event"
new const VERSION[] = "1.0"
new const AUTHOR[] = "By Tamas14"
new const FoPlugin[] = "?.amxx"
new const ENGEDELYEZETT_PALYA[] = "pálya_neve"
new MDL[][][] = {
{ "models/lada.mdl", "nyeremendoboz", "Lada", "LadaAdas" },
{ "models/xp.mdl", "xp", "XP Jegy", "XPAdas" },
{ "models/pont.mdl", "pont", "Pont", "PontAdas" }
}
//Model | Ent neve | Model neve (hud) | Eleresi fuggveny ami adja az erteket
new Fal, Palya[12], Ido, Maradt, Mod, Restart, InfoT, HudObj, bool:RunEvent
public plugin_precache()
{
for(new i; i < sizeof(MDL); i++)
{
precache_model(MDL[i][0])
}
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_eventmap", "PalyaInditas", ADMIN_BAN)
get_mapname(Palya, 11)
if(equal(Palya, ENGEDELYEZETT_PALYA))
{
InfoT = engfunc(EngFunc_AllocString, "info_target")
Fal = find_ent_by_tname(-1, "fal")
Restart = get_cvar_pointer("sv_restart")
HudObj = CreateHudSyncObj();
FalLetrehozas()
register_concmd("amx_eventon", "Event", ADMIN_BAN)
register_concmd("amx_eventmod", "EventMod", ADMIN_BAN)
register_concmd("amx_eventrestart", "EventRestart", ADMIN_BAN)
for(new i; i < sizeof(MDL); i++)
{
register_touch(MDL[i][1], "player", "Adas")
}
}
}
public Adas(Ent, id)
{
Maradt--
if(callfunc_begin(MDL[Mod][3], FoPlugin) == 1)
{
callfunc_push_int(id)
callfunc_end()
}
engfunc(EngFunc_RemoveEntity, Ent)
}
public EventHud(id)
{
if(RunEvent)
{
set_hudmessage(240, 240, 240, -1.0, 0.20, 0, 6.0, 1.0)
ShowSyncHudMsg(0, HudObj, "Még %d darab %s maradt!", Maradt, MDL[Mod][2])
}
}
public EventMod(id)
{
new Ertek, Adat[32]
read_args(Adat, charsmax(Adat))
remove_quotes(Adat)
Ertek = str_to_num(Adat)
if(Ertek >= 0 && Ertek < sizeof(MDL))
{
Mod = Ertek
}
}
public Event()
{
Maradt = 0
Ido = InditasiIdo
set_task(1.0, "Idozito")
set_task(1.0, "Generalas")
}
public EventRestart()
{
RunEvent = false
Maradt = 0
FalLetrehozas()
set_pcvar_num(Restart, 1)
}
public PalyaInditas()
{
server_cmd("changelevel ^"%s^"", ENGEDELYEZETT_PALYA)
}
public FalLetrehozas()
{
set_pev(Fal, pev_solid, SOLID_BSP)
set_pev(Fal, pev_rendermode, kRenderTransColor)
set_pev(Fal, pev_rendercolor, Float:{ 42.0, 170.0, 250.0 })
set_pev(Fal, pev_renderamt, Float:{ 50.0 })
}
public FalTorles()
{
set_pev(Fal, pev_solid, SOLID_NOT)
set_pev(Fal, pev_renderamt, Float:{ 0.0 })
}
public Idozito()
{
if(Ido > 0)
{
Ido--
client_print(0, print_center, "Készülj az event kezdődik %d másodperc múlva!", Ido)
set_task(1.0, "Idozito")
}
else
{
FalTorles()
RunEvent = true
set_task(0.5, "EventHud", 69, _, _, "b")
}
}
public Generalas()
{
if(Maradt < 50 && !RunEvent)
{
static Float:Origin[3]
Origin[0] = random_float(-950.0, 675.0)
Origin[1] = random_float(-675.0, 950.0)
Origin[2] = -200.0
new Ent = engfunc(EngFunc_CreateNamedEntity, InfoT)
set_pev(Ent, pev_classname, MDL[Mod][1])
engfunc(EngFunc_SetOrigin, Ent, Origin)
engfunc(EngFunc_SetModel, Ent, MDL[Mod][0])
dllfunc(DLLFunc_Spawn, Ent)
set_pev(Ent, pev_solid, SOLID_BBOX)
set_pev(Ent, pev_movetype, MOVETYPE_NONE)
engfunc(EngFunc_SetSize, Ent, Float:{MIN}, Float:{MAX})
engfunc(EngFunc_DropToFloor, Ent)
Maradt++
set_task(0.1, "Generalas")
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/