Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
new Handle:WC_hLimitCount;
new WC_iLimitCount = 1;
new WC_iLastWeapon = -1;
new WC_iLastClient = -1;
new String:WC_sLastWeapon[64];
public WC_OnModuleStart()
{
WC_hLimitCount = CreateConVar("limit_melee", "1", "Limits the maximum number of melee weapons at one time to this number", 0, true, 0.0, true, 4.0);
HookConVarChange(WC_hLimitCount, WC_ConVarChange);
WC_iLimitCount = GetConVarInt(WC_hLimitCount);
HookEvent("player_use", WC_PlayerUse_Event);
HookEvent("weapon_drop", WC_WeaponDrop_Event);
}
public WC_ConVarChange(Handle:convar, const String:oldValue[], const String:newValue[])
{
WC_iLimitCount = GetConVarInt(WC_hLimitCount);
}
public Action:WC_WeaponDrop_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
WC_iLastWeapon = GetEventInt(event, "propid");
WC_iLastClient = GetClientOfUserId(GetEventInt(event, "userid"));
GetEventString(event, "item", WC_sLastWeapon, sizeof(WC_sLastWeapon));
}
public Action:WC_PlayerUse_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
if (!IsPluginEnabled()) return;
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new secondary = GetPlayerWeaponSlot(client, 0);
if (!IsValidEdict(secondary)) return;
decl String:secondary_name[64];
GetEdictClassname(secondary, secondary_name, sizeof(secondary_name));
if (StrEqual(secondary_name, "weapon_melee"))
{
if (MeleeWeaponCount(client) >= WC_iLimitCount)
{
if (IsValidEdict(secondary))
{
RemovePlayerItem(client, secondary);
PrintToChat(client, "Maximum %d melee(s) is enforced.", WC_iLimitCount);
}
if (WC_iLastClient == client)
{
if (IsValidEdict(WC_iLastWeapon))
{
AcceptEntityInput(WC_iLastWeapon, "Kill");
new flags = GetCommandFlags("give");
SetCommandFlags("give", flags ^ FCVAR_CHEAT);
decl String:sTemp[64];
Format(sTemp, sizeof(sTemp), "give %s", WC_sLastWeapon);
FakeClientCommand(client, sTemp);
SetCommandFlags("give", flags);
}
}
}
}
WC_iLastWeapon = -1;
WC_iLastClient = -1;
WC_sLastWeapon[0] = 0;
}
MeleeWeaponCount(client)
{
new count = 0;
for (new i = 0; i < 4; i++)
{
new index = GetSurvivorIndex(i);
if (index != client && index != 0 && IsClientConnected(index))
{
new ent = GetPlayerWeaponSlot(index, 0);
if (IsValidEdict(ent))
{
decl String:temp[64];
GetEdictClassname(ent, temp, sizeof(temp));
if (StrEqual(temp, "weapon_melee")) count++;
}
}
}
return count;
}
obviously i have no idea what im doing
Quote:
/groups/sourcemod/upload_tmp/texthiUQip.sp(46) : error 017: undefined symbol "IsPluginEnabled"
/groups/sourcemod/upload_tmp/texthiUQip.sp(93) : error 017: undefined symbol "GetSurvivorIndex"
2 Errors.
|
im assuming i can remove the line "ispluginenabled" since that probalby refers to the overall confogl package?
from "researching" the other error, i gahter i am missing parts of code for getsurvivorindex, but i can't find where in the confogl package that code is defined.