#pragma semicolon 1
#include <weapons>
#include <sdktools_functions>
#pragma newdecls required
public void OnPluginStart()
{
HookEvent("player_spawn", Spawn);
}
public void Spawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (client && IsClientInGame(client))
{
if (!Client_HasWeaponKnife(client,"weapon_knife", true))
{
GivePlayerItem(client, "weapon_knife");
}
}
}
Не сработало.Библиотека weapons
C-подобный:#pragma semicolon 1 #include <weapons> #include <sdktools_functions> #pragma newdecls required public void OnPluginStart() { HookEvent("player_spawn", Spawn); } public void Spawn(Event event, const char[] name, bool dontBroadcast) { int client = GetClientOfUserId(event.GetInt("userid")); if (client && IsClientInGame(client)) { if (!Client_HasWeaponKnife(client,"weapon_knife", true)) { GivePlayerItem(client, "weapon_knife"); } } }
Компилю на последней версии, ошибка с инклудом weapons.inc@vardan001, ты библиотеку то засунул в include? без нее он не скомпилирует. Компилируй на версии 1.7.x не ниже.
так я в посте с кодом указал, ссылку на библиотеку weapons.Компилю на последней версии, ошибка с инклудом weapons.inc
А ещё что-нибудь придумать нельзя?)#include <weapons>
#pragma semicolon 1
#include <sdktools_functions>
#pragma newdecls required
public void OnPluginStart()
{
HookEvent("player_spawn", Spawn);
}
public void Spawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid")), knife = GetPlayerWeaponSlot(client, 2);
if (knife == -1) GivePlayerItem(client, "weapon_knife");
}