I've managed to get this running, but I've got a problem with jumps now. My Vip has a double jump feature and if I jump too high and then change weapon to say: Negev, I got hurt by fall.
My code looks now like:
PHP Code:
public Action:set_speed(client)
{
new Float:Speed = 1.0;
new Float:WpnSpeed;
new String:Diff[16];
if(g_Vip[client])
{
int ActWpn = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
new String:Weapon[32];
GetEntityClassname(ActWpn, Weapon, sizeof(Weapon));
WpnSpeed = float(gCSWeaponSpeed[view_as<int>(WeaponClassNameToCSWeaponID(Weapon))]);
if(ActWpn == INVALID_ENT_REFERENCE)
{
Speed = 1.0;
return Plugin_Continue;
}
if(WpnSpeed<235.0)
{
Format(Diff, sizeof(Diff), "%.2f", 1.0-(WpnSpeed/235.0));
Speed = 1.0 + StringToFloat(Diff);
}
else
Speed = 1.0;
}
SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", Speed);
return Plugin_Continue;
}
I am still calling this function at OnWeaponChange and SpawnPost. I've tried to restore multiplier to 1.0 after player's jump, but it doesn't work.
PHP Code:
if (g_Vip[client])
{
static bool:Old[MAXPLAYERS+1];
if(!Old[client] && (buttons & IN_JUMP))
{
SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 1.0);
Old[client] = true;
}
else if(Old[client] && !(buttons & IN_JUMP))
Old[client] = false;
new flags = GetEntityFlags(client);
if(flags & FL_ONGROUND)
{
set_speed(client);
}
}
Any ideas on it? I will appreciate any help.