public giftCreate(id){
server_print("[%s v%s] [Debug] [giftCreate] [%n]", PLUG_NAME, PLUG_VER, id);
static ret; ExecuteForward(pFwds[fCreatePre], ret);
if(ret == AW_DG_CONT){
server_print("[%s v%s] [Debug] [giftCreate] [%n] [Fwd]", PLUG_NAME, PLUG_VER, id);
static a;
if(!a) a = engfunc(EngFunc_AllocString, "info_target");
static ent; ent = engfunc(EngFunc_CreateNamedEntity, a);
if(pev_valid(ent)){
server_print("[%s v%s] [Debug] [giftCreate] [%n] [Fwd] [Create] [%d]", PLUG_NAME, PLUG_VER, id, ent);
set_pev(ent, pev_classname, "gift");
static Float:f[3]; pev(id, pev_origin, f); f[2] -= 30.0;
set_pev(ent, pev_origin, f);
engfunc(EngFunc_SetModel, ent, MODEL_PATH);
set_pev(ent, pev_giftStartPos, f[2]);
set_pev(ent, pev_giftFlyDir, 1);
set_pev(ent, pev_scale, 50);
static Float:vecAngles[coord_e], Float:vecAvelocity[coord_e];
vecAngles[Y] += random_float(-180.0, 180.0);
set_pev(ent, pev_angles, vecAngles);
vecAvelocity[Z] = 10.0 * 10.0;
set_pev(ent, pev_avelocity, vecAvelocity);
set_pev(ent, pev_maxspeed, FLY_AMP);
//set_pev(ent, pev_nextthink, get_gametime()+0.1);
set_pev(ent, pev_nextthink, get_gametime()+2.0);
dllfunc(DLLFunc_Spawn,ent);
set_pev(ent, pev_solid, SOLID_TRIGGER);
engfunc(EngFunc_SetSize, ent, fMins, fMaxs);
if(giftLifeTime) set_task(float(giftLifeTime), "giftDelete", ent);
ExecuteForward(pFwds[fCreatePost], ret, ent);
server_print("[%s v%s] [Debug] [giftCreate] [%n] [Fwd] [Created] [%d]", PLUG_NAME, PLUG_VER, id, ent);
}
}
}
public giftThink(ent){
if(!pev_valid(ent)) return FMRES_IGNORED;
/* static Float:o[3]; pev(ent, pev_origin, o);
static Float:entStartY; pev(ent, pev_giftStartPos, entStartY);
static dir; pev(ent, pev_giftFlyDir, dir);
static Float:a[3]; pev(ent, pev_angles, a); a[1] += 5.0;
if(dir) o[2] += 1.0;
else o[2] -= 1.0;
set_pev(ent, pev_origin, o);
if(o[2] > entStartY + FLY_AMP) set_pev(ent, pev_iuser1, 0);
else if(o[2] < entStartY - FLY_AMP) set_pev(ent, pev_iuser1, 1);
set_pev(ent, pev_angles, a);
set_pev(ent, pev_fixangle, 1); */
static Float:vecVelocity[coord_e], Float:fFlyUp;
pev(ent, pev_maxspeed, fFlyUp);
vecVelocity[Z] = fFlyUp;
set_pev(ent, pev_velocity, vecVelocity);
set_pev(ent, pev_maxspeed, -fFlyUp);
//set_pev(ent, pev_nextthink, get_gametime()+0.1);
set_pev(ent, pev_nextthink, get_gametime()+2.0);
dllfunc(DLLFunc_Spawn,ent);
set_pev(ent, pev_solid, SOLID_TRIGGER);
engfunc(EngFunc_SetSize,ent,fMins,fMaxs);
return FMRES_IGNORED;
}