Hi Everyone,
I've tired to create VIP for my server which will have ability to run with the same speed with every weapon.
This is what I've got so far and it doesn't work. I call this function on WeaponSwtich and SpawnPost.
PHP Code:
public Action: set_speed(client)
{
new float:MyMax = GetEntProp(client, Prop_Data, "m_flMaxSpeed");
if (g_Vip[client] && (MyMax<235.0))
g_iPlayerSpeed[client] = 235.0;
else
{
int ActWpn = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
new String:Weapon[32];
GetEntityClassname(ActWpn, Weapon, sizeof(Weapon));
if(ActWpn == INVALID_ENT_REFERENCE)
{
g_iPlayerSpeed[client] = gCSWeaponSpeed[view_as<int>(CSGOWeaponID_NONE)];
return Plugin_Continue;
}
g_iPlayerSpeed[client] = gCSWeaponSpeed[view_as<int>(WeaponClassNameToCSWeaponID(Weapon))];
}
if(g_iPlayerSpeed[client] != MyMax)
SetEntProp(client, Prop_Data, "m_flMaxSpeed", g_iPlayerSpeed[client]);
}
Of course, I have stock with all weapon classnames converted to CSGOWeaponID and speeds, which I am using to adjust speed for non-Vip players.
The second problem I have is that I cannot give my Vip speed over 250.