Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <camer>
- public void OnPluginStart()
- {
- for(int i = 1; i<=MaxClients; i++)
- {
- if(IsValidClient(i))
- SDKHook(i, SDKHook_WeaponEquipPost, OnPostWeaponEquip);
- }
- }
- public void OnClientPutInServer(int client)
- {
- if (!IsFakeClient(client))
- SDKHook(client, SDKHook_WeaponEquipPost, OnPostWeaponEquip);
- }
- public Action OnPostWeaponEquip(int client, int entity)
- {
- char sName[128];
- GetEntityClassname(entity, sName, sizeof(sName));
- CreateTimer(0.1, done, GetClientUserId(client));
- }
- public Action done(Handle timer, any userid)
- {
- int client = GetClientOfUserId(userid);
- if (!IsValidClient(client))return;
- int wp = GetPlayerWeaponSlot(client, 0);
- int wp2 = GetPlayerWeaponSlot(client, 1);
- if(wp != -1)
- SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", wp);
- else if(wp2 != -1)
- SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", wp2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement