View Single Post
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 03-03-2020 , 14:30   Re: SwitchToSlot function with new syntax
Reply With Quote #4

Thanks Guys! I updated the code with your suggestions and it works great!

Final solution:
PHP Code:
stock void TF2_SwitchtoSlot(int clientint slot)
{
    if (
slot >= && slot <= && IsClientInGame(client) && IsPlayerAlive(client))
    {
        
char wepclassname[64];
        
int wep GetPlayerWeaponSlot(clientslot);
        if (
wep MaxClients && IsValidEdict(wep) && GetEdictClassname(wepwepclassnamesizeof(wepclassname)))
        {
            
FakeClientCommandEx(client"use %s"wepclassname);
            
SetEntPropEnt(clientProp_Send"m_hActiveWeapon"wep);
        }
    }

PC Gamer is offline