I didn't use your conversion and it works so i couln't tell you what's wrong, may be something with the strings, i declare them as global const.
Also you don't need cstrike module, and you don't need a task to make the flare die.
Code:
#include <amxmodx>
#include <fakemeta>
#pragma semicolon 1
#define OFFSET_CSMONEY 115
new const FLARE_CLASSNAME[] = "Flare";
new const FLARE_MODEL[] = "models/w_flare.mdl";
new const FLARE_SOUND[] = "weapons/rocketfire1.wav";
new FlareAmmo[33];
new pcvar_flare_cost, pcvar_flare_max, pcvar_flare_duration;
new gmsgMoney;
public plugin_init() {
register_plugin("Flares","2.0","Calzinger");
pcvar_flare_cost = register_cvar("flare_cost","400");
pcvar_flare_max = register_cvar("flare_max","5");
pcvar_flare_duration = register_cvar("flare_duration","10.0");
register_forward(FM_Think,"fwdThink");
register_clcmd("say /buyflare","AddFlare",0,": Buy a flare");
register_clcmd("shootflare","InitFlare",0,": Shoot a flare");
register_clcmd("say /shootflare","InitFlare",0,": Shoot a flare");
gmsgMoney = get_user_msgid("Money");
}
public plugin_precache() {
engfunc(EngFunc_PrecacheModel, FLARE_MODEL);
engfunc(EngFunc_PrecacheSound, FLARE_SOUND);
}
public client_putinserver(id) {
FlareAmmo[id] = 0;
}
public AddFlare(id) {
new cost = get_pcvar_num(pcvar_flare_cost);
new Max = get_pcvar_num(pcvar_flare_max);
new Money = __cs_get_user_money(id);
if ( Money < cost ) {
client_print(id,print_chat,"[FLARE-X] You do not have enough money to buy a flare. You need $%i.",cost);
}
else {
if ( FlareAmmo[id] >= Max ) {
client_print(id,print_chat,"[FLARE-X] You have your max number of flares: %i.",Max);
}
else {
__cs_set_user_money(id, Money - cost);
FlareAmmo[id]++;
client_print(id,print_chat,"[FLARE-X] You have bought one flare for $%i. Now you have %i flares.",cost,FlareAmmo[id]);
}
}
return PLUGIN_HANDLED;
}
public InitFlare(id) {
if (!is_user_alive(id))
return PLUGIN_HANDLED;
if ( !FlareAmmo[id] )
{
client_print(id,print_chat,"[FLARE-X] You are out of flares.");
return PLUGIN_HANDLED;
}
new Float:PlayerOrigin[3];
pev(id,pev_origin,PlayerOrigin);
new flare = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
set_pev(flare, pev_classname, FLARE_CLASSNAME);
engfunc(EngFunc_SetModel, flare, FLARE_MODEL);
engfunc(EngFunc_SetOrigin,flare, PlayerOrigin);
set_pev(flare, pev_solid, SOLID_BBOX);
set_pev(flare,pev_owner,id);
set_pev(flare,pev_movetype,MOVETYPE_STEP);
set_pev(flare,pev_gravity,0.5);
set_pev(flare,pev_effects,EF_BRIGHTLIGHT);
new Float:PlayerVelocity[3];
velocity_by_aim(id,1000,PlayerVelocity);
set_pev(flare, pev_velocity, PlayerVelocity);
FlareAmmo[id]--;
engfunc(EngFunc_EmitSound, flare, CHAN_BODY, FLARE_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
set_pev(flare, pev_nextthink, get_gametime() + get_pcvar_float(pcvar_flare_duration));
return PLUGIN_HANDLED;
}
public fwdThink(ent) {
if(!pev_valid(ent))
return FMRES_IGNORED;
static classname[33];
pev(ent, pev_classname, classname, sizeof classname - 1);
if(!equal(classname,FLARE_CLASSNAME))
return FMRES_IGNORED;
engfunc(EngFunc_RemoveEntity, ent);
return FMRES_IGNORED;
}
__cs_get_user_money(index)
{
return get_pdata_int(index, OFFSET_CSMONEY);
}
__cs_set_user_money(index, money, flash = 1)
{
set_pdata_int(index, OFFSET_CSMONEY, money);
message_begin(MSG_ONE, gmsgMoney, _, index);
write_long(money);
write_byte(flash ? 1 : 0);
message_end();
}