Raised This Month: $ Target: $400
 0% 

[REQUEST] Insurgency Spawn Protect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kazam
New Member
Join Date: Aug 2016
Old 08-11-2016 , 23:51   [REQUEST] Insurgency Spawn Protect
Reply With Quote #1

Hello guys,

I tried to use this plugin https://forums.alliedmods.net/showth...awn+protection to protect the respawn of both teams in the Insurgency to avoid Respawn Kill, but is working only for one of the teams, anyone know how to solve this or have some other plugin?
kazam is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 08-12-2016 , 05:32   Re: [REQUEST] Insurgency Spawn Protect
Reply With Quote #2

Slighty edited the plugin you liked above. It should work now, but I didn't tested it. Any feedback would be great, so I can notice the original author of the plugin.

PHP Code:
#include <sourcemod>
#include <sdktools>

#define VERSION "1.5"
#pragma semicolon 1

new TeamSpec;
new 
TeamUna;
new 
bool:NoTeams false;

new 
Handle:SpawnProtectionEnabled;
new 
Handle:SpawnProtectionTime;
new 
Handle:SpawnProtectionNotify;
new 
Handle:SpawnProtectionColor;

new 
RenderOffs;

enum FX
{
    
FxNone 0,
    
FxPulseFast,
    
FxPulseSlowWide,
    
FxPulseFastWide,
    
FxFadeSlow,
    
FxFadeFast,
    
FxSolidSlow,
    
FxSolidFast,
    
FxStrobeSlow,
    
FxStrobeFast,
    
FxStrobeFaster,
    
FxFlickerSlow,
    
FxFlickerFast,
    
FxNoDissipation,
    
FxDistort,               // Distort/scale/translate flicker
    
FxHologram,              // kRenderFxDistort + distance fade
    
FxExplode,               // Scale up really big!
    
FxGlowShell,             // Glowing Shell
    
FxClampMinScale,         // Keep this sprite from getting very small (SPRITES only!)
    
FxEnvRain,               // for environmental rendermode, make rain
    
FxEnvSnow,               //  "        "            "    , make snow
    
FxSpotlight,     
    
FxRagdoll,
    
FxPulseFastWider,
};

enum Render
{
    
Normal 0,         // src
    
TransColor,         // c*a+dest*(1-a)
    
TransTexture,        // src*a+dest*(1-a)
    
Glow,                // src*a+dest -- No Z buffer checks -- Fixed size in screen space
    
TransAlpha,            // src*srca+dest*(1-srca)
    
TransAdd,            // src*a+dest
    
Environmental,        // not drawn, used for environmental effects
    
TransAddFrameBlend,    // use a fractional frame value to blend between animation frames
    
TransAlphaAdd,        // src + dest*(1-a)
    
WorldGlow,            // Same as kRenderGlow but not fixed size in screen space
    
None,                // Don't render.
};

public 
Plugin:myinfo 
{
    
name "Spawn Protection",
    
author "Fredd",
    
description "Adds spawn protection",
    
version VERSION,
    
url "www.sourcemod.net"
}

public 
OnPluginStart()
{
    
CreateConVar("spawnprotection_version"VERSION"Spawn Protection Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
    
SpawnProtectionEnabled        CreateConVar("sp_on""1");
    
SpawnProtectionTime            CreateConVar("sp_time""5");
    
SpawnProtectionNotify        CreateConVar("sp_notify""1");
    
SpawnProtectionColor        CreateConVar("sp_color""0 255 0 120");
    
    
AutoExecConfig(true"spawn_protection");
    
    
RenderOffs                    FindSendPropOffs("CBasePlayer""m_clrRender");
    
    
decl String:ModName[21];
    
GetGameFolderName(ModNamesizeof(ModName));
    
    if(
StrEqual(ModName"cstrike"false) || StrEqual(ModName"dod"false) || StrEqual(ModName"tf"false))
    {
        
TeamSpec 1;
        
TeamUna 0;
        
NoTeams false;
        
    } else if(
StrEqual(ModName"Insurgency"false))
    {
        
TeamSpec 1;
        
TeamUna 0;
        
NoTeams false;
    }
    else if(
StrEqual(ModName"hl2mp"false))
    {
        
NoTeams true;
    } else
    {
        
SetFailState("%s is an unsupported mod"ModName);
    }
    
HookEvent("player_spawn"OnPlayerSpawn);
}
public 
Action:OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    if(
GetConVarInt(SpawnProtectionEnabled) == 1)
    {
        new 
client     GetClientOfUserId(GetEventInt(event"userid"));
        new 
Team     GetClientTeam(client);
        
        if(
NoTeams == false)
        {
            if(
Team == TeamSpec || Team == TeamUna)
                return 
Plugin_Continue;
        }
        if(!
IsPlayerAlive(client))
            return 
Plugin_Continue;
        
        
decl String:SzColor[32];
        
decl String:Colors[4][4];
        new 
Float:Time float(GetConVarInt(SpawnProtectionTime));
        
        
GetConVarString(SpawnProtectionColorSzColorsizeof(SzColor));
        
ExplodeString(SzColor" "Colors44);
            
        
SetEntProp(clientProp_Data"m_takedamage"01);
        
set_rendering(clientFX:FxDistortStringToInt(Colors[0]),StringToInt(Colors[1]),StringToInt(Colors[2]), Render:RENDER_TRANSADDStringToInt(Colors[3]));
        
CreateTimer(TimeRemoveProtectionclient);
        if(
GetConVarInt(SpawnProtectionNotify) > 0)
            
PrintToChat(client"\x04[SpawnProtection] \x01you will be spawn protected for \x04%i \x01seconds"RoundToNearest(Time)); 
    }
    return 
Plugin_Continue;
}
public 
Action:RemoveProtection(Handle:timerany:client)
{
    if(
IsClientInGame(client))
    {
        
SetEntProp(clientProp_Data"m_takedamage"21);
        
set_rendering(client);
        if(
GetConVarInt(SpawnProtectionNotify) > 0)
            
PrintToChat(client"\x04[SpawnProtection] \x01spawn protection is now off..");
    }
}
stock set_rendering(indexFX:fx=FxNoner=255g=255b=255Render:render=Normalamount=255)
{
    
SetEntProp(indexProp_Send"m_nRenderFX"_:fx1);
    
SetEntProp(indexProp_Send"m_nRenderMode"_:render1);    
    
SetEntData(indexRenderOffsr1true);
    
SetEntData(indexRenderOffs 1g1true);
    
SetEntData(indexRenderOffs 2b1true);
    
SetEntData(indexRenderOffs 3amount1true);    

__________________
Want to check my plugins ?

Last edited by Arkarr; 08-12-2016 at 05:32.
Arkarr is offline
kazam
New Member
Join Date: Aug 2016
Old 08-12-2016 , 16:47   Re: [REQUEST] Insurgency Spawn Protect
Reply With Quote #3

Quote:
Originally Posted by Arkarr View Post
Slighty edited the plugin you liked above. It should work now, but I didn't tested it. Any feedback would be great, so I can notice the original author of the plugin.

PHP Code:
#include <sourcemod>
#include <sdktools>

#define VERSION "1.5"
#pragma semicolon 1

new TeamSpec;
new 
TeamUna;
new 
bool:NoTeams false;

new 
Handle:SpawnProtectionEnabled;
new 
Handle:SpawnProtectionTime;
new 
Handle:SpawnProtectionNotify;
new 
Handle:SpawnProtectionColor;

new 
RenderOffs;

enum FX
{
    
FxNone 0,
    
FxPulseFast,
    
FxPulseSlowWide,
    
FxPulseFastWide,
    
FxFadeSlow,
    
FxFadeFast,
    
FxSolidSlow,
    
FxSolidFast,
    
FxStrobeSlow,
    
FxStrobeFast,
    
FxStrobeFaster,
    
FxFlickerSlow,
    
FxFlickerFast,
    
FxNoDissipation,
    
FxDistort,               // Distort/scale/translate flicker
    
FxHologram,              // kRenderFxDistort + distance fade
    
FxExplode,               // Scale up really big!
    
FxGlowShell,             // Glowing Shell
    
FxClampMinScale,         // Keep this sprite from getting very small (SPRITES only!)
    
FxEnvRain,               // for environmental rendermode, make rain
    
FxEnvSnow,               //  "        "            "    , make snow
    
FxSpotlight,     
    
FxRagdoll,
    
FxPulseFastWider,
};

enum Render
{
    
Normal 0,         // src
    
TransColor,         // c*a+dest*(1-a)
    
TransTexture,        // src*a+dest*(1-a)
    
Glow,                // src*a+dest -- No Z buffer checks -- Fixed size in screen space
    
TransAlpha,            // src*srca+dest*(1-srca)
    
TransAdd,            // src*a+dest
    
Environmental,        // not drawn, used for environmental effects
    
TransAddFrameBlend,    // use a fractional frame value to blend between animation frames
    
TransAlphaAdd,        // src + dest*(1-a)
    
WorldGlow,            // Same as kRenderGlow but not fixed size in screen space
    
None,                // Don't render.
};

public 
Plugin:myinfo 
{
    
name "Spawn Protection",
    
author "Fredd",
    
description "Adds spawn protection",
    
version VERSION,
    
url "www.sourcemod.net"
}

public 
OnPluginStart()
{
    
CreateConVar("spawnprotection_version"VERSION"Spawn Protection Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
    
SpawnProtectionEnabled        CreateConVar("sp_on""1");
    
SpawnProtectionTime            CreateConVar("sp_time""5");
    
SpawnProtectionNotify        CreateConVar("sp_notify""1");
    
SpawnProtectionColor        CreateConVar("sp_color""0 255 0 120");
    
    
AutoExecConfig(true"spawn_protection");
    
    
RenderOffs                    FindSendPropOffs("CBasePlayer""m_clrRender");
    
    
decl String:ModName[21];
    
GetGameFolderName(ModNamesizeof(ModName));
    
    if(
StrEqual(ModName"cstrike"false) || StrEqual(ModName"dod"false) || StrEqual(ModName"tf"false))
    {
        
TeamSpec 1;
        
TeamUna 0;
        
NoTeams false;
        
    } else if(
StrEqual(ModName"Insurgency"false))
    {
        
TeamSpec 1;
        
TeamUna 0;
        
NoTeams false;
    }
    else if(
StrEqual(ModName"hl2mp"false))
    {
        
NoTeams true;
    } else
    {
        
SetFailState("%s is an unsupported mod"ModName);
    }
    
HookEvent("player_spawn"OnPlayerSpawn);
}
public 
Action:OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    if(
GetConVarInt(SpawnProtectionEnabled) == 1)
    {
        new 
client     GetClientOfUserId(GetEventInt(event"userid"));
        new 
Team     GetClientTeam(client);
        
        if(
NoTeams == false)
        {
            if(
Team == TeamSpec || Team == TeamUna)
                return 
Plugin_Continue;
        }
        if(!
IsPlayerAlive(client))
            return 
Plugin_Continue;
        
        
decl String:SzColor[32];
        
decl String:Colors[4][4];
        new 
Float:Time float(GetConVarInt(SpawnProtectionTime));
        
        
GetConVarString(SpawnProtectionColorSzColorsizeof(SzColor));
        
ExplodeString(SzColor" "Colors44);
            
        
SetEntProp(clientProp_Data"m_takedamage"01);
        
set_rendering(clientFX:FxDistortStringToInt(Colors[0]),StringToInt(Colors[1]),StringToInt(Colors[2]), Render:RENDER_TRANSADDStringToInt(Colors[3]));
        
CreateTimer(TimeRemoveProtectionclient);
        if(
GetConVarInt(SpawnProtectionNotify) > 0)
            
PrintToChat(client"\x04[SpawnProtection] \x01you will be spawn protected for \x04%i \x01seconds"RoundToNearest(Time)); 
    }
    return 
Plugin_Continue;
}
public 
Action:RemoveProtection(Handle:timerany:client)
{
    if(
IsClientInGame(client))
    {
        
SetEntProp(clientProp_Data"m_takedamage"21);
        
set_rendering(client);
        if(
GetConVarInt(SpawnProtectionNotify) > 0)
            
PrintToChat(client"\x04[SpawnProtection] \x01spawn protection is now off..");
    }
}
stock set_rendering(indexFX:fx=FxNoner=255g=255b=255Render:render=Normalamount=255)
{
    
SetEntProp(indexProp_Send"m_nRenderFX"_:fx1);
    
SetEntProp(indexProp_Send"m_nRenderMode"_:render1);    
    
SetEntData(indexRenderOffsr1true);
    
SetEntData(indexRenderOffs 1g1true);
    
SetEntData(indexRenderOffs 2b1true);
    
SetEntData(indexRenderOffs 3amount1true);    

I will try and tell you if it worked, right now, thank you!
kazam is offline
kazam
New Member
Join Date: Aug 2016
Old 08-14-2016 , 15:56   Re: [REQUEST] Insurgency Spawn Protect
Reply With Quote #4

@Arkarr Dude, thank you, I created the SMX and SP file and worked perfectly !!! Thank you very much!
kazam is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 08-15-2016 , 03:13   Re: [REQUEST] Insurgency Spawn Protect
Reply With Quote #5

I actually didn't do much, the original author made a error with the team number, I'll notify him.
__________________
Want to check my plugins ?
Arkarr 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 05:05.


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