Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sdktools>
- #pragma semicolon 1
- #pragma newdecls required
- public void OnPluginStart()
- {
- HookEvent("tank_spawn", TankSpawned);
- HookEvent("witch_spawn", Witch);
- }
- public void OnEntityCreated(int 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 = -1;
- if(IsValidEntRef(ref))
- entity = EntRefToEntIndex(ref);
- else return;
- if(IsValidEntity(entity) && IsValidEdict(entity))
- {
- SetEntProp(entity, Prop_Data, "m_iMaxHealth", 63);
- SetEntProp(entity, Prop_Data, "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, Prop_Send, "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(309, 441));
- }
- case 2:
- {
- SetEntityHealth(client, GetRandomInt(28, 70));
- }
- case 3:
- {
- SetEntityHealth(client, GetRandomInt(176, 252));
- }
- case 4:
- {
- SetEntityHealth(client, GetRandomInt(220, 315));
- }
- case 5:
- {
- SetEntityHealth(client, GetRandomInt(141, 202));
- }
- 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;
- }
- bool IsValidEntRef(int iEnt)
- {
- if( iEnt && EntRefToEntIndex(iEnt) != INVALID_ENT_REFERENCE )
- return true;
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement