Raised This Month: $32 Target: $400
 8% 

Hide only Secondary Weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kubad
Senior Member
Join Date: Sep 2015
Location: Czech Republic
Old 11-18-2017 , 09:02   Hide only Secondary Weapon
Reply With Quote #1

Hello guys i need hide weapons in slot 2 with pistol but i dont have idea how. Im happy for all answers
Kubad is offline
BassPower
Member
Join Date: Mar 2011
Location: Lithuania
Old 11-20-2017 , 03:39   Re: Hide only Secondary Weapon
Reply With Quote #2

Quote:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

public void OnPluginStart()
{
HookEvent("round_start", Event_RoundStartMode, EventHookMode_PostNoCopy);
}

public Action Event_RoundStartMode(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
WeaponSlotSecondary(client);
}

public void WeaponSlotSecondary(int client)
{
if (IsValidClient(client))
{
int iTeam = GetClientTeam(client);
if (iTeam > CS_TEAM_SPECTATOR)
{
int iWeapon = GetPlayerWeaponSlot(client, 1);
if (IsValidEdict(iWeapon))
{
RemovePlayerItem(client, iWeapon);
RemoveEdict(iWeapon);
}
}
}
}

stock bool IsValidClient(int client)
{
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) > CS_TEAM_SPECTATOR)
{
return true;
}
return false;
}
here is code to remove secondary weapons, you can do it on round start

Last edited by BassPower; 11-20-2017 at 03:40. Reason: add IsValidClient
BassPower is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode