Kruzya
Участник
- Сообщения
- 12,970
- Реакции
- 10,914
- Команда форума
- #61
Понасокращают названия переменных, блин, а потом пытайся это читать...
@niko7d,
@niko7d,
PHP:
#include <sdktools_functions>
#pragma newdecls required
#pragma semicolon 1
stock const char g_szProps[][] = { "m_bSilencerOn", "m_weaponMode" };
public void OnPluginStart() {
HookEvent("item_pickup", EventItemPickup);
}
public void EventItemPickup(Handle hEvent, const char[] szName, bool bDontBroadcast) {
char szItem[12];
GetEventString(hEvent, "item", szItem, sizeof(szItem));
if (strcmp(szItem, "m4a1"))
return;
int client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
if (!client)
return;
int weapon = GetPlayerWeaponSlot(client, 0);
if (weapon == -1)
return;
for (int iEntProp; iEntProp < sizeof(g_szProps); iEntProp++)
if (HasEntProp(weapon, Prop_Send, g_szProps[iEntProp]))
SetEntProp(weapon, Prop_Send, g_szProps[iEntProp], 1);
}