diff --git a/src/zriot/ambience.inc b/src/zriot/ambience.inc index 07f45e7..11fdde9 100644 --- a/src/zriot/ambience.inc +++ b/src/zriot/ambience.inc @@ -17,13 +17,13 @@ LoadAmbienceData() { return; } - + decl String:sound[64]; GetConVarString(gCvars[CVAR_AMBIENCE_FILE], sound, sizeof(sound)); Format(sound, sizeof(sound), "sound/%s", sound); - + soundValid = FileExists(sound, true); - + if (soundValid) { AddFileToDownloadsTable(sound); @@ -40,24 +40,24 @@ RestartAmbience() { CloseHandle(tAmbience); } - + CreateTimer(0.0, AmbienceLoop, _, TIMER_FLAG_NO_MAPCHANGE); } public Action:AmbienceLoop(Handle:timer) { new bool:ambience = GetConVarBool(gCvars[CVAR_AMBIENCE]); - + if (!ambience || !soundValid) { return; } - + decl String:sound[64]; GetConVarString(gCvars[CVAR_AMBIENCE_FILE], sound, sizeof(sound)); - + EmitAmbience(sound); - + new Float:delay = GetConVarFloat(gCvars[CVAR_AMBIENCE_LENGTH]); tAmbience = CreateTimer(delay, AmbienceLoop, _, TIMER_FLAG_NO_MAPCHANGE); } @@ -65,15 +65,15 @@ public Action:AmbienceLoop(Handle:timer) StopAmbience() { new bool:ambience = GetConVarBool(gCvars[CVAR_AMBIENCE]); - + if (!ambience) { return; } - + decl String:sound[64]; GetConVarString(gCvars[CVAR_AMBIENCE_FILE], sound, sizeof(sound)); - + new maxplayers = GetMaxClients(); for (new x = 1; x <= maxplayers; x++) { @@ -81,7 +81,7 @@ StopAmbience() { continue; } - + StopSound(x, SNDCHAN_AUTO, sound); } } @@ -89,9 +89,9 @@ StopAmbience() EmitAmbience(const String:sound[]) { PrecacheSound(sound); - + StopAmbience(); - + new Float:volume = GetConVarFloat(gCvars[CVAR_AMBIENCE_VOLUME]); EmitSoundToAll(sound, SOUND_FROM_PLAYER, SNDCHAN_AUTO, SNDLEVEL_NORMAL, SND_NOFLAGS, volume, SNDPITCH_NORMAL, -1, NULL_VECTOR, NULL_VECTOR, true, 0.0); } \ No newline at end of file diff --git a/src/zriot/commands.inc b/src/zriot/commands.inc index f9c42fd..d077e76 100644 --- a/src/zriot/commands.inc +++ b/src/zriot/commands.inc @@ -5,18 +5,18 @@ * Author: Greyscale * ==================== */ - + CreateCommands() { RegAdminCmd("zriot_restrict", Command_Restrict, ADMFLAG_GENERIC, "Restrict a specified weapon"); RegAdminCmd("zriot_unrestrict", Command_UnRestrict, ADMFLAG_GENERIC, "Unrestrict a specified weapon"); - + RegAdminCmd("zriot_setday", Command_SetDay, ADMFLAG_GENERIC, "Sets the game to a certain day"); - + RegAdminCmd("zriot_zombie", Command_Zombie, ADMFLAG_GENERIC, "Turns player into zombie"); RegAdminCmd("zriot_human", Command_Human, ADMFLAG_GENERIC, "Turns player into human"); } - + public Action:Command_Restrict(client, argc) { new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); @@ -24,17 +24,17 @@ public Action:Command_Restrict(client, argc) { return Plugin_Handled; } - + decl String:arg1[32]; GetCmdArg(1, arg1, sizeof(arg1)); - + new WepRestrictQuery:output = RestrictWeapon(arg1); - + if (output == Existing) { ZRiot_ReplyToCommand(client, "Weapon already restricted", arg1); } - + return Plugin_Handled; } @@ -45,17 +45,17 @@ public Action:Command_UnRestrict(client, argc) { return Plugin_Handled; } - + decl String:arg1[32]; GetCmdArg(1, arg1, sizeof(arg1)); - + new WepRestrictQuery:output = UnRestrictWeapon(arg1); - + if (output == Invalid) { ZRiot_ReplyToCommand(client, "Weapon invalid", arg1); } - + return Plugin_Handled; } @@ -66,25 +66,25 @@ public Action:Command_SetDay(client, argc) { return Plugin_Handled; } - + decl String:arg1[32]; GetCmdArg(1, arg1, sizeof(arg1)); - + new day = StringToInt(arg1) - 1; day = (day >= 0) ? day : 0; - + gDay = day; gDay = (gDay + 1 > dCount) ? dCount - 1 : gDay; - + ZRiot_PrintToChat(0, "Skip to day", gDay + 1); - + if (tHUD == INVALID_HANDLE) { return Plugin_Handled; } - + TerminateRound(3.0, Round_Draw); - + return Plugin_Handled; } @@ -95,31 +95,31 @@ public Action:Command_Zombie(client, argc) { return Plugin_Handled; } - + decl String:arg1[32]; GetCmdArg(1, arg1, sizeof(arg1)); - + decl String:target_name[MAX_TARGET_LENGTH]; new targets[MAXPLAYERS]; new bool:tn_is_ml; - + new tcount = ProcessTargetString(arg1, client, targets, MAXPLAYERS, COMMAND_FILTER_NO_BOTS, target_name, sizeof(target_name), tn_is_ml); if (tcount <= 0) { ReplyToTargetError(client, tcount); return Plugin_Handled; } - + for (new x = 0; x < tcount; x++) { ZRiot_Zombie(targets[x]); } - + if (GetLiveHumanCount() <= 0) { TerminateRound(5.0, Terrorists_Win); } - + return Plugin_Handled; } @@ -130,25 +130,25 @@ public Action:Command_Human(client, argc) { return Plugin_Handled; } - + decl String:arg1[32]; GetCmdArg(1, arg1, sizeof(arg1)); - + decl String:target_name[MAX_TARGET_LENGTH]; new targets[MAXPLAYERS]; new bool:tn_is_ml; - + new tcount = ProcessTargetString(arg1, client, targets, MAXPLAYERS, COMMAND_FILTER_NO_BOTS, target_name, sizeof(target_name), tn_is_ml); if (tcount <= 0) { ReplyToTargetError(client, tcount); return Plugin_Handled; } - + for (new x = 0; x < tcount; x++) { ZRiot_Human(targets[x]); } - + return Plugin_Handled; } \ No newline at end of file diff --git a/src/zriot/cvars.inc b/src/zriot/cvars.inc index ffa7317..126b561 100644 --- a/src/zriot/cvars.inc +++ b/src/zriot/cvars.inc @@ -76,9 +76,9 @@ CreateCvars() gCvars[CVAR_ZMARKET_BUYZONE] = CreateConVar("zriot_zmarket_buyzone", "0", "Must be in buyzone to access !zmarket, if Market is installed (0: Can be used anywhere)"); gCvars[CVAR_CASHFILL] = CreateConVar("zriot_cashfill", "1", "Enable the mod to set the players cash to zriot_cashamount (0: Disabled)"); gCvars[CVAR_CASHAMOUNT] = CreateConVar("zriot_cashamount", "12000", "How much money players will have when they spawn when zriot_cashfill is 1"); - + HookConVarChange(gCvars[CVAR_ENABLE], EnableHook); - + AutoExecConfig(true, "zombieriot", "sourcemod/zombieriot"); } @@ -86,12 +86,12 @@ HookCvars() { SetConVarBool(FindConVar("mp_autoteambalance"), false); SetConVarInt(FindConVar("mp_limitteams"), 0); - + HookConVarChange(FindConVar("mp_autoteambalance"), AutoTeamBalanceHook); HookConVarChange(FindConVar("mp_limitteams"), LimitTeamsHook); - + HookConVarChange(gCvars[CVAR_ZOMBIETEAM], ZombieTeamHook); - + HookConVarChange(FindConVar("mp_restartgame"), RestartGameHook); } @@ -99,30 +99,30 @@ UnhookCvars() { UnhookConVarChange(FindConVar("mp_autoteambalance"), AutoTeamBalanceHook); UnhookConVarChange(FindConVar("mp_limitteams"), LimitTeamsHook); - + UnhookConVarChange(gCvars[CVAR_ZOMBIETEAM], ZombieTeamHook); - + UnhookConVarChange(FindConVar("mp_restartgame"), RestartGameHook); } public EnableHook(Handle:convar, const String:oldValue[], const String:newValue[]) { new bool:enable = bool:StringToInt(newValue); - + if (enable) { FindMapSky(); - + FindHostname(); UpdateHostname(); - + HookEvents(); HookCvars(); - + ServerCommand("bot_kick"); - + gDay = 0; - + TerminateRound(3.0, Game_Commencing); } else @@ -152,6 +152,6 @@ public ZombieTeamHook(Handle:convar, const String:oldValue[], const String:newVa public RestartGameHook(Handle:convar, const String:oldValue[], const String:newValue[]) { gDay = 0; - + ResetZombies(true); } \ No newline at end of file diff --git a/src/zriot/daydata.inc b/src/zriot/daydata.inc index c9b4bb1..bd6dc18 100644 --- a/src/zriot/daydata.inc +++ b/src/zriot/daydata.inc @@ -30,54 +30,54 @@ LoadDayData(bool:defaultconfig) { decl String:path[PLATFORM_MAX_PATH]; Format(path, sizeof(path), "%s/days.txt", gMapConfig); - + if (!defaultconfig && !FileExists(path)) { return; } - + if (kvDays != INVALID_HANDLE) { CloseHandle(kvDays); } - + kvDays = CreateKeyValues("days"); KvSetEscapeSequences(kvDays, true); - + if (!FileToKeyValues(kvDays, path)) { SetFailState("\"%s\" failed to load", path); } - + KvRewind(kvDays); if (!KvGotoFirstSubKey(kvDays)) { SetFailState("No day data defined in \"%s\"", path); } - + decl String:display[32]; decl String:zombieoverride[32*MAXZOMBIES]; decl String:storyline[192]; - + dCount = 0; do { KvGetSectionName(kvDays, display, sizeof(display)); strcopy(arrayDays[dCount][data_display], 32, display); - + KvGetString(kvDays, "zombieoverride", zombieoverride, sizeof(zombieoverride)); strcopy(arrayDays[dCount][data_zombieoverride], 32*MAXZOMBIES, zombieoverride); - + KvGetString(kvDays, "storyline", storyline, sizeof(storyline)); strcopy(arrayDays[dCount][data_storyline], 192, storyline); - + arrayDays[dCount][data_count] = KvGetNum(kvDays, "count", 25); arrayDays[dCount][data_healthboost] = KvGetNum(kvDays, "healthboost"); arrayDays[dCount][data_respawn] = bool:KvGetNum(kvDays, "respawn"); arrayDays[dCount][data_deaths_before_zombie] = KvGetNum(kvDays, "deaths_before_zombie"); arrayDays[dCount][data_fademin] = KvGetFloat(kvDays, "fademin"); arrayDays[dCount][data_fademax] = KvGetFloat(kvDays, "fademax"); - + dCount++; } while (KvGotoNextKey(kvDays)); } @@ -94,34 +94,34 @@ bool:ExplodeZombieOverrides(day) CloseHandle(adtZombies); adtZombies = INVALID_HANDLE; } - + decl String:zombieoverride[32*MAXZOMBIES]; GetDayZombieOverride(day, zombieoverride, sizeof(zombieoverride)); - + if (zombieoverride[0]) { adtZombies = CreateArray(); - + new String:sZombies[MAXZOMBIES][64]; ExplodeString(zombieoverride, ",", sZombies, MAXZOMBIES, 64); - + for (new x = 0; x < MAXZOMBIES; x++) { if (!sZombies[x][0]) continue; - + TrimString(sZombies[x]); new zombieid = FindZombieIDByName(sZombies[x]); - + if (zombieid == -1) continue; - + PushArrayCell(adtZombies, zombieid); } - + return true; } - + return false; } @@ -168,13 +168,13 @@ Float:GetDayMaxFade(day) BeginDay() { gZombiesKilled = 0; - + new zombiecount = GetDayCount(gDay); new zombiemax = GetConVarInt(gCvars[CVAR_ZOMBIEMAX]); - + new spawncount; new bool:respawn = GetDayRespawn(gDay); - + if (respawn) { spawncount = zombiemax; @@ -183,14 +183,14 @@ BeginDay() { spawncount = (zombiecount < zombiemax) ? zombiecount : zombiemax; } - + ServerCommand("bot_quota %d", spawncount); - + decl String:display[32]; GetDayDisplay(gDay, display, sizeof(display)); - + new bool:override = ExplodeZombieOverrides(gDay); - + new maxplayers = GetMaxClients(); for (new x = 1; x <= maxplayers; x++) { @@ -198,21 +198,21 @@ BeginDay() { continue; } - + ChangeClientDeathCount(x, 0); - + if (!IsPlayerZombie(x)) { continue; } - + if (override) { new size = GetArraySize(adtZombies); if (size) { new zombieid = GetRandomInt(0, size - 1); - + Zombify(x, GetArrayCell(adtZombies, zombieid)); } } diff --git a/src/zriot/event.inc b/src/zriot/event.inc index a956373..9077205 100644 --- a/src/zriot/event.inc +++ b/src/zriot/event.inc @@ -42,32 +42,32 @@ public Action:PlayerConnect(Handle:event, const String:name[], bool:dontBroadcas new bool:botquota_silent = GetConVarBool(gCvars[CVAR_BOTQUOTA_SILENT]); if (!botquota_silent) return Plugin_Continue; - + decl String:address[64]; GetEventString(event, "address", address, sizeof(address)); - + if (pcFire && StrEqual(address, "none")) { decl String:pname[64]; decl String:networkid[64]; - + GetEventString(event, "name", pname, sizeof(pname)); GetEventString(event, "networkid", networkid, sizeof(networkid)); new Handle:hPlayerConnect = CreateEvent("player_connect", true); - + SetEventString(hPlayerConnect, "name", pname); SetEventInt(hPlayerConnect, "index", GetEventInt(event, "index")); SetEventInt(hPlayerConnect, "userid", GetEventInt(event, "userid")); SetEventString(hPlayerConnect, "networkid", networkid); SetEventString(hPlayerConnect, "address", address); - + pcFire = false; FireEvent(hPlayerConnect, true); pcFire = true; - + return Plugin_Handled; } - + return Plugin_Continue; } @@ -77,78 +77,78 @@ public Action:PlayerDisconnect(Handle:event, const String:name[], bool:dontBroad new bool:botquota_silent = GetConVarBool(gCvars[CVAR_BOTQUOTA_SILENT]); if (!botquota_silent) return Plugin_Continue; - + new userid = GetEventInt(event, "userid"); new index = GetClientOfUserId(userid); - + if (!index || !IsClientInGame(index)) return Plugin_Continue; - + if (pdFire && IsFakeClient(index)) { decl String:reason[192]; decl String:pname[64]; decl String:networkid[64]; - + GetEventString(event, "reason", reason, sizeof(reason)); GetEventString(event, "name", pname, sizeof(pname)); GetEventString(event, "networkid", networkid, sizeof(networkid)); - + new Handle:hPlayerDisconnect = CreateEvent("player_disconnect", true); - + SetEventInt(hPlayerDisconnect, "userid", userid); SetEventString(hPlayerDisconnect, "reason", reason); SetEventString(hPlayerDisconnect, "name", pname); SetEventString(hPlayerDisconnect, "networkid", networkid); - + pdFire = false; FireEvent(hPlayerDisconnect, true); pdFire = true; - + return Plugin_Handled; } - + return Plugin_Continue; } public Action:RoundStart(Handle:event, const String:name[], bool:dontBroadcast) { UpdateHostname(); - + ChangeLightStyle(); - + RestartAmbience(); - + ServerCommand("bot_knives_only"); - + ZRiot_PrintToChat(0, "Round objective"); - + decl String:storyline[192]; GetDayStoryLine(gDay, storyline, sizeof(storyline)); - + if (storyline[0]) { FormatTextString(storyline, sizeof(storyline)); - + PrintToChatAll(storyline); } - + BeginDay(); - + if (tHUD != INVALID_HANDLE) { CloseHandle(tHUD); tHUD = INVALID_HANDLE; } - + new bool:hud = GetConVarBool(gCvars[CVAR_HUD]); if (hud) { tHUD = CreateTimer(5.0, HUD, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); - + UpdateHUDAll(); } - + if (tFreeze != INVALID_HANDLE) { CloseHandle(tFreeze); @@ -159,35 +159,35 @@ public Action:RoundStart(Handle:event, const String:name[], bool:dontBroadcast) public Action:RoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadcast) { RemoveObjectives(); - + if (tFreeze != INVALID_HANDLE) { CloseHandle(tFreeze); tFreeze = INVALID_HANDLE; } - + new Float:freeze = GetConVarFloat(gCvars[CVAR_FREEZE]); if (freeze > 0) { FreezeZombies(); - + tFreeze = CreateTimer(freeze, UnfreezeZombies); - } + } } public Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast) { ResetZombies(false); ClearTrie(trieDeaths); - + CreateTimer(0.0, AssignTeamTimer); - + new reason = GetEventInt(event, "reason"); - + if (reason == CTs_Win || reason == Terrorists_Win) { new winner = GetEventInt(event, "winner"); - + if (winner == gZombieTeam) { ZombiesWin(); @@ -207,7 +207,7 @@ public Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast) CloseHandle(tHUD); tHUD = INVALID_HANDLE; } - + if (tFreeze != INVALID_HANDLE) { CloseHandle(tFreeze); @@ -221,19 +221,19 @@ public Action:PlayerTeam_Pre(Handle:event, const String:name[], bool:dontBroadca if (ptFire) { new Handle:hPlayerTeam = CreateEvent("player_team", true); - + SetEventInt(hPlayerTeam, "userid", GetEventInt(event, "userid")); SetEventInt(hPlayerTeam, "team", GetEventInt(event, "team")); SetEventInt(hPlayerTeam, "oldteam", GetEventInt(event, "oldteam")); SetEventBool(hPlayerTeam, "disconnect", GetEventBool(event, "disconnect")); - + ptFire = false; FireEvent(hPlayerTeam, true); ptFire = true; - + return Plugin_Handled; } - + return Plugin_Continue; } @@ -244,27 +244,27 @@ public Action:PlayerTeam_Post(Handle:event, const String:name[], bool:dontBroadc { return; } - + new index = GetClientOfUserId(GetEventInt(event, "userid")); new oldteam = GetEventInt(event, "oldteam"); new team = GetEventInt(event, "team"); - + if (team != CS_TEAM_SPECTATOR && oldteam == CS_TEAM_NONE || oldteam == CS_TEAM_SPECTATOR) { CreateTimer(0.0, CheckTeam, index); } - + if (team == gHumanTeam) { StopZVision(index); SetPlayerFOV(index, DEFAULT_FOV); SetEntityGravity(index, DEFAULT_GRAVITY); - + if (IsPlayerAlive(index) || tRespawn[index] != INVALID_HANDLE || tHUD == INVALID_HANDLE) { return; } - + StartRespawnTimer(index, true); } } @@ -277,41 +277,41 @@ public Action:CheckTeam(Handle:timer, any:index) public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) { new index = GetClientOfUserId(GetEventInt(event, "userid")); - + new team = GetClientTeam(index); if (team != CS_TEAM_T && team != CS_TEAM_CT) { return; } - + gZombieID[index] = -1; - + if (IsPlayerZombie(index)) { RemoveTargeters(index); - + InitClientDeathCount(index); - + SetPlayerMoney(index, 0); - + new bool:noblock = GetConVarBool(gCvars[CVAR_NOBLOCK]); if (noblock) { NoCollide(index, true); } - + decl String:zombieoverride[4]; GetDayZombieOverride(gDay, zombieoverride, sizeof(zombieoverride)); - + new zombieid; - + if (adtZombies != INVALID_HANDLE && zombieoverride[0]) { new size = GetArraySize(adtZombies); if (size) { zombieid = GetRandomInt(0, size - 1); - + Zombify(index, GetArrayCell(adtZombies, zombieid)); } } @@ -321,21 +321,21 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) { zombieid = GetRandomInt(0, zCount - 1); } while(IsOverrideRequired(zombieid)); - + Zombify(index, zombieid); } - + new health = GetClientHealth(index); SetEntityHealth(index, health + GetDayHealthBoost(gDay)); - + new Float:fademin = GetDayMinFade(gDay); new Float:fademax = GetDayMaxFade(gDay); - + SetPlayerMinDist(index, fademin); SetPlayerMaxDist(index, fademax); - + new knife = GetPlayerWeaponSlot(index, 2); - + if (knife != -1) { SetEntityRenderMode(knife, RENDER_TRANSALPHA); @@ -348,38 +348,38 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) { ZRiot_PrintToChat(index, "!market reminder"); } - + new bool:noblock = GetConVarBool(gCvars[CVAR_NOBLOCK]); if (noblock) { NoCollide(index, false); } - + SetPlayerMinDist(index, 0.0); SetPlayerMaxDist(index, 0.0); - + SetPlayerFOV(index, DEFAULT_FOV); SetEntityGravity(index, DEFAULT_GRAVITY); - + new bool:cashfill = GetConVarBool(gCvars[CVAR_CASHFILL]); if (cashfill) { new cash = GetConVarInt(gCvars[CVAR_CASHAMOUNT]); SetPlayerMoney(index, cash); } - + if (tZVision[index] != INVALID_HANDLE) { CloseHandle(tZVision[index]); tZVision[index] = INVALID_HANDLE; } - + ClientCommand(index, "r_screenoverlay \"\""); - + RemoveTargeters(index); UpdateHUDAll(); } - + if (tRespawn[index] != INVALID_HANDLE) { CloseHandle(tRespawn[index]); @@ -391,39 +391,39 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) { new index = GetClientOfUserId(GetEventInt(event, "userid")); new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); - + decl String:weapon[32]; GetEventString(event, "weapon", weapon, sizeof(weapon)); - + if (!IsPlayerZombie(index)) { return; } - + if (attacker) { TargetPlayer(attacker, index); } - + new maxplayers = GetMaxClients(); new clients[maxplayers]; new numClients = GetClientTargeters(index, clients, maxplayers); - + UpdateHUD(clients, numClients); - + if (GetRandomInt(1, 5) == 1) { decl String:sound[64]; new randsound = GetRandomInt(1, 6); - + Format(sound, sizeof(sound), "npc/zombie/zombie_pain%d.wav", randsound); - + PrecacheSound(sound); EmitSoundToAll(sound, index); } - + new bool:napalm = GetConVarBool(gCvars[CVAR_NAPALM]); - + if (napalm && StrEqual(weapon, "hegrenade", false)) { new Float:burntime = GetConVarFloat(gCvars[CVAR_NAPALM_TIME]); @@ -434,42 +434,42 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { new index = GetClientOfUserId(GetEventInt(event, "userid")); - + if (tHUD == INVALID_HANDLE) { return; } - + new bool:respawn = GetDayRespawn(gDay); - + if (IsPlayerZombie(index)) { ExtinguishEntity(index); - + SetEntProp(index, Prop_Data, "m_takedamage", 2, 1); SetEntProp(index, Prop_Data, "m_fFlags", FL_ONGROUND); - + decl String:sound[64]; - + new randsound = GetRandomInt(1, 3); Format(sound, sizeof(sound), "npc/zombie/zombie_die%d.wav", randsound); - + PrecacheSound(sound); EmitSoundToAll(sound, index); - + new zombiecount = GetLiveZombieCount(); new zombiemax = GetConVarInt(gCvars[CVAR_ZOMBIEMAX]); - + if (respawn || zombiecount > zombiemax) { CreateTimer(0.5, ZombieRespawn, index, TIMER_FLAG_NO_MAPCHANGE); } - + gZombiesKilled++; - + RemoveTargeters(index); UpdateHUDAll(); - + if (gZombiesKilled >= GetDayCount(gDay) && respawn) { TerminateRound(5.0, CTs_Win); @@ -479,35 +479,35 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { ChangeClientDeathCount(index, 1); new deaths_before_zombie = GetDayDeathsBeforeZombie(gDay); - + if (deaths_before_zombie > 0 && GetClientDeathCount(index) >= deaths_before_zombie && GetLiveHumanCount() > 0) { ZRiot_PrintToChat(index, "You are now a zombie"); - + CreateTimer(0.5, JoinZombie, index); } else { StartRespawnTimer(index, false); } - + RemoveTargeters(index); UpdateHUDAll(); - + if (GetLiveHumanCount() <= 0 && respawn) { TerminateRound(5.0, Terrorists_Win); } } - + new Float:delay = GetConVarFloat(gCvars[CVAR_RAGDOLL_REMOVE]); if (delay > 0.0) { new ragdoll = GetEntPropEnt(index, Prop_Send, "m_hRagdoll"); - + CreateTimer(delay, RemoveRagdoll, ragdoll); } - + if (tZVision[index] != INVALID_HANDLE) { CloseHandle(tZVision[index]); @@ -518,14 +518,14 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) public Action:PlayerJump(Handle:event, const String:name[], bool:dontBroadcast) { new index = GetClientOfUserId(GetEventInt(event, "userid")); - + if (!IsPlayerZombie(index)) { return; } - + new Float:vel[3] = {0.0, 0.0, 0.0}; vel[2] = GetZombieJump(gZombieID[index]); - + SetPlayerVelocity(index, vel); } \ No newline at end of file diff --git a/src/zriot/global.inc b/src/zriot/global.inc index ef20548..78a299d 100644 --- a/src/zriot/global.inc +++ b/src/zriot/global.inc @@ -17,7 +17,7 @@ CreateGlobals() CreateNative("ZRiot_Human", Native_Human); CreateNative("ZRiot_GetZombieTeam", Native_GetZombieTeam); CreateNative("ZRiot_GetHumanTeam", Native_GetHumanTeam); - + hOnClientZombie = CreateGlobalForward("ZRiot_OnClientZombie", ET_Ignore, Param_Cell); hOnClientHuman = CreateGlobalForward("ZRiot_OnClientHuman", ET_Ignore, Param_Cell); hOnClientHUDUpdate = CreateGlobalForward("ZRiot_OnClientHUDUpdate", ET_Ignore, Param_Cell, Param_String); @@ -28,7 +28,7 @@ public Native_IsClientZombie(Handle:plugin, argc) new client = GetNativeCell(1); if (!client) ThrowNativeError(SP_ERROR_INDEX, "Client index %d is not in the game", client); - + return bZombie[GetNativeCell(1)]; } @@ -47,7 +47,7 @@ public Native_Zombie(Handle:plugin, argc) new client = GetNativeCell(1); if (!client) ThrowNativeError(SP_ERROR_INDEX, "Client index %d is not in the game", client); - + ZRiot_Zombie(client); } @@ -56,9 +56,9 @@ public Native_Human(Handle:plugin, argc) new client = GetNativeCell(1); if (!client) ThrowNativeError(SP_ERROR_INDEX, "Client index %d is not in the game", client); - + if (IsFakeClient(client)) ThrowNativeError(SP_ERROR_INDEX, "Bots cannot be moved to the human team"); - + ZRiot_Human(client); } \ No newline at end of file diff --git a/src/zriot/hud.inc b/src/zriot/hud.inc index 3e4276b..4c12c64 100644 --- a/src/zriot/hud.inc +++ b/src/zriot/hud.inc @@ -14,37 +14,37 @@ public Action:HUD(Handle:timer) UpdateHUD(clients[], numClients) { new bool:hud = GetConVarBool(gCvars[CVAR_HUD]); - + if (tHUD == INVALID_HANDLE || !hud) { return; } - + new bool:targeting = GetConVarBool(gCvars[CVAR_TARGETING]); - + new livezombies = GetLiveZombieCount(); new livehumans = GetLiveHumanCount(); - + decl String:display[32]; decl String:targetname[64]; - + GetDayDisplay(gDay, display, sizeof(display)); - + for (new x = 0; x < numClients; x++) { if (!IsClientInGame(clients[x]) || IsFakeClient(clients[x]) || GetClientTeam(clients[x]) == CS_TEAM_NONE) { continue; } - + new target = GetClientTarget(clients[x]); if (targeting && target != -1 && IsPlayerZombie(target) && GetClientTeam(clients[x]) != CS_TEAM_SPECTATOR) { GetClientName(target, targetname, sizeof(targetname)); - + new health = GetClientHealth(target); health = (health >= 0) ? health : 0; - + ZRiot_HudHint(clients[x], "HUD target", gDay + 1, dCount, display, livezombies, livehumans, target, health); } else @@ -60,33 +60,33 @@ stock UpdateHUDClient(client) { return; } - + new clients[1]; - clients[0] = client; - + clients[0] = client; + UpdateHUD(clients, 1); } stock UpdateHUDAll() { new maxplayers = GetMaxClients(); - + new clients[maxplayers]; new count = 0; - + for (new x = 1; x <= maxplayers; x++) { if (!IsClientInGame(x) || GetClientTeam(x) == CS_TEAM_NONE) { continue; } - + clients[count++] = x; } - + UpdateHUD(clients, count); } - + GetLiveHumanCount() { new humansleft = 0; @@ -97,10 +97,10 @@ GetLiveHumanCount() { continue; } - + humansleft++; } - + return humansleft; } diff --git a/src/zriot/offsets.inc b/src/zriot/offsets.inc index db22581..28cd2e7 100644 --- a/src/zriot/offsets.inc +++ b/src/zriot/offsets.inc @@ -26,49 +26,49 @@ FindOffsets() { SetFailState("Couldn't find \"m_vecBaseVelocity\"!"); } - + offsGetVelocity2 = FindSendPropInfo("CBasePlayer", "m_vecVelocity[2]"); if (offsGetVelocity2 == -1) { SetFailState("Couldn't find \"m_vecVelocity[2]\"!"); } - + offsSpeed = FindSendPropInfo("CCSPlayer", "m_flLaggedMovementValue"); if (offsSpeed == -1) { SetFailState("Couldn't find \"m_flLaggedMovementValue\"!"); } - + offsCollision = FindSendPropInfo("CBaseEntity", "m_CollisionGroup"); if (offsCollision == -1) { SetFailState("Couldn't find \"m_CollisionGroup\"!"); } - + offsMoney = FindSendPropInfo("CCSPlayer", "m_iAccount"); if (offsMoney == -1) { SetFailState("Couldn't find \"m_iAccount\"!"); } - + offsFOV = FindSendPropInfo("CBasePlayer", "m_iDefaultFOV"); if (offsFOV == -1) { SetFailState("Couldn't find \"m_iDefaultFOV\"!"); } - + offsBuyZone = FindSendPropInfo("CCSPlayer", "m_bInBuyZone"); if (offsBuyZone == -1) { SetFailState("Couldn't find \"m_bInBuyZone\"!"); } - + offsFadeMin = FindSendPropInfo("CCSPlayer", "m_fadeMinDist"); if (offsFadeMin == -1) { SetFailState("Couldn't find \"m_fadeMinDist\"!"); } - + offsFadeMax = FindSendPropInfo("CCSPlayer", "m_fadeMaxDist"); if (offsFadeMax == -1) { @@ -79,7 +79,7 @@ FindOffsets() SetupGameData() { hGameConf = LoadGameConfigFile("plugin.zombieriot"); - + StartPrepSDKCall(SDKCall_GameRules); PrepSDKCall_SetFromConf(hGameConf, SDKConf_Signature, "TerminateRound"); PrepSDKCall_AddParameter(SDKType_Float, SDKPass_Plain); @@ -137,7 +137,7 @@ SetPlayerMaxDist(client, Float:maxdist) /** * Remove all weapons. - * + * * @param client The client index. * @param weapons An array of boolean values for each weapon slot. True means remove, false means ignore. */ @@ -152,14 +152,14 @@ stock RemoveAllPlayersWeapons(client) Util_RemovePlayerItem(client, weaponindex); } } - + // Remove left-over projectiles. WepLib_GrenadeStripAll(client); } /** * Used to explicitly remove projectiles from a client. - * + * * @param client The client index. */ stock WepLib_GrenadeStripAll(client) @@ -175,7 +175,7 @@ stock WepLib_GrenadeStripAll(client) /** * Fully remove a weapon from a client's inventory and the world. - * + * * @param client The client whose weapon to remove. * @param weaponindex The weapon index. */ @@ -189,6 +189,6 @@ TerminateRound(Float:delay, reason) { if (tHUD == INVALID_HANDLE) return; - + SDKCall(hTerminateRound, delay, reason); } \ No newline at end of file diff --git a/src/zriot/overlays.inc b/src/zriot/overlays.inc index 029026c..89e936d 100644 --- a/src/zriot/overlays.inc +++ b/src/zriot/overlays.inc @@ -3,7 +3,7 @@ * Zombie Riot * File: overlays.inc * Author: Greyscale - * ==================== + * ==================== */ ShowOverlays(Float:time, winner) @@ -17,16 +17,16 @@ ShowOverlays(Float:time, winner) { GetConVarString(gCvars[CVAR_OVERLAYS_HUMAN], overlay, sizeof(overlay)); } - + new maxplayers = GetMaxClients(); for (new x = 1; x <= maxplayers; x++) { if (!IsClientInGame(x)) continue; - + DisplayClientOverlay(x, overlay); } - + CreateTimer(time, KillOverlays); } @@ -37,7 +37,7 @@ public Action:KillOverlays(Handle:timer) { if (!IsClientInGame(x)) continue; - + ClientCommand(x, "r_screenoverlay \"\""); } } \ No newline at end of file diff --git a/src/zriot/sayhooks.inc b/src/zriot/sayhooks.inc index 31fbc8f..b0ee037 100644 --- a/src/zriot/sayhooks.inc +++ b/src/zriot/sayhooks.inc @@ -19,18 +19,18 @@ public Action:SayCommand(client, argc) { return Plugin_Continue; } - + decl String:args[192]; - + GetCmdArgString(args, sizeof(args)); ReplaceString(args, sizeof(args), "\"", ""); - + if (StrEqual(args, "!market", false)) { Market(client); return Plugin_Handled; } - + return Plugin_Continue; } @@ -39,26 +39,26 @@ Market(client) if (!market) { ZRiot_PrintToChat(client, "Feature is disabled"); - + return; } - - new bool:buyzone = GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE]); + + new bool:buyzone = GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE]); if (!IsClientInBuyZone(client) && buyzone) { ZRiot_PrintCenterText(client, "Market out of buyzone"); - + return; } - + SetGlobalTransTarget(client); - + decl String:title[64]; decl String:rebuy[64]; - + Format(title, sizeof(title), "%t\n ", "Market title"); Format(rebuy, sizeof(rebuy), "%t\n ", "Market rebuy"); - + Market_Send(client, title, rebuy); } @@ -68,37 +68,37 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[]) { return false; } - + if (IsPlayerZombie(client)) { ZRiot_PrintToChat(client, "Zombie cant use weapon"); - + return false; } - + if (StrEqual(weaponid, "rebuy")) { return true; } - + decl String:display[64]; decl String:weapon[32]; new price; - + if (!Market_GetWeaponIDInfo(weaponid, display, weapon, price)) { return false; } - + ReplaceString(weapon, sizeof(weapon), "weapon_", ""); - + if (IsWeaponRestricted(weapon)) { ZRiot_PrintToChat(client, "Weapon is restricted", weapon); - + return false; } - + return true; } @@ -108,6 +108,6 @@ public Market_PostOnWeaponSelected(client, &bool:allowed) { return; } - + Market(client); } \ No newline at end of file diff --git a/src/zriot/targeting.inc b/src/zriot/targeting.inc index c329276..e2cd9bb 100644 --- a/src/zriot/targeting.inc +++ b/src/zriot/targeting.inc @@ -16,9 +16,9 @@ TargetPlayer(attacker, client) { return; } - + gTarget[attacker] = client; - + bTargeted[client][attacker] = true; } @@ -28,7 +28,7 @@ GetClientTarget(client) { return -1; } - + return gTarget[client]; } @@ -41,10 +41,10 @@ GetClientTargeters(client, clients[], maxClients) { continue; } - + clients[count++] = x; } - + return count; } @@ -57,13 +57,13 @@ FindClientNextTarget(client) { continue; } - + if (bTargeted[x][client]) { return x; } } - + return -1; } @@ -73,7 +73,7 @@ RemoveTargeters(client) for (new x = 1; x <= maxplayers; x++) { bTargeted[client][x] = false; - + if (gTarget[x] == client) { gTarget[x] = FindClientNextTarget(x); diff --git a/src/zriot/teamcontrol.inc b/src/zriot/teamcontrol.inc index b26e67b..0424b91 100644 --- a/src/zriot/teamcontrol.inc +++ b/src/zriot/teamcontrol.inc @@ -24,18 +24,18 @@ public Action:Command_JoinTeam(client, argc) { return Plugin_Continue; } - + new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); if (!enabled) { return Plugin_Continue; } - + decl String:args[8]; GetCmdArgString(args, sizeof(args)); - + new jointeam = StringToInt(args); - + new team = GetClientTeam(client); if (team == CS_TEAM_T || team == CS_TEAM_CT) { @@ -48,7 +48,7 @@ public Action:Command_JoinTeam(client, argc) ChangeClientDeathCount(client, -1); } } - + return Plugin_Continue; } @@ -58,15 +58,15 @@ public Action:Command_Kill(client, argc) { return Plugin_Continue; } - + new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); if (!enabled) { return Plugin_Continue; } - + ZRiot_ReplyToCommand(client, "Suicide text"); - + return Plugin_Handled; } @@ -76,15 +76,15 @@ public Action:Command_Spectate(client, argc) { return Plugin_Continue; } - + new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); if (!enabled) { return Plugin_Continue; } - + ChangeClientDeathCount(client, -1); - + return Plugin_Continue; } @@ -92,7 +92,7 @@ UpdateTeams() { decl String:zombieteam[8]; GetConVarString(gCvars[CVAR_ZOMBIETEAM], zombieteam, sizeof(zombieteam)); - + if (StrEqual(zombieteam, "t", false)) { gZombieTeam = CS_TEAM_T; @@ -108,7 +108,7 @@ UpdateTeams() SetFailState("Invalid value for cvar zriot_zombieteam, see config file"); return; } - + AssignTeamAll(true); } @@ -121,10 +121,10 @@ ResetZombies(bool:switchteam) { continue; } - + bZombie[x] = IsFakeClient(x); } - + if (switchteam) { AssignTeamAll(false); @@ -144,13 +144,13 @@ AssignTeam(clients[], numClients, bool:spawn) { continue; } - + new team = GetClientTeam(clients[x]); - + if (IsPlayerZombie(clients[x])) { CS_SwitchTeam(clients[x], gZombieTeam); - + if (spawn && team != gZombieTeam) { CS_RespawnPlayer(clients[x]); @@ -159,7 +159,7 @@ AssignTeam(clients[], numClients, bool:spawn) else { CS_SwitchTeam(clients[x], gHumanTeam); - + if (spawn && team != gHumanTeam) { CS_RespawnPlayer(clients[x]); @@ -174,29 +174,29 @@ stock AssignTeamClient(client, bool:spawn) { return; } - + new clients[1]; clients[0] = client; - + AssignTeam(clients, 1, spawn); } stock AssignTeamAll(bool:spawn) { new maxplayers = GetMaxClients(); - + new clients[maxplayers]; new count = 0; - + for (new x = 1; x <= maxplayers; x++) { if (!IsClientInGame(x) || GetClientTeam(x) < CS_TEAM_T) { continue; } - + clients[count++] = x; } - + AssignTeam(clients, count, spawn); } \ No newline at end of file diff --git a/src/zriot/translation.inc b/src/zriot/translation.inc index 2868f64..5460857 100644 --- a/src/zriot/translation.inc +++ b/src/zriot/translation.inc @@ -9,7 +9,7 @@ FormatTextString(String:text[], maxlen) { Format(text, maxlen, "@green[%t] @default%s", "ZRiot", text); - + ReplaceString(text, maxlen, "@default","\x01"); ReplaceString(text, maxlen, "@lgreen","\x03"); ReplaceString(text, maxlen, "@green","\x04"); @@ -18,35 +18,35 @@ FormatTextString(String:text[], maxlen) stock ZRiot_PrintToChat(client, any:...) { decl String:phrase[192]; - + if (client) { SetGlobalTransTarget(client); - + VFormat(phrase, sizeof(phrase), "%t", 2); FormatTextString(phrase, sizeof(phrase)); - + PrintToChat(client, phrase); } else { SetGlobalTransTarget(client); - + VFormat(phrase, sizeof(phrase), "%t", 2); FormatTextString(phrase, sizeof(phrase)); - + PrintToServer(phrase); - + new maxplayers = GetMaxClients(); for (new x = 1; x <= maxplayers; x++) { if (IsClientInGame(x)) { SetGlobalTransTarget(x); - + VFormat(phrase, sizeof(phrase), "%t", 2); FormatTextString(phrase, sizeof(phrase)); - + PrintToChat(x, phrase); } } @@ -56,32 +56,32 @@ stock ZRiot_PrintToChat(client, any:...) stock ZRiot_PrintCenterText(client, any:...) { SetGlobalTransTarget(client); - + decl String:phrase[192]; - + VFormat(phrase, sizeof(phrase), "%t", 2); - + PrintCenterText(client, phrase); } stock ZRiot_HudHint(client, any:...) { SetGlobalTransTarget(client); - + decl String:phrase[192]; - + VFormat(phrase, sizeof(phrase), "%t", 2); - + new Handle:hHintText = StartMessageOne("HintText", client); if (hHintText != INVALID_HANDLE) { BfWriteByte(hHintText, -1); - + Call_StartForward(hOnClientHUDUpdate); Call_PushCell(client); Call_PushStringEx(phrase, sizeof(phrase), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); Call_Finish(); - + BfWriteString(hHintText, phrase); EndMessage(); } @@ -90,35 +90,35 @@ stock ZRiot_HudHint(client, any:...) stock ZRiot_PrintToServer(any:...) { SetGlobalTransTarget(LANG_SERVER); - + decl String:phrase[192]; decl String:buffer[192]; - + VFormat(phrase, sizeof(phrase), "%t", 1); Format(buffer, sizeof(buffer), "[%t] %s", "ZRiot", phrase); - + PrintToServer(buffer); } stock ZRiot_LogMessage(any:...) { SetGlobalTransTarget(LANG_SERVER); - + decl String:phrase[192]; - + VFormat(phrase, sizeof(phrase), "%t", 1); - + LogMessage(phrase); } stock ZRiot_ReplyToCommand(client, any:...) { decl String:phrase[192]; - + SetGlobalTransTarget(client); - + VFormat(phrase, sizeof(phrase), "%t", 2); FormatTextString(phrase, sizeof(phrase)); - + ReplyToCommand(client, phrase); } \ No newline at end of file diff --git a/src/zriot/weaponrestrict.inc b/src/zriot/weaponrestrict.inc index c6f3668..dc1b978 100644 --- a/src/zriot/weaponrestrict.inc +++ b/src/zriot/weaponrestrict.inc @@ -14,17 +14,17 @@ enum WepRestrictQuery Invalid, /** Weapon invalid */ Existing, /** Already restricted */ } - + InitWeaponRestrict() { RegConsoleCmd("buy", BuyHook); - + restrictedWeapons = CreateArray(32, 0); } ClientHookUse(client) { - SDKHook(client, SDKHook_WeaponCanUse, Weapon_CanUse); + SDKHook(client, SDKHook_WeaponCanUse, Weapon_CanUse); } public Action:BuyHook(client, argc) @@ -34,25 +34,25 @@ public Action:BuyHook(client, argc) { return Plugin_Continue; } - + if (IsPlayerZombie(client)) { ZRiot_PrintToChat(client, "Zombie cant use weapon"); - + return Plugin_Handled; } - + decl String:weapon[64]; GetCmdArg(1, weapon, sizeof(weapon)); - + ReplaceString(weapon, sizeof(weapon), "weapon_", ""); - + if (IsWeaponRestricted(weapon)) { ZRiot_PrintToChat(client, "Weapon is restricted", weapon); return Plugin_Handled; } - + return Plugin_Continue; } @@ -61,21 +61,21 @@ WepRestrictQuery:RestrictWeapon(const String:weapon[]) if (IsWeaponGroup(weapon)) { RestrictWeaponGroup(weapon); - + ZRiot_PrintToChat(0, "Weapon group has been restricted", weapon); - + return Successful; } - + if (!IsWeaponRestricted(weapon)) { PushArrayString(restrictedWeapons, weapon); - + ZRiot_PrintToChat(0, "Weapon has been restricted", weapon); - + return Successful; } - + return Existing; } @@ -120,26 +120,26 @@ RestrictWeaponGroup(const String:group[]) PushArrayString(restrictedWeapons, "awp"); } } - + WepRestrictQuery:UnRestrictWeapon(const String:weapon[]) { if (IsWeaponGroup(weapon)) { UnRestrictWeaponGroup(weapon); - + ZRiot_PrintToChat(0, "Weapon group has been unrestricted", weapon); - + return Successful; } - + new index = GetRestrictedWeaponIndex(weapon); - + if (index > -1) { RemoveFromArray(restrictedWeapons, index); - + ZRiot_PrintToChat(0, "Weapon has been unrestricted", weapon); - + return Successful; } @@ -194,13 +194,13 @@ bool:IsWeaponRestricted(const String:weapon[]) { decl String:restrictedweapon[32]; GetArrayString(restrictedWeapons, x, restrictedweapon, sizeof(restrictedweapon)); - + if (StrEqual(weapon, restrictedweapon, false)) { return true; } } - + return false; } @@ -211,13 +211,13 @@ GetRestrictedWeaponIndex(const String:weapon[]) decl String:restrictedweapon[32]; GetArrayString(restrictedWeapons, x, restrictedweapon, sizeof(restrictedweapon)); ReplaceString(restrictedweapon, sizeof(restrictedweapon), "weapon_", ""); - + if (StrEqual(weapon, restrictedweapon, false)) { return x; } } - + return -1; } @@ -233,40 +233,40 @@ public Action:Weapon_CanUse(client, weapon) { return Plugin_Continue; } - + new String:weaponname[32]; if (!weapon || !GetEdictClassname(weapon, weaponname, sizeof(weaponname))) { return Plugin_Continue; } - + ReplaceString(weaponname, sizeof(weaponname), "weapon_", ""); - + decl String:model[256]; GetClientModel(client, model, sizeof(model)); - + ReplaceString(model, sizeof(model), ".mdl", ""); - + if (FindStringInArray(adtModels, model) > -1 && !StrEqual(weaponname, "knife")) { return Plugin_Handled; } - + if (IsWeaponRestricted(weaponname)) { return Plugin_Handled; } - + if (IsPlayerZombie(client) && !StrEqual(weaponname, "knife")) { if (StrEqual(weaponname, "glock") || StrEqual(weaponname, "usp")) { CreateTimer(0.0, RemoveSpawnWeapon, weapon); } - + return Plugin_Handled; } - + return Plugin_Continue; } @@ -275,5 +275,5 @@ public Action:RemoveSpawnWeapon(Handle:timer, any:weapon) if (IsValidEdict(weapon)) { RemoveEdict(weapon); - } + } } \ No newline at end of file diff --git a/src/zriot/zombiedata.inc b/src/zriot/zombiedata.inc index 957745f..611d628 100644 --- a/src/zriot/zombiedata.inc +++ b/src/zriot/zombiedata.inc @@ -258,21 +258,22 @@ ApplyZombieHealth(client, zombieid) { if (IsValidZombieID(zombieid)) { - new iCount = 0; + new iClientCount = 0; - for (new i = 1; i <= MaxClients; i++) - { - if (IsValidClient(i) && (GetClientTeam(i) == 3) && IsPlayerAlive(i)) - { - iCount++; - } - } - if (iCount == 0) - { - iCount++; - } + for (new i = 1; i <= MaxClients; i++) + { + if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_CT) + { + iClientCount++; + } + } - SetEntityHealth(client, arrayZombies[zombieid][data_health]*iCount); + if (iClientCount == 0) + { + iClientCount++; + } + + SetEntityHealth(client, arrayZombies[zombieid][data_health] * iClientCount); } } @@ -308,17 +309,4 @@ ApplyZombieFOV(client, zombieid) { SetPlayerFOV(client, arrayZombies[zombieid][data_fov]); } -} - -//---------------------------------------------------------------------------------------------------- -// Purpose: -//---------------------------------------------------------------------------------------------------- -int:IsValidClient(client, nobots = true) -{ - if (client <= 0 || client > MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client))) - { - return false; - } - - return IsClientInGame(client); } \ No newline at end of file diff --git a/src/zriot/zombieriot.inc b/src/zriot/zombieriot.inc index a91f1c0..8afa75e 100644 --- a/src/zriot/zombieriot.inc +++ b/src/zriot/zombieriot.inc @@ -3,25 +3,25 @@ * Zombie Riot * File: zombieriot.inc * Author: Greyscale - * ==================== + * ==================== */ -#define Target_Bombed 0 // Target Successfully Bombed! -#define VIP_Escaped 1 // The VIP has escaped! -#define VIP_Assassinated 2 // VIP has been assassinated! -#define Terrorists_Escaped 3 // The terrorists have escaped! -#define CTs_PreventEscape 4 // The CT's have prevented most of the terrorists from escaping! -#define Escaping_Terrorists_Neutralized 5 // Escaping terrorists have all been neutralized! -#define Bomb_Defused 6 // The bomb has been defused! -#define CTs_Win 7 // Counter-Terrorists Win! -#define Terrorists_Win 8 // Terrorists Win! -#define Round_Draw 9 // Round Draw! -#define All_Hostages_Rescued 10 // All Hostages have been rescued! -#define Target_Saved 11 // Target has been saved! -#define Hostages_Not_Rescued 12 // Hostages have not been rescued! -#define Terrorists_Not_Escaped 13 // Terrorists have not escaped! -#define VIP_Not_Escaped 14 // VIP has not escaped! -#define Game_Commencing 15 // Game Commencing! +#define Target_Bombed 0 // Target Successfully Bombed! +#define VIP_Escaped 1 // The VIP has escaped! +#define VIP_Assassinated 2 // VIP has been assassinated! +#define Terrorists_Escaped 3 // The terrorists have escaped! +#define CTs_PreventEscape 4 // The CT's have prevented most of the terrorists from escaping! +#define Escaping_Terrorists_Neutralized 5 // Escaping terrorists have all been neutralized! +#define Bomb_Defused 6 // The bomb has been defused! +#define CTs_Win 7 // Counter-Terrorists Win! +#define Terrorists_Win 8 // Terrorists Win! +#define Round_Draw 9 // Round Draw! +#define All_Hostages_Rescued 10 // All Hostages have been rescued! +#define Target_Saved 11 // Target has been saved! +#define Hostages_Not_Rescued 12 // Hostages have not been rescued! +#define Terrorists_Not_Escaped 13 // Terrorists have not escaped! +#define VIP_Not_Escaped 14 // VIP has not escaped! +#define Game_Commencing 15 // Game Commencing! #define DXLEVEL_MIN 90 @@ -61,7 +61,7 @@ FindClientDXLevel(client) { return; } - + mat_dxlevel = QueryClientConVar(client, "mat_dxlevel", DXLevelClientQuery); } @@ -71,14 +71,14 @@ public DXLevelClientQuery(QueryCookie:cookie, client, ConVarQueryResult:result, { return; } - + dxLevel[client] = 0; - + if (result != ConVarQuery_Okay) { return; } - + dxLevel[client] = StringToInt(cvarValue); } @@ -87,10 +87,10 @@ DisplayClientOverlay(client, const String:overlay[]) if (!dxLevel[client]) { FindClientDXLevel(client); - + return; } - + if (dxLevel[client] >= DXLEVEL_MIN) { ClientCommand(client, "r_screenoverlay \"%s\"", overlay); @@ -104,14 +104,14 @@ DisplayClientOverlay(client, const String:overlay[]) stock GotoNextMap() { new Handle:timelimit = FindConVar("mp_timelimit"); - + if (timelimit == INVALID_HANDLE) { return; } - + new flags = GetConVarFlags(timelimit) & FCVAR_NOTIFY; SetConVarFlags(timelimit, flags); - + SetConVarInt(timelimit, 1); } \ No newline at end of file