#include <cstrike>
public void OnPluginStart()
{
HookEvent("player_spawn", EventSpawn);
}
public Action EventSpawn(Event hEvent, const chat sEvent, bool bdb)
{
int client = GetClientOfUserId(hEvent.GetInt("userid"));
if(client && IsClientInGame(client) && !IsFakeClient(client))
{
// int ent = GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY;
// if(ent != -1)
// {
// char buff[32];
// GetEntityClassname(ent, buff, sizeof(buff));
// if(!strcmp(buff, "weapon_awp"))
// {
// CS_DropWeapon(client, ent, true, false);
// RemoveEntity(ent);
// }
// } удалять AWP
for(int i = 0; i <= 4 ; i++)
{
if(GetPlayerWeaponSlot(client, i) != -1)
{
CS_DropWeapon(client, i, true, false);
RemoveEntity(i); //удалять все оружия в инвентаре
}
}
GetItem(knife, client);
GetItem(glock, client);
}
}
void GetItem(char[] item, int client)
{
float pos[3];
char buff[32];
GetClientAbsOrigin(client, pos);
Format(buff, sizeof(buff), "weapon_%s", item);
int i = CreateEntityByName(buff);
if(i < 1) return;
DispatchKeyValueVector(i, "origin", pos);
DispatchKeyValue(i, "spawnflags", "1");
DispatchSpawn(i);
}