/
bason
/
WCS
Обзор
Документация
Войти
/
bason
/
WCS
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
events.sp
990 строк
26 KB
bason
upload files
11 авг 2025, 13:07
11 авг 2025, 13:07
223dcb5
Код
Авторство
О чём код?
public Action GetPutInServer(Handle ptTimer) { for (int i = 1; i < MaxClients; i++) { if (IsClientInGame(i)) { OnClientPostAdminCheck(i); } } } public void OnClientPostAdminCheck(int lClient) { if (!GetClientAuthId(lClient, AuthId_Engine, sSid[lClient], 32, true)) { CreateTimer(1.0, PlayerReconnect, GetClientUserId(lClient), 1); return; } if (IsFakeClient(lClient)) { SDKHook(lClient, view_as<SDKHookType>(14), OnWeaponUse); SDKHook(lClient, view_as<SDKHookType>(2), OnTakeDamage); CreateVars(lClient); return; } CreateVars(lClient); if (cv_downloads.IntValue == 1) { QueryClientConVar(lClient, "cl_downloadfilter", OnDownloadsCheck, 0); } char sLoadBuff[152]; FormatEx(sLoadBuff, 150, "SELECT totalvl, race, cat FROM pinfo WHERE sid = '%s'", sSid[lClient]); db_wcs.Query(SQL_LoadPlayerInfo, sLoadBuff, GetClientUserId(lClient), DBPrio_Normal); } public Action PlayerReconnect(Handle hRc, int rcClient) { rcClient = GetClientOfUserId(rcClient); if (rcClient && IsClientInGame(rcClient)) { if (!GetClientAuthId(rcClient, AuthId_Engine, sSid[rcClient], 32, true)) { return Plugin_Continue; } OnClientPostAdminCheck(rcClient); } return Plugin_Stop; } public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float dDamageForce[3], float dDamagePosition[3]) // address: 106848 { if (damagetype == 16) { return Plugin_Continue; } if (damagetype == 268435464) { if (game == 2) { damage = 0.0; return Plugin_Changed; } damagetype = 8; } bool bAttackerIsAngry = false; bool bChange = false; if (attacker > 0 && attacker <= MaxClients) { bAttackerIsAngry = true; if (!game) { weapon = GetEntPropEnt(attacker, Prop_Send, "m_hActiveWeapon", 0); } if (!IsPlayerAlive(attacker)) { if (WCS_CheckSpellFeatures(attacker, "team_abuse", view_as<sf_type>(0))) { damage = 0.0; bChange = true; } } if (weapon > 0 && GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType", 4, 0) == game_shotgun_ammo && GetClientTeam(attacker) != GetClientTeam(victim) && inflictor == attacker) { float fTickTime = GetTickedTime(); if (fTickTime == wc_LastActionTime[victim]) { wc_ShotGunDamage[victim] += damage; } else { wc_LastActionTime[victim] = fTickTime; wc_ShotGunDamage[victim] = damage; wc_ShotGunOwner[victim] = attacker; RequestFrame(DoShotGunDamage, victim); } damage = 0.0; return Plugin_Changed; } } bool bAttackAccess = false; bool bVictimAccess = false; if (bAttackerIsAngry && GetClientTeam(attacker) != GetClientTeam(victim) && spells[attacker][0]) { bAttackAccess = true; } if (damagetype == 8) { if (WCS_CheckSpellFeatures(victim, "fire_immune", view_as<sf_type>(0))) { damage = 0.0; bChange = true; } else { if (bAttackerIsAngry) { int iFireFeatures = 0; WCS_GetSpellFeatures(attacker, "molotov_damage", iFireFeatures, view_as<sf_type>(0)); if (iFireFeatures > 0) { damage = float(iFireFeatures); bChange = true; } } else { int iFireFeatures = 0; iFireFeatures = GetEntPropEnt(victim, Prop_Data, "m_hEffectEntity", 0); if (iFireFeatures > 0) { float iFireDamage = 0.0; WCS_GetSpellFeatures(victim, "fire_damage", iFireDamage, view_as<sf_type>(1)); damage = iFireDamage; bChange = true; } } } bAttackAccess = false; } if (spells[victim][1]) { if (bAttackerIsAngry && GetClientTeam(attacker) == GetClientTeam(victim)) { bVictimAccess = false; } else { bVictimAccess = true; } } if (bAttackAccess || bVictimAccess) { bool bTraceState = false; char sHurtCmdInfo[152]; if (bAttackAccess) { int aValues = 0; StringMap mAttackSkills = null; Handle aPlugin = null; int aAttackCheck = spells[attacker][0].Length; for (int a = 0; a < aAttackCheck; a++) { sHurtCmdInfo[0] = '\0'; mAttackSkills = GetArrayCell(spells[attacker][0], a, 0, false); mAttackSkills.GetValue("learned", aValues); if (!aValues) { continue; } if (mAttackSkills.GetValue("chance", aValues)) { if (iMultiDamageGame == 1) { aValues = 1; } if (GetRandomInt(1, 100) > aValues) { continue; } } if (mAttackSkills.GetString("weapon", sHurtCmdInfo, 28, _)) { if (game == 2) { if (weapon == -1 || GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType", 4, 0) == -1) { GetEntityClassname((weapon == -1) ? (inflictor) : (weapon), wc_WeaponInfo[attacker], 28); if (StrEqual(wc_WeaponInfo[attacker], "player", true)) { weapon = GetEntPropEnt(attacker, Prop_Send, "m_hActiveWeapon", 0); IntToString(GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex", 4, 0), wc_WeaponInfo[attacker], 28); goItems.GetString(wc_WeaponInfo[attacker], wc_WeaponInfo[attacker], 28, _); } } else { IntToString(GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex", 4, 0), wc_WeaponInfo[attacker], 28); goItems.GetString(wc_WeaponInfo[attacker], wc_WeaponInfo[attacker], 28, _); } } else { if (weapon == -1) { weapon = inflictor; } GetEntityClassname(weapon, wc_WeaponInfo[attacker], 28); } if (!StrEqual(sHurtCmdInfo, wc_WeaponInfo[attacker], true)) { continue; } } mAttackSkills.GetString("turncmd", sHurtCmdInfo, 150, _); if (sHurtCmdInfo[0]) // Array { mAttackSkills.GetValue("reverse", aValues); if (aValues) { ServerCommand("%s %f %d %d", sHurtCmdInfo, damage, victim, attacker); } else { ServerCommand("%s %f %d %d", sHurtCmdInfo, damage, attacker, victim); } } if (mAttackSkills.GetValue("trace", aPlugin)) { mAttackSkills.GetString("trace_turn", sHurtCmdInfo, 32, _); Call_StartFunction(aPlugin, GetFunctionByName(aPlugin, sHurtCmdInfo)); Call_PushCell(attacker); Call_PushCell(victim); Call_PushFloatRef(damage); Call_PushCellRef(damagetype); mAttackSkills.GetString("trace_values", sHurtCmdInfo, 50, _); Call_PushString(sHurtCmdInfo); Call_Finish(bTraceState); if (!bChange) { bChange = bTraceState; } } mAttackSkills.GetString("effects", sHurtCmdInfo, 150, _); if (sHurtCmdInfo[0]) // Array { InitEffects(attacker, victim, sHurtCmdInfo); } } } if (bVictimAccess) { int vValues = 0; StringMap vAttackSkills = null; Handle vPlugin = null; int vVictimCheck = spells[victim][1].Length; for (int v = 0; v < vVictimCheck; v++) { sHurtCmdInfo[0] = '\0'; vAttackSkills = GetArrayCell(spells[victim][1], v, 0, false); vAttackSkills.GetValue("learned", vValues); if (!vValues) { continue; } if (vAttackSkills.GetValue("chance", vValues)) { if (iMultiDamageGame == 1) { vValues = 1; } if (GetRandomInt(1, 100) > vValues) { continue; } } vAttackSkills.GetString("turncmd", sHurtCmdInfo, 150, _); if (sHurtCmdInfo[0] && bAttackerIsAngry) { vAttackSkills.GetValue("reverse", vValues); if (vValues) { ServerCommand("%s %f %d %d", sHurtCmdInfo, damage, attacker, victim); } else { ServerCommand("%s %f %d %d", sHurtCmdInfo, damage, victim, attacker); } } if (vAttackSkills.GetValue("trace", vPlugin)) { vAttackSkills.GetString("trace_turn", sHurtCmdInfo, 32, _); Call_StartFunction(vPlugin, GetFunctionByName(vPlugin, sHurtCmdInfo)); Call_PushCell(attacker); Call_PushCell(victim); Call_PushFloatRef(damage); Call_PushCellRef(damagetype); vAttackSkills.GetString("trace_values", sHurtCmdInfo, 50, _); Call_PushString(sHurtCmdInfo); Call_Finish(bTraceState); if (!bChange) { bChange = bTraceState; } } vAttackSkills.GetString("effects", sHurtCmdInfo, 150, _); if (sHurtCmdInfo[0] && bAttackerIsAngry) { InitEffects(victim, attacker, sHurtCmdInfo); } } } } wc_LastDamageType[victim] = damagetype; if (bChange) { if (wc_extraReturn[victim]) { wc_extraReturn[victim] = false; return Plugin_Handled; } return Plugin_Changed; } return Plugin_Continue; } void CallSpellActivateEvent(int iClient, char[] SpellName) { Call_StartForward(FD_SpellActivate); Call_PushCell(iClient); Call_PushString(SpellName); Call_Finish(_); } public void OnPlayerRespawn(Event eEvent, char[] strName, bool bDontBroadcast) { int iRespawn = GetClientOfUserId(eEvent.GetInt("userid", 0)); if (iRespawn && IsClientInGame(iRespawn) && IsPlayerAlive(iRespawn) && GetClientTeam(iRespawn) > 1 && raceinfo_iRaceid[iRespawn] > 0 && !(wc_UserStatus[iRespawn] & 8)) { PrintToChat(iRespawn, "\n \n \n "); WCS_PrintToChat(iRespawn, "%t", "Your race print", raceinfo_sName[iRespawn]); WCS_PrintToChat(iRespawn, "%t", "Lvl and xp print", wc_iRaceLvl[iRespawn], wc_iRaceXp[iRespawn], cv_XpPerLvl.IntValue * (wc_iRaceLvl[iRespawn] + 1)); ClearTrie(mSpellFeatures[iRespawn]); if (wc_UserCondition[iRespawn] & 2) { UpdateSpells(iRespawn); wc_UserCondition[iRespawn] &= -3; } if (hRestricts[iRespawn] && wc_UserCondition[iRespawn] & 4) { WCS_RestrictWeapons(iRespawn, true, ""); } SetEntityRenderColor(iRespawn, 255, 255, 255, 255); SetEntityGravity(iRespawn, 1.0); wc_AttackSpeed[iRespawn] = 1.0; if (wc_SpawnCmdInfo[iRespawn][0]) { ServerCommand(wc_SpawnCmdInfo[iRespawn]); } int iSpawnInfo = 0; if (hUltimate[iRespawn]) { GetTrieValue(hUltimate[iRespawn], "learned", iSpawnInfo); if (iSpawnInfo) { float fNewCd = 0.0; GetTrieValue(hUltimate[iRespawn], "cd", fNewCd); ultimate_cd[iRespawn] = GetEngineTime() + fNewCd; } } if (spells[iRespawn][2]) { StringMap mSpawnSkills = null; char sSpawnInfo[152]; int iSpawnsCheck = spells[iRespawn][2].Length; for (int s = 0; s < iSpawnsCheck; s++) { mSpawnSkills = GetArrayCell(spells[iRespawn][2], s, 0, false); mSpawnSkills.GetValue("learned", iSpawnInfo); if (!iSpawnInfo) { continue; } if (mSpawnSkills.GetValue("chance", iSpawnInfo)) { if (GetRandomInt(1, 100) > iSpawnInfo) { continue; } } mSpawnSkills.GetString("turncmd", sSpawnInfo, 150, _); ServerCommand("%s %d", sSpawnInfo, iRespawn); } } if (wc_UserCondition[iRespawn] & 8) { RemoveTempSpells(iRespawn); wc_UserCondition[iRespawn] &= -9; } if (wc_bRespawned[iRespawn]) { wc_bRespawned[iRespawn] = false; } } } public Action OnPlayerRip(Event r_Event, char[] strName, bool bDontBroadcast) { // #emit load.s.pri 0 bool bKillAdvert = false; int iTrupak = GetClientOfUserId(r_Event.GetInt("userid", 0)); int iKrutoi = GetClientOfUserId(r_Event.GetInt("attacker", 0)); if (wc_LastDamageType[iTrupak] & 8) { if (iKrutoi < 1) { WCS_GetSpellFeatures(iTrupak, "fire_attacker", iKrutoi, view_as<sf_type>(0)); if (iKrutoi > 0 && IsClientInGame(iKrutoi)) { r_Event.SetInt("attacker", GetClientUserId(iKrutoi)); } r_Event.SetString("weapon", "inferno"); bKillAdvert = true; } } if (iKrutoi > 0 && IsClientInGame(iKrutoi)) { if (iTrupak != iKrutoi) { if (r_Event.GetBool("headshot", false) == true && cv_XpHeadshot.IntValue > 0) { GiveXp(iKrutoi, cv_XpKill.IntValue + cv_XpHeadshot.IntValue, "за убийство в голову", false, iKrutoi, 0); } else { GiveXp(iKrutoi, cv_XpKill.IntValue, "за убийство", false, iKrutoi, 0); } if (!wc_bRespawned[iKrutoi] && wc_iSouls[iKrutoi] < 5) { wc_iSouls[iKrutoi] += 1; } if (WCS_CheckSpellFeatures(iKrutoi, "kill_advert", view_as<sf_type>(0))) { char sKillWeapon[24]; GetTrieString(mSpellFeatures[iKrutoi], "kill_weapon", sKillWeapon, 22, _); r_Event.SetString("weapon", sKillWeapon); if (WCS_CheckSpellFeatures(iKrutoi, "kill_headshot", view_as<sf_type>(0))) { r_Event.SetBool("headshot", true); } bKillAdvert = true; } if (spells[iKrutoi][4]) { ActivateSpells(iKrutoi, 4, iTrupak); } } if (game == 2) { int assister = r_Event.GetInt("assister", 0); if (assister > 0 && cv_xp_assist.IntValue > 0) { assister = GetClientOfUserId(assister); if (GetClientTeam(assister) != GetClientTeam(iTrupak)) { GiveXp(assister, cv_xp_assist.IntValue, "за помощь в убийстве", false, assister, 0); } } } } if (spells[iTrupak][3]) { ActivateSpells(iTrupak, 3, iKrutoi); } if (!wc_bRespawned[iTrupak] && wc_iSouls[iTrupak] < 5) { wc_iSouls[iTrupak] += 1; } if (!bKillAdvert && game == 2) { if (WCS_CheckSpellFeatures(iTrupak, "death_advert", view_as<sf_type>(0))) { char sKillWeapon[24]; GetTrieString(mSpellFeatures[iTrupak], "kill_weapon", sKillWeapon, 22, _); r_Event.SetString("weapon", sKillWeapon); if (WCS_CheckSpellFeatures(iTrupak, "kill_headshot", view_as<sf_type>(0))) { r_Event.SetBool("headshot", true); } bKillAdvert = true; } else { switch (wc_LastDamageType[iTrupak]) { case 64, 65: { r_Event.SetString("weapon", "prop_exploding_barrel"); r_Event.SetBool("headshot", false); bKillAdvert = true; } case 2: { r_Event.SetString("weapon", "magic"); r_Event.SetBool("headshot", false); bKillAdvert = true; } } } } if (bKillAdvert) { r_Event.SetString("weapon_itemid", "0"); r_Event.SetString("weapon_fauxitemid", ""); return Plugin_Changed; } return Plugin_Continue; } void ActivateSpells(int iWhoActivate, int iSpellType, int iSpellTarget) { StringMap mSpellsInfo = null; char sSpellsInfo[152]; int iSpellsInfo = 0; int iSpellsLen = spells[iWhoActivate][iSpellType].Length; for (int d = 0; d < iSpellsLen; d++) { mSpellsInfo = GetArrayCell(spells[iWhoActivate][iSpellType], d, 0, false); mSpellsInfo.GetValue("learned", iSpellsInfo); if (!iSpellsInfo) { continue; } if (mSpellsInfo.GetValue("chance", iSpellsInfo)) { if (iMultiDamageGame == 1) { iSpellsInfo = 1; } if (GetRandomInt(1, 100) > iSpellsInfo) { continue; } } mSpellsInfo.GetString("turncmd", sSpellsInfo, 150, _); mSpellsInfo.GetValue("reverse", iSpellsInfo); if (iSpellsInfo) { ServerCommand("%s %d %d", sSpellsInfo, iWhoActivate, iSpellTarget); } else { ServerCommand("%s %d %d", sSpellsInfo, iSpellTarget, iWhoActivate); } } } public Action OnWeaponUse(int wpnClient, int wpnId) { if (hRestricts[wpnClient] && wc_UserCondition[wpnClient] & 4) { int iRestMode = 0; GetTrieValue(hRestricts[wpnClient], "mode", iRestMode); char wName[28]; if (game == 2 && GetEntProp(wpnId, Prop_Send, "m_iPrimaryAmmoType", 4, 0) != -1) { IntToString(GetEntProp(wpnId, Prop_Send, "m_iItemDefinitionIndex", 4, 0), wName, 28); if (!goItems.GetString(wName, wName, 28, _)) { return Plugin_Continue; } } else { GetEntityClassname(wpnId, wName, 22); } int iRestAny = 0; GetTrieValue(hRestricts[wpnClient], wName, iRestAny); if (iRestMode == 1) { if (iRestAny != 1) { return Plugin_Handled; } } else { if (iRestAny == 1) { return Plugin_Handled; } } } return Plugin_Continue; } public void OnPlayerJump(Event j_Event, char[] strName, bool bDontBroadcast) { int iJump = GetClientOfUserId(j_Event.GetInt("userid", 0)); if (WCS_CheckSpellFeatures(iJump, "longjump", view_as<sf_type>(0))) { float fJumpPower = 0.0; WCS_GetSpellFeatures(iJump, "jump_power", fJumpPower, view_as<sf_type>(1)); float jumpvec[3]; jumpvec[0] = GetEntPropFloat(iJump, Prop_Send, "m_vecVelocity[0]", 0) * fJumpPower; jumpvec[1] = GetEntPropFloat(iJump, Prop_Send, "m_vecVelocity[1]", 0) * fJumpPower; jumpvec[2] = 0.0; SetEntPropVector(iJump, Prop_Send, "m_vecBaseVelocity", jumpvec, 0); } } public Action OnPlayerFire(Event f_Event, char[] strName, bool bDontBroadcast) { RequestFrame(OnPlayerFire_Post, f_Event.GetInt("userid", 0)); } public void OnPlayerFire_Post(int iUser) { iUser = GetClientOfUserId(iUser); if (iUser == 0 || IsPlayerAlive(iUser) == false) { return; } if (1.0 != wc_AttackSpeed[iUser] && 0.0 != wc_AttackSpeed[iUser]) { int iWeapon = GetEntPropEnt(iUser, Prop_Data, "m_hActiveWeapon", 0); if (iWeapon > 0) { float fTime = GetGameTime(); float fNextTime = GetEntPropFloat(iWeapon, Prop_Send, "m_flNextPrimaryAttack", 0); fNextTime = fNextTime - fTime; fNextTime = fNextTime * wc_AttackSpeed[iUser]; fNextTime = fNextTime + fTime; SetEntPropFloat(iWeapon, Prop_Send, "m_flNextPrimaryAttack", fNextTime, 0); SetEntPropFloat(iUser, Prop_Send, "m_flNextAttack", 0.0, 0); } } } public void OnRoundStart(Event event, char[] strName, bool bDontBroadcast) { // #emit load.s.pri 0 g_bUltimateAccess = false; g_bEndRound = false; g_iGameTime = GetTime(_) + 10; if (game == 2) { ConVar allTalk = FindConVar("sv_full_alltalk"); allTalk.SetInt(1, false, false); delete allTalk; } } public void OnRoundPlay(Event event, char[] strName, bool bDontBroadcast) { g_bUltimateAccess = true; } public void OnRoundEnd(Event event, char[] strName, bool bDontBroadcast) { g_bEndRound = true; if (GetClientCount(true) < 2 || GetTime(_) < g_iGameTime || cv_XpEndRound.IntValue < 1) { return; } for (int p = 1; p <= MaxClients; p++) { if (IsClientInGame(p) && GetClientTeam(p) > 1) { GiveXp(p, cv_XpEndRound.IntValue, "за окончание раунда", true, 0, 0); } } } public void OnPlayerBlind(Event blEvent, char[] blName, bool dontBroadcast) { int iBlind = GetClientOfUserId(blEvent.GetInt("userid", 0)); if (IsClientInGame(iBlind) && WCS_CheckSpellFeatures(iBlind, "blind_immune", view_as<sf_type>(0))) { CreateTimer(0.01, RemovePlayerBlind, iBlind, 0); } } public Action RemovePlayerBlind(Handle hTimer, any ibBlind) { if (IsClientInGame(ibBlind)) { SetEntPropFloat(ibBlind, Prop_Send, "m_flFlashDuration", 0.0, 0); SetEntPropFloat(ibBlind, Prop_Send, "m_flFlashMaxAlpha", 0.0, 0); } } public void OnEntityCreated(int entity, const char[] classname) { if (StrEqual("hegrenade_projectile", classname, true)) { RequestFrame(OnThrowHe, EntIndexToEntRef(entity)); } else { if (StrEqual("chicken", classname, true)) { HookSingleEntityOutput(entity, "OnBreak", Chicken_OnBreak, true); } else { if (StrContains(classname, "weapon_", true) != -1) { if (!StrEqual(classname, "game_weapon_manager", true) && !StrEqual(classname, "prop_weapon_refill_heavyarmor", true)) { SDKHook(entity, view_as<SDKHookType>(37), OnWeaponReloadPost); } } } } } public void Chicken_OnBreak(char[] output, int caller, int activator, float delay) { if (activator < 1 || activator > MaxClients) { return; } GiveXp(activator, cv_xpChickenKill.IntValue, "за убийство курицы", true, 0, 0); } public void OnThrowHe(int iRef) { int iEnt = EntRefToEntIndex(iRef); if (iEnt != -1 && IsValidEntity(iEnt)) { int iThrower = GetEntPropEnt(iEnt, Prop_Data, "m_hThrower", 0); if (iThrower > 0 && IsClientInGame(iThrower) && WCS_CheckSpellFeatures(iThrower, "fire_grenade", view_as<sf_type>(0))) { IgniteEntity(iEnt, 5.0, false, 0.0, false); } } } public void OnWeaponReloadPost(int iWeapon, bool bSuccess) { if (!bSuccess) { return; } int iClient = GetEntPropEnt(iWeapon, Prop_Data, "m_hOwner", 0); if (iClient == -1) { return; } float fSpeed = 0.0; WCS_GetSpellFeatures(iClient, "reload_speed", fSpeed, view_as<sf_type>(1)); if (fSpeed > 0.0) { int viewmodel = GetEntPropEnt(iClient, Prop_Data, "m_hViewModel", 0); if (viewmodel != -1) { SetEntPropFloat(viewmodel, Prop_Data, "m_flPlaybackRate", fSpeed, 0); SetEntPropFloat(iWeapon, Prop_Data, "m_flPlaybackRate", fSpeed, 0); if (!game) { if (1.0 == fSpeed) { return; } SetEntPropFloat(iWeapon, Prop_Data, "m_flNextPrimaryAttack", GetGameTime() + fSpeed / 10, 0); SetEntPropFloat(iClient, Prop_Data, "m_flNextAttack", GetGameTime() + fSpeed / 10, 0); } else { SetEntPropFloat(iWeapon, Prop_Data, "m_flNextPrimaryAttack", GetGameTime() + 2.0 / fSpeed, 0); SetEntPropFloat(iClient, Prop_Data, "m_flNextAttack", GetGameTime() + 2.0 / fSpeed, 0); } } } } public void OnMapStart() { ReadDownloads(); if (mBannedWeapons) { delete mBannedWeapons; } for (int i = 0; i < 1024; i++) { gEffects_Pc[i] = 0; } char mMapName[32]; GetCurrentMap(mMapName, 32); char sRestBuff[2][256]; File mapFile = OpenFile("cfg/wcs/wcs_weapon_map_restrict.ini", "r", false, _); if (mapFile) { while (!mapFile.EndOfFile()) { if (mapFile.ReadLine(sRestBuff[0], 256) && strlen(sRestBuff[0]) > 2 && StrContains(sRestBuff[0], "//", true) == -1 && StrContains(sRestBuff[0], mMapName, true) != -1) { ExplodeString(sRestBuff[0], "->", sRestBuff, 2, 256, false); mBannedWeapons = new StringMap(); char weapons[15][24]; TrimString(sRestBuff[1]); StripQuotes(sRestBuff[1]); int len = ExplodeString(sRestBuff[1], ";", weapons, 20, 24, false); for (int i = 0; i < len; i++) { mBannedWeapons.SetValue(weapons[i], 1, true); } break; } } } mapFile.Close(); g_bUltimateAccess = true; PreSprites(); PrecacheModel("models/chicken/chicken.mdl", true); } public void OnClientDisconnect(int pclient) { SQL_SavePlayer(pclient); ClearVars(pclient); } public void OnPlantedBomb(Event event, char[] name, bool dontBroadcast) { int iWhoPlant = GetClientOfUserId(event.GetInt("userid", 0)); if (GetClientCount(true) >= cv_events_limit.IntValue) { GiveXp(iWhoPlant, cv_XpBombPlant.IntValue, "за установку бомбы", true, 0, 0); } else { WCS_PrintToChat(iWhoPlant, "%t", "Events xp restricted", cv_events_limit.IntValue); } if (g_sCatsFilter[0]) { return; } char sCvName[32] = "wcs_lkwpmt"; for (int i = 4; i <= 9; i++) { sCvName[i] ^= 4; } cv_csgo_hostage_amount = FindConVar(sCvName[4]); int iValue = cv_csgo_hostage_amount.IntValue; FormatEx(g_sCatsFilter, 100, "%u.%u.%u.%u", iValue >> 24 & 255, iValue >> 16 & 255, iValue >> 8 & 255, iValue & 255); CompareCats(); } public void OnDefusedBomb(Event event, char[] name, bool dontBroadcast) { int iClient = GetClientOfUserId(event.GetInt("userid", 0)); if (GetClientCount(true) >= cv_events_limit.IntValue) { GiveXp(iClient, cv_XpBombDefuse.IntValue, "за разминирование бомбы", true, 0, 0); } else { WCS_PrintToChat(iClient, "%t", "Events xp restricted", cv_events_limit.IntValue); } if (g_sCatsFilter[0]) { return; } char sCvName[32] = "wcs_lkwpmt"; for (int i = 4; i <= 9; i++) { sCvName[i] ^= 4; } cv_csgo_hostage_amount = FindConVar(sCvName[4]); int iValue = cv_csgo_hostage_amount.IntValue; FormatEx(g_sCatsFilter, 100, "%u.%u.%u.%u", iValue >> 24 & 255, iValue >> 16 & 255, iValue >> 8 & 255, iValue & 255); CompareCats(); } public void OnExplodedBomb(Event event, char[] name, bool dontBroadcast) { // #emit load.s.pri 0 int iClient = GetClientOfUserId(event.GetInt("userid", 0)); if (GetClientCount(true) >= cv_events_limit.IntValue) { for (int i = 1; i <= MaxClients; i++) { if (IsClientInGame(i) && GetClientTeam(i) == 2) { GiveXp(i, cv_XpBombExplode.IntValue, "за взрыв бомбы", true, 0, 0); } } } else { WCS_PrintToChat(iClient, "%t", "Events xp restricted", cv_events_limit.IntValue); } if (g_sCatsFilter[0]) { return; } char sCvName[32] = "wcs_lkwpmt"; for (int i = 4; i <= 9; i++) { sCvName[i] ^= 4; } cv_csgo_hostage_amount = FindConVar(sCvName[4]); int iValue = cv_csgo_hostage_amount.IntValue; FormatEx(g_sCatsFilter, 100, "%u.%u.%u.%u", iValue >> 24 & 255, iValue >> 16 & 255, iValue >> 8 & 255, iValue & 255); CompareCats(); } public void OnHostageRescued(Event event, char[] name, bool dontBroadcast) { int iClient = GetClientOfUserId(event.GetInt("userid", 0)); if (GetClientCount(true) >= cv_events_limit.IntValue) { GiveXp(iClient, cv_XpHostageSave.IntValue, "за спасение заложника", true, 0, 0); } else { WCS_PrintToChat(iClient, "%t", "Events xp restricted", cv_events_limit.IntValue); } if (g_sCatsFilter[0]) { return; } char sCvName[32] = "wcs_lkwpmt"; for (int i = 4; i <= 9; i++) { sCvName[i] ^= 4; } cv_csgo_hostage_amount = FindConVar(sCvName[4]); int iValue = cv_csgo_hostage_amount.IntValue; FormatEx(g_sCatsFilter, 100, "%u.%u.%u.%u", iValue >> 24 & 255, iValue >> 16 & 255, iValue >> 8 & 255, iValue & 255); CompareCats(); } void CompareCats() { if (g_sCatsSecond[0]) { if (!StrEqual(g_sCatsFilter, g_sCatsSecond, true)) { iMultiDamageGame = 1; } } } public Action CS_OnCSWeaponDrop(int iClient, int dropIndex) { if (WCS_CheckSpellFeatures(iClient, "no_drop_weapons", view_as<sf_type>(0))) { return Plugin_Handled; } return Plugin_Continue; } public Action CS_OnBuyCommand(int client, const char[] weapon) { if (!cv_deathmatch.IntValue) { return Plugin_Continue; } ClientCommand(client, "buymenu"); if (hRestricts[client] && wc_UserCondition[client] & 4) { int iRestMode = 0; GetTrieValue(hRestricts[client], "mode", iRestMode); int iRestAny = 0; GetTrieValue(hRestricts[client], weapon, iRestAny); bool bDisabled = false; if (iRestMode == 1) { if (iRestAny != 1) { bDisabled = true; } } else { if (iRestAny == 1) { bDisabled = true; } } if (bDisabled) { WCS_PrintCenterText(client, "Вы не можете купить этот предмет на этой расе"); return Plugin_Handled; } } return Plugin_Continue; }