Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Action:REPLACEMEDKITS(Handle:Timer)
- {
- new EntityCount = GetEntityCount();
- for (new entity = 0; entity < EntityCount; entity++)
- {
- if (!IsValidEdict(entity))
- {
- continue;
- }
- new String:classname[128], String:model[128];
- GetEdictClassname(entity, classname, sizeof(classname));
- GetEntPropString(entity, Prop_Data, "m_ModelName", model, sizeof(model));
- if (StrContains(classname, "weapon_first_aid_kit", false) != -1 || StrEqual(model, MODEL_KIT))
- {
- new pills = CreateEntityByName("weapon_pain_pills_spawn");
- new Float:Origin[3];
- GetEntPropVector(entity, Prop_Send, "m_vecOrigin", Origin);
- TeleportEntity(pills, Origin, NULL_VECTOR, NULL_VECTOR);
- DispatchSpawn(pills);
- //SetEntityModel(pills, "models/w_models/weapons/w_eq_painpills.mdl");
- AcceptEntityInput(entity, "kill");
- }
- }
- }
- public Action:GiveItems(Handle:Timer)
- {
- for (new i = 1; i <= MaxClients; i++)
- {
- if (IsSurvivor(i))
- {
- new item = GetPlayerWeaponSlot(i, 3);
- new defib;
- if (!IsValidEdict(item))
- {
- new rng = GetRandomInt(1, 2);
- switch (rng)
- {
- case 1:defib = CreateEntityByName("weapon_defibrillator");
- case 2:defib = CreateEntityByName("weapon_first_aid_kit");
- }
- DispatchSpawn(defib);
- EquipPlayerWeapon(i, defib);
- }
- item = GetPlayerWeaponSlot(i, 4);
- if (!IsValidEdict(item))
- {
- new rng = GetRandomInt(1, 2);
- switch (rng)
- {
- case 1:defib = CreateEntityByName("weapon_pain_pills");
- case 2:defib = CreateEntityByName("weapon_adrenaline");
- }
- DispatchSpawn(defib);
- EquipPlayerWeapon(i, defib);
- }
- }
- }
- }
- public Action:CheckMaxPlayers(Handle:Timer)
- {
- new Survivors = 0;
- new LastBot = 0;
- for (new i = 1; i <= MaxClients; i++)
- {
- if (IsSurvivor(i))
- {
- Survivors++;
- }
- if (IsSurvivor(i) && IsFakeClient(i))
- {
- LastBot = i;
- }
- }
- if (Survivors < 8)
- {
- CreateBot();
- }
- else if (Survivors > 8 && IsSurvivor(LastBot) && IsFakeClient(LastBot))
- {
- KickClient(LastBot);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment