I am looking to change a users velocity if he touches a certain entity and it will boost him forward.
__-```-__
this is normal jump
__---````````````---__
this is boost jump after touch entity
Get the idea ?
I have this already maybe im stupid on my code.
Code:
public plugin_init()
{
(...)
register_forward(FM_Touch, "fwdTouch", 0);
register_forward(FM_PlayerPreThink, "client_PreThink");
(...)
}
public client_PreThink(id)
{
if(!is_user_alive(id))
return PLUGIN_CONTINUE;
new flags = pev(id, pev_flags);
if(hasboost[id])
{
if(flags & FL_ONGROUND)
{
set_pev(id,pev_velocity,{0.0, 0.0, 0.0});
hasboost[id] = false;
return PLUGIN_CONTINUE;
}
}
return PLUGIN_CONTINUE;
}
public fwdTouch(ent, id)
{
(...)
new Float:velocity[] = {0.0, 128.0, 0.0};
(...)
else if(equali(szClassname, "booster"))
{
set_pev(id,pev_velocity,velocity);
hasboost[id] = true;
return PLUGIN_HANDLED_MAIN;
}
return PLUGIN_HANDLED_MAIN;
}