Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #pragma newdecls required
- #include <sdktools>
- public void OnPluginStart()
- {
- HookEvent("tank_spawn", TankSpawned);
- HookEvent("witch_spawn", Witch);
- }
- public void OnEntityCreated(int entity, const char[] classname)
- {
- CreateTimer(0.1, vSetHealth, entity);
- }
- public Action vSetHealth(Handle timer, int entity)
- {
- if(IsValidEntity(entity) && IsValidEdict(entity))
- {
- char sWeaponEx[56];
- GetEntityClassname(entity, sWeaponEx, sizeof(sWeaponEx));
- if(strcmp(sWeaponEx, "prop_door_rotating") == 0)
- {
- SetEntProp(entity, view_as<PropType>(1), "m_iMaxHealth", 63);
- SetEntProp(entity, view_as<PropType>(1), "m_iHealth", GetRandomInt(25, 63), 4);
- }
- else
- {
- SetEntProp(entity, view_as<PropType>(1), "m_iMaxHealth", 63);
- SetEntProp(entity, view_as<PropType>(1), "m_iHealth", GetRandomInt(25, 63), 4);
- }
- }
- }
- public Action Witch(Handle event, const char[] name, bool dontBroadcast)
- {
- int iWitch = GetEventInt(event, "witchid");
- if(IsWitch(iWitch))
- {
- int iR = GetRandomInt(95, 126);
- SetEntProp(iWitch, view_as<PropType>(1), "m_iHealth", iR, 4);
- }
- }
- public Action TankSpawned(Handle event, const char[] name, bool dontBroadcast)
- {
- int iTank = GetClientOfUserId(GetEventInt(event, "userid"));
- if(IsValidInfected(iTank))
- {
- CreateTimer(0.1, timer, iTank, TIMER_FLAG_NO_MAPCHANGE);
- }
- }
- public Action timer(Handle timer, any client)
- {
- if(IsValidInfected(client))
- {
- SetEntityHealth(client, GetRandomInt(8165, 9072));
- }
- }
- public void OnClientPutInServer(int client)
- {
- CreateTimer(0.1, TimerD, client, TIMER_FLAG_NO_MAPCHANGE);
- }
- public Action TimerD(Handle timer, any client)
- {
- if (IsValidInfected(client))
- {
- if(GetClientTeam(client) == 3)
- {
- int class = GetEntProp(client, Prop_Send, "m_zombieClass");
- switch(class)
- {
- case 1:
- {
- SetEntityHealth(client, GetRandomInt(265, 378));
- }
- case 2:
- {
- SetEntityHealth(client, GetRandomInt(28, 70));
- }
- case 3:
- {
- SetEntityHealth(client, GetRandomInt(176, 252));
- }
- case 4:
- {
- SetEntityHealth(client, GetRandomInt(104, 189));
- }
- case 5:
- {
- SetEntityHealth(client, GetRandomInt(176, 252));
- }
- case 6:
- {
- SetEntityHealth(client, GetRandomInt(1210, 1512));
- }
- }
- }
- }
- }
- stock bool IsValidInfected(int client )
- {
- if ( client < 1 || client > MaxClients ) return false;
- if ( !IsClientConnected( client )) return false;
- if ( !IsClientInGame( client )) return false;
- if ( GetClientTeam( client ) != 3 ) return false;
- return true;
- }
- stock bool IsWitch(int entity)
- {
- if (entity > 0 && IsValidEntity(entity) && IsValidEdict(entity))
- {
- char entType[64];
- GetEdictClassname(entity, entType, sizeof(entType));
- return StrEqual(entType, "witch");
- }
- return false;
- }
- stock bool IsCommonInfected(int entity)
- {
- if (entity > 0 && IsValidEntity(entity) && IsValidEdict(entity))
- {
- char entType[64];
- GetEdictClassname(entity, entType, sizeof(entType));
- return StrEqual(entType, "infected");
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement