AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   Spell limits for teleport//tiny (https://forums.alliedmods.net/showthread.php?t=250643)

friagram 10-27-2014 18:44

Spell limits for teleport//tiny
 
There's some bugs associated with these spells, and I didn't see any snippets to limit them so I wrote this. Probably some people will be using tf_spells_enabled 1, since it's available now. Basically, teleport allows people to escape maps, and tiny bugs out and allows people to fall through maps when they become normal sized (sometimes).
You'll still get the infinite jump/rapid fire boost from the cond though. I replaced teleport with a respawn and random high tier spell summon. Also, since there's no limit on how many spell drops can spawn (if you get some kind of loop where players die a lot, or you set the tf_player_spell_drop_on_death_rate to 1 and such, you may get tons of spells. You can limit that by time. I set it to 2 seconds.

PHP Code:

#include <sourcemod>
#include <sdktools>
#include <tf2_stocks>
#include <sdkhooks>

public Plugin:myinfo =
{
    
name "Spell Limits",
    
author "Friagram",
    
description "Derp",
    
version "1.1",
    
url "http://steamcommunity.com/groups/poniponiponi"
};

public 
TF2_OnConditionAdded(clientTFCond:condition)
{
    if(
condition == TFCond_HalloweenTiny)
    {
        
TF2_RemoveCondition(clientTFCond_HalloweenTiny);
    }
}

public 
OnEntityCreated(entity, const String:classname[])
{
    static 
lastspell;

    if(
StrEqual(classname"tf_projectile_spelltransposeteleport"))
    {
        
SDKHook(entitySDKHook_SpawnPostCheckSpellSpawn);
    }
    else if(
StrEqual(classname"tf_spell_pickup"))
    {
        new 
time GetTime();
        if(
lastspell time)
        {
            
SDKHook(entitySDKHook_SpawnPostPickupSpawn);
        }
        
lastspell time 2;
    }
}

public 
Action:PickupSpawn(entity)
{
    
AcceptEntityInput(entity"Kill");
}

public 
Action:CheckSpellSpawn(entity)
{
    
RequestFrame(CheckSpellOwnerEntIndexToEntRef(entity));

    
SDKUnhook(entitySDKHook_SpawnPostCheckSpellSpawn);
}

public 
CheckSpellOwner(any:ref)
{
    new 
entity EntRefToEntIndex(ref);
    if(
entity != INVALID_ENT_REFERENCE)
    {
        new 
client GetEntPropEnt(entityProp_Send"m_hOwnerEntity");

        if(
client >&& client<=MaxClients && IsClientInGame(client))
        {
            
AcceptEntityInput(client"RollRareSpell");
        }
        
AcceptEntityInput(entity"Kill");
    }




All times are GMT -4. The time now is 18:27.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.