Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #pragma newdecls required
- #include <sourcemod>
- #include <sdktools>
- #define TEAM_INFECTED 3
- #define MODEL_CONCRETE_CHUNK "models/props_debris/concrete_chunk01a.mdl"
- #define MODEL_TREE_TRUNK "models/props_foliage/tree_trunk.mdl"
- #define MODEL_ROCK "models/props_wasteland/rock_moss02.mdl"
- #define MODEL_LOCK "models/props_wasteland/rockcliff_cluster03a_river.mdl" //1
- #define MODEL_DPAW "models/props_foliage/cedar_medium01.mdl"//2
- #define TYPE_CONCRETE_CHUNK (1 << 0)
- #define TYPE_TREE_TRUNK (1 << 1)
- public void OnMapStart()
- {
- PrecacheModel(MODEL_CONCRETE_CHUNK, true);
- PrecacheModel(MODEL_TREE_TRUNK, true);
- PrecacheModel(MODEL_ROCK, true);
- PrecacheModel(MODEL_LOCK, true);
- PrecacheModel(MODEL_DPAW, true);
- }
- public void OnEntityCreated(int entity, const char[] classname)
- {
- if (StrEqual(classname, "tank_rock", false))
- RequestFrame(OnTankRockNextFrame, EntIndexToEntRef(entity));
- }
- void OnTankRockNextFrame(int iEntRef)
- {
- if (!IsValidEntRef(iEntRef))
- return;
- int entity = EntRefToEntIndex(iEntRef);
- int client = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
- if (!IsValidClient(client))
- return;
- if (!IsPlayerAlive(client))
- return;
- if (GetClientTeam(client) != TEAM_INFECTED)
- return;
- if (IsPlayerGhost(client))
- return;
- switch (GetRandomInt(1, 5))
- {
- case 1: SetEntityModel(entity, MODEL_CONCRETE_CHUNK);
- case 2: SetEntityModel(entity, MODEL_TREE_TRUNK);
- case 3: SetEntityModel(entity, MODEL_ROCK);
- case 4: SetEntityModel(entity, MODEL_LOCK);
- case 5: SetEntityModel(entity, MODEL_DPAW);
- }
- }
- bool IsValidClient(int client)
- {
- return (1 <= client <= MaxClients && IsClientInGame(client));
- }
- bool IsPlayerGhost(int client)
- {
- return GetEntProp(client, Prop_Send, "m_isGhost", 1) == 1;
- }
- bool IsValidEntRef(int iEntRef)
- {
- return iEntRef != 0 && EntRefToEntIndex(iEntRef) != INVALID_ENT_REFERENCE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement