Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include sdktools
- #define ZOMBIECLASS_SMOKER 1
- #define ZOMBIECLASS_BOOMER 2
- #define ZOMBIECLASS_HUNTER 3
- #define ZOMBIECLASS_SPITTER 4
- #define ZOMBIECLASS_JOCKEY 5
- #define ZOMBIECLASS_CHARGER 6
- #define ZOMBIECLASS_WITCH 7
- #define ZOMBIECLASS_TANK 8
- public OnPluginStart()
- {
- HookEvent("tank_spawn", TankSpawned);
- HookEvent("witch_spawn", Witch);
- }
- public OnEntityCreated(entity, const char[] classname)
- {
- if(IsCommonInfected(entity))
- {
- CreateTimer(0.1, Timer_CommonSpawn, EntIndexToEntRef(entity), 2);
- }
- }
- public Action Timer_CommonSpawn(Handle timer, any ref)
- {
- int entity = EntRefToEntIndex(ref)
- if(entity > 1 && entity < 2049)
- {
- SetEntProp(entity, PropType:1, "m_iHealth", GetRandomInt(1, 500), 4);
- }
- }
- public Action:Witch(Handle:event, const String:ename[], bool:dontBroadcast)
- {
- int iWitch = GetEventInt(event, "witchid");
- if(IsWitch(iWitch))
- {
- int iR = GetRandomInt(1, 500)
- SetEntProp(iWitch, PropType:1, "m_iMaxHealth", iR, 4);
- SetEntProp(iWitch, PropType:1, "m_iHealth", iR, 4);
- }
- }
- public Action:TankSpawned(Handle:event, const String:ename[], 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(29030, 32256));
- }
- }
- public OnClientPutInServer(client)
- {
- CreateTimer(0.1, TimerD, client, TIMER_FLAG_NO_MAPCHANGE);
- }
- public Action:TimerD(Handle timer, any client)
- {
- if (IsInGame(client))
- {
- if(GetClientTeam(client) == 3)
- {
- new class = GetEntProp(client, Prop_Send, "m_zombieClass");
- if(class == ZOMBIECLASS_SMOKER)
- {
- SetEntityHealth(client, GetRandomInt(309, 441))
- }
- else if(class == ZOMBIECLASS_BOOMER)
- {
- SetEntityHealth(client, GetRandomInt(28, 70))
- }
- else if(class == ZOMBIECLASS_HUNTER)
- {
- SetEntityHealth(client, GetRandomInt(176, 252))
- }
- else if(class == ZOMBIECLASS_SPITTER)
- {
- SetEntityHealth(client, GetRandomInt(220, 315))
- }
- else if(class == ZOMBIECLASS_JOCKEY)
- {
- SetEntityHealth(client, GetRandomInt(141, 202))
- }
- else if(class == ZOMBIECLASS_CHARGER)
- {
- SetEntityHealth(client, GetRandomInt(1613, 2016))
- }
- }
- }
- }
- stock bool:IsValidInfected( 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;
- }
- stock bool:IsInGame( client )
- {
- if ( client < 1 || client > MaxClients ) return false;
- if ( !IsClientConnected( client )) return false;
- if ( !IsClientInGame( client )) return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement