Raised This Month: $51 Target: $400
 12% 

[TF2] Self-Made Trail


Post New Thread Reply   
 
Thread Tools Display Modes
Author
MasterXykon
BANNED
Join Date: Apr 2012
Plugin ID:
3753
Plugin Version:
1.01
Plugin Category:
Fun Stuff
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Sparkly Sparkles!!
    Old 07-16-2013 , 06:04   [TF2] Self-Made Trail
    Reply With Quote #1

    Become Self-Made!


    Gives Sparkly Trails




    Spawning Commands:

    sm_sparkle_head
    sm_sparkle_feet



    Removing Commands:

    sm_sparkle_off



    Changes:

    v1.01
    Fixed up, and added abrandnewday's changes

    v1.00
    Initial Release


    Attached Files
    File Type: sp Get Plugin or Get Source (tf2_sparkles.sp - 1946 views - 3.8 KB)

    Last edited by MasterXykon; 07-17-2013 at 03:41. Reason: Commands Mixed Up
    MasterXykon is offline
    micazoid
    Veteran Member
    Join Date: Oct 2010
    Location: Munich - Germany
    Old 07-16-2013 , 07:06   Re: Self-Made Trail
    Reply With Quote #2

    Cool
    Screenshot?
    __________________
    micazoid is offline
    DeadFuze
    Junior Member
    Join Date: Mar 2013
    Location: Somewhere.
    Old 07-16-2013 , 10:34   Re: Self-Made Trail
    Reply With Quote #3

    Quote:
    Originally Posted by MasterXykon View Post
    ...
    sm_sm
    ...
    wot

    Not a bit too many aliases?

    Last edited by DeadFuze; 07-16-2013 at 10:38.
    DeadFuze is offline
    lyric
    Veteran Member
    Join Date: Sep 2012
    Old 07-16-2013 , 11:06   Re: Self-Made Trail
    Reply With Quote #4

    Quote:
    Originally Posted by DeadFuze View Post
    wot

    Not a bit too many aliases?
    I can forsee a very bad "yo dawg" joke coming
    __________________
    lyric is offline
    captaindeterprimary
    AlliedModders Donor
    Join Date: Sep 2012
    Old 07-16-2013 , 12:03   Re: Self-Made Trail
    Reply With Quote #5

    Straight to the point. I like it, however does this use a "sparkle" particle that is stock ingame or is it a thirdparty particle, can we change said particle? If so how. And dat command list... Cool so I can pretty much just add more effects really easily.
    __________________
    Last edited by ; Today at 08:20 AM. Reason: Get rid of s

    Last edited by captaindeterprimary; 07-16-2013 at 12:13.
    captaindeterprimary is offline
    Pelipoika
    Veteran Member
    Join Date: May 2012
    Location: Inside
    Old 07-16-2013 , 12:09   Re: Self-Made Trail
    Reply With Quote #6

    Quote:
    Originally Posted by vman315 View Post
    Straight to the point. I like it, however does this use a "sparkle" particle that is stock ingame or is it a thirdparty particle, can we change said particle? If so how. And dat command list...
    From the source:

    DispatchKeyValue(ent1, "effect_name", "community_sparkle");

    it uses the default community_sparkle effect found in TF2

    (And thus it should be tagged [TF2] Maybe?)

    Last edited by Pelipoika; 07-16-2013 at 12:09.
    Pelipoika is offline
    captaindeterprimary
    AlliedModders Donor
    Join Date: Sep 2012
    Old 07-16-2013 , 12:16   Re: Self-Made Trail
    Reply With Quote #7

    Quote:
    Originally Posted by Pelipoika View Post
    From the source:

    DispatchKeyValue(ent1, "effect_name", "community_sparkle");

    it uses the default community_sparkle effect found in TF2

    (And thus it should be tagged [TF2] Maybe?)
    Yea I just about to look at the source when my boss walked into the room. I removed all commands but sm_sparkle and sm_sparkleoff, and saw that I can add more rather easily. I like it.
    __________________
    Last edited by ; Today at 08:20 AM. Reason: Get rid of s
    captaindeterprimary is offline
    404UserNotFound
    BANNED
    Join Date: Dec 2011
    Old 07-16-2013 , 14:02   Re: Self-Made Trail
    Reply With Quote #8

    Ooh, this could very easily be turned into a Basic Donator Interface-using Donator plugin. And I think that's exactly what I'll do (credit will be given to MasterXykon of course)

    EDIT: Tested this out ingame, not happy that the particle spawns at the players feet. I did have code lying around for attaching particles to the players back (just behind their head). I'm gonna look for it and see what I can do.

    EDIT 2: So I found the code, turns out it's from Noodleboy347's old Premium Mod plugin. I'm recoding this plugin right now so that you can only equip one sparkle effect (which eliminates that glitch where you can equip numerous effects, but can't remove them all), and also adding in separate commands, one for a normal particle attachment, and one for at the head.

    EDIT 3: Ok so here's what I've come up with. I haven't quite yet tested it ingame, but it should work much better, detecting if you already have a sparkle effect, not creating a new one if you do, etc.

    Just some tips for you though, MasterXykon:
    1. You don't need to do individual #define's for "PLUGIN_AUTHOR", "PLUGIN_DESCRIPTION", etc. You only really need to define the PLUGIN_VERSION, for the version ConVar which you need to add in order for this plugin to be approved. In the code below, I've put an example of how the plugin version ConVar should look.
    2. You should use my "g_Sparkled" setup in the future, as it allows you to set a "flag" of sorts on the player. As well, you need OnClientDisconnect to tell the game to delete the particle, if the player has a particle.
    3. You were missing "#pragma semicolon 1", which means you need to close things off with ;
    4. My example below uses a timer setup. That's because the code I used from noodleboy's Premium Mod was built to use a timer. I should've recoded your particle creation/removal code to make a non-timer-using version, but I forgot about it

    PHP Code:
    #include <sourcemod>
    #include <sdktools>
    #include <tf2>
    #include <tf2_stocks>
    #include <clientprefs>

    #pragma semicolon 1

    #define NO_ATTACH 0
    #define ATTACH_NORMAL 1
    #define ATTACH_HEAD 2

    new bool:g_Sparkled[MAXPLAYERS+1];

    #define PLUGIN_VERSION      "1.00"

    public Plugin:myinfo =
    {
        
    name        "[TF2] Sparkles",
        
    author      "Master Xykon",
        
    description "Adds Community Sparkle trails",
        
    version     PLUGIN_VERSION
    };

    public 
    OnPluginStart()
    {
        
    CreateConVar("sm_sparkletrail_version"PLUGIN_VERSION"Plugin Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
        
    RegConsoleCmd("sm_sparkle1"SparkleNormal"Become Sparkly");
        
    RegConsoleCmd("sm_sparkle2"SparkleHead"Become Sparkly");
        
        
    RegConsoleCmd("sm_sparkle_off"SparkleOff"Remove Sparkly");
    }

    public 
    OnClientDisconnect(client)
    {
        if(
    g_Sparkled[client] == true)
        {    
            
    DeleteParticle(particle);
            
    g_Sparkled[client] = false;
        }
    }

    public 
    Action:SparkleNormal(clientargs)
    {
        if(
    g_Sparkled[client] == true)
        {
            
    PrintToChat(client"[SM] Sorry, you've already been Sparkled!");
            return 
    Plugin_Handled;
        }
        else
        {
            
    CreateParticle("community_sparkle"300.0clientATTACH_NORMAL);
            
    g_Sparkled[client] = true;
        }
    }

    public 
    Action:SparkleHead(clientargs)
    {
        if(
    g_Sparkled[client] == true)
        {
            
    PrintToChat(client"[Sparkles] Sorry, you've already been Self-Made!");
            return 
    Plugin_Handled;
        }
        else
        {
            
    CreateParticle("community_sparkle"300.0clientATTACH_HEAD);
            
    PrintToChat(client"[Sparkles] You've been Self-Made'd!");
            
    g_Sparkled[client] = true;
        }
    }

    public 
    Action:SparkleOff(clientargs)
    {
        if (
    g_Sparkled[client] == true)
        {
            
    DeleteParticle(particle);
            
    PrintToChat(client"[Sparkles]  Your Self-Made wore off!");
        }
        else
        {
            
    PrintToChat(client"[Sparkles]  Sorry, you're not Self-Made'd!");
        }
        return 
    Plugin_Handled;
    }

    stock Handle:CreateParticle(String:type[], Float:timeentityattach=NO_ATTACHFloat:xOffs=0.0Float:yOffs=0.0Float:zOffs=0.0)
    {
        new 
    particle CreateEntityByName("info_particle_system");
        
        if (
    IsValidEdict(particle))
        {
            
    decl Float:pos[3];
            
    GetEntPropVector(entityProp_Send"m_vecOrigin"pos);
            
    pos[0] += xOffs;
            
    pos[1] += yOffs;
            
    pos[2] += zOffs;
            
    TeleportEntity(particleposNULL_VECTORNULL_VECTOR);
            
    DispatchKeyValue(particle"effect_name"type);

            if (
    attach != NO_ATTACH)
            {
                
    SetVariantString("!activator");
                
    AcceptEntityInput(particle"SetParent"entityparticle0);
            
                if (
    attach == ATTACH_HEAD)
                {
                    
    SetVariantString("head");
                    
    AcceptEntityInput(particle"SetParentAttachmentMaintainOffset"particleparticle0);
                }
            }
            
    DispatchKeyValue(particle"targetname""present");
            
    DispatchSpawn(particle);
            
    ActivateEntity(particle);
            
    AcceptEntityInput(particle"Start");
            return 
    CreateTimer(timeDeleteParticleparticle);
        }
        else
        {
            
    LogError("(CreateParticle): Could not create info_particle_system");
        }
        
        return 
    INVALID_HANDLE;
    }

    public 
    Action:DeleteParticle(handle:timerany:particle)
    {
        if (
    IsValidEdict(particle))
        {
            new 
    String:classname[64];
            
    GetEdictClassname(particleclassnamesizeof(classname));
            
            if (
    StrEqual(classname"info_particle_system"false))
            {
                
    RemoveEdict(particle);
            }
        }


    Last edited by 404UserNotFound; 07-16-2013 at 14:42.
    404UserNotFound is offline
    Pelipoika
    Veteran Member
    Join Date: May 2012
    Location: Inside
    Old 07-16-2013 , 15:43   Re: Self-Made Trail
    Reply With Quote #9

    Quote:
    Originally Posted by abrandnewday View Post
    Ooh, this could very easily be turned into a Basic Donator Interface-using Donator plugin. And I think that's exactly what I'll do (credit will be given to MasterXykon of course)

    EDIT: Tested this out ingame, not happy that the particle spawns at the players feet. I did have code lying around for attaching particles to the players back (just behind their head). I'm gonna look for it and see what I can do.

    EDIT 2: So I found the code, turns out it's from Noodleboy347's old Premium Mod plugin. I'm recoding this plugin right now so that you can only equip one sparkle effect (which eliminates that glitch where you can equip numerous effects, but can't remove them all), and also adding in separate commands, one for a normal particle attachment, and one for at the head.

    EDIT 3: Ok so here's what I've come up with. I haven't quite yet tested it ingame, but it should work much better, detecting if you already have a sparkle effect, not creating a new one if you do, etc.

    Just some tips for you though, MasterXykon:
    1. You don't need to do individual #define's for "PLUGIN_AUTHOR", "PLUGIN_DESCRIPTION", etc. You only really need to define the PLUGIN_VERSION, for the version ConVar which you need to add in order for this plugin to be approved. In the code below, I've put an example of how the plugin version ConVar should look.
    2. You should use my "g_Sparkled" setup in the future, as it allows you to set a "flag" of sorts on the player. As well, you need OnClientDisconnect to tell the game to delete the particle, if the player has a particle.
    3. You were missing "#pragma semicolon 1", which means you need to close things off with ;
    4. My example below uses a timer setup. That's because the code I used from noodleboy's Premium Mod was built to use a timer. I should've recoded your particle creation/removal code to make a non-timer-using version, but I forgot about it

    PHP Code:
    -SNIP
    This could all be so much simpler if only TF2Attributes worked :/

    Code:
    TF2Attrib_SetByName(client, "attach particle effect", 4.0);
    Pelipoika is offline
    404UserNotFound
    BANNED
    Join Date: Dec 2011
    Old 07-16-2013 , 16:36   Re: Self-Made Trail
    Reply With Quote #10

    Quote:
    Originally Posted by Pelipoika View Post
    This could all be so much simpler if only TF2Attributes worked :/

    Code:
    TF2Attrib_SetByName(client, "attach particle effect", 4.0);
    Yeah but that would set the attribute on the weapon, whereas this plugin sets the effect at the players feet, and my version sets it either at the head (i think more behind the head) or on the back.
    404UserNotFound is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 07:25.


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