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

Auto-Respawn for some time.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ardonicek
Senior Member
Join Date: Feb 2013
Location: My home
Old 09-01-2015 , 16:49   Auto-Respawn for some time.
Reply With Quote #1

Hello, i'm looking for a plugin, which will autorespawn players for the first minute.

If anyone finds or codes anyone for me, it will be great.

+ it would be great to announce in chat for how long is the autorespawn active and when the respawn ends.

Thank!
__________________
Latest plugin: dHUD Round | Timeleft
Ardonicek is offline
Send a message via ICQ to Ardonicek Send a message via Skype™ to Ardonicek
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-01-2015 , 17:12   Re: Auto-Respawn for some time.
Reply With Quote #2

This is one of those plugins where you need to mention which game you're talking about.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 09-02-2015 , 04:47   Re: Auto-Respawn for some time.
Reply With Quote #3

And ofc this is one of those topic you should have create in request section.
KissLick is offline
TheUnderTaker
Senior Member
Join Date: Dec 2013
Location: Israel
Old 09-02-2015 , 09:25   Re: Auto-Respawn for some time.
Reply With Quote #4

How much time you want for respawn? I can make it for you free
__________________
SourcePawn, C# and C++ Programmer.

My plugin list
TheUnderTaker is offline
Ardonicek
Senior Member
Join Date: Feb 2013
Location: My home
Old 09-02-2015 , 12:14   Re: Auto-Respawn for some time.
Reply With Quote #5

Quote:
Originally Posted by TheUnderTaker View Post
How much time you want for respawn? I can make it for you free
1 minute would be great

@Powerlord: CS:GO, forgot to mention that

@KissLick: I didn't see a request section for SourceMod, only for AMXX.
__________________
Latest plugin: dHUD Round | Timeleft
Ardonicek is offline
Send a message via ICQ to Ardonicek Send a message via Skype™ to Ardonicek
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 09-02-2015 , 12:34   Re: Auto-Respawn for some time.
Reply With Quote #6

This is something I threw together a few days ago, just change the Cvar to 60 seconds for a minute.

PHP Code:
#pragma semicolon 1

#define PLUGIN_AUTHOR "Addicted"
#define PLUGIN_VERSION "1.0"

#include <sourcemod>
#include <cstrike>
#include <colors_csgo>
#include <sdktools>

new bool:CanRespawn false;
new 
Handle:g_respawntime INVALID_HANDLE;
new 
Handle:g_minplayers INVALID_HANDLE;
new 
Handle:g_respawnteam INVALID_HANDLE;
new 
Handle:RespawnEndTimer INVALID_HANDLE;

public 
Plugin:myinfo 
{
    
name "Timed Respawn",
    
author PLUGIN_AUTHOR,
    
description "Respawn players based on a timer",
    
version PLUGIN_VERSION,
    
url "toxicgaming.org"
};

public 
OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeath);
    
HookEvent("round_start"Event_RoundStart);
    
HookEvent("round_end"Event_RoundEnd);    
    
    
g_minplayers CreateConVar("sm_respawn_minplayers""5""Minimum ammount of players on the client's team to allow respawn (Including client)"_true2.0);
    
g_respawntime CreateConVar("sm_respawn_time""30""How long in seconds to autorespawn all players for"_true5.0);
    
g_respawnteam CreateConVar("sm_respawn_team""0""Which team should be respawned. (0 = both, 1 = T, 2 = CT)"_true0.0true2.0);
    
AutoExecConfig(true"repsawntime");
}

public 
OnMapStart()
{
    
CanRespawn false;
}

public 
Action:EndRespawn(Handle:timer)
{
    
CanRespawn false;
    
CPrintToChatAll("[{blue}Auto-Respawn{default}] Players will no longer be {green}autorespawned{default}.");
}

public 
Action:Event_RoundStart(Handle:event, const String:name[], bool:dontbroadcast)
{
    
CanRespawn true;
    
    new 
respawntime GetConVarInt(g_respawntime);
    
RespawnEndTimer CreateTimer(respawntime 1.0EndRespawn);
}
    
public 
Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontbroadcast)
{
    
CanRespawn false;
    
    
KillTimer(RespawnEndTimer);
    
RespawnEndTimer INVALID_HANDLE;
}

public 
Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontbroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
ShouldRespawn(client) == 1)
    {
        
CreateTimer(1.0RespawnClientclient);
    }
}

public 
EventJoinTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
ShouldRespawn(client) == 1)
    {
        
CreateTimer(1.0RespawnClientclient);
    }
}

int ShouldRespawn(client)
{
    
int value;
    
int g_Team GetConVarInt(g_respawnteam);
    new 
iTeam GetClientTeam(client);
    
    if (
g_Team == || g_Team == iTeam -1)
    {
        if (
CanRespawn)
        {
            if (
GetTeamClientCount(iTeam) >= GetConVarInt(g_minplayers))
            {
                
value 1;
            }
            else
            {
                
value = -1;
                
CPrintToChat(client"[{blue}Auto-Respawn{default}] The minimum ammount of players to {green}autorespawn{default} hasn't been reached.");
            }
        }
        else
        {
            
value = -1;
            
CPrintToChat(client"[{blue}Auto-Respawn{default}] It is too late to be {green}autorespawn{default}.");
        }
    }
    else
    {
        
value = -1;
        
CPrintToChat(client"[{blue}Auto-Respawn{default}] Your team is not set to {green}autorespawn{default}.");
    }
    return 
value;
}

public 
Action:RespawnClient(Handle:timeranydata)
{
    
CS_RespawnPlayer(data);

Addicted. is offline
iGANGNAM
AlliedModders Donor
Join Date: Sep 2012
Location: Lithuania
Old 09-02-2015 , 12:47   Re: Auto-Respawn for some time.
Reply With Quote #7

@oaaron99 you should release as real plugin. I was looking something like this too.

here is colors_csgo if someone doesn't have in case.
Attached Files
File Type: inc colors_csgo.inc (15.5 KB, 165 views)
File Type: sp Get Plugin or Get Source (reconnect.sp - 132 views - 3.5 KB)

Last edited by iGANGNAM; 09-02-2015 at 12:51.
iGANGNAM is offline
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 09-02-2015 , 13:35   Re: Auto-Respawn for some time.
Reply With Quote #8

Quote:
Originally Posted by iGANGNAM View Post
@oaaron99 you should release as real plugin. I was looking something like this too.

here is colors_csgo if someone doesn't have in case.
My bad I forgot to include the include.
Addicted. is offline
TheUnderTaker
Senior Member
Join Date: Dec 2013
Location: Israel
Old 09-02-2015 , 13:41   Re: Auto-Respawn for some time.
Reply With Quote #9

Quote:
Originally Posted by oaaron99 View Post
This is something I threw together a few days ago, just change the Cvar to 60 seconds for a minute.

PHP Code:
#pragma semicolon 1

#define PLUGIN_AUTHOR "Addicted"
#define PLUGIN_VERSION "1.0"

#include <sourcemod>
#include <cstrike>
#include <colors_csgo>
#include <sdktools>

new bool:CanRespawn false;
new 
Handle:g_respawntime INVALID_HANDLE;
new 
Handle:g_minplayers INVALID_HANDLE;
new 
Handle:g_respawnteam INVALID_HANDLE;
new 
Handle:RespawnEndTimer INVALID_HANDLE;

public 
Plugin:myinfo 
{
    
name "Timed Respawn",
    
author PLUGIN_AUTHOR,
    
description "Respawn players based on a timer",
    
version PLUGIN_VERSION,
    
url "toxicgaming.org"
};

public 
OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeath);
    
HookEvent("round_start"Event_RoundStart);
    
HookEvent("round_end"Event_RoundEnd);    
    
    
g_minplayers CreateConVar("sm_respawn_minplayers""5""Minimum ammount of players on the client's team to allow respawn (Including client)"_true2.0);
    
g_respawntime CreateConVar("sm_respawn_time""30""How long in seconds to autorespawn all players for"_true5.0);
    
g_respawnteam CreateConVar("sm_respawn_team""0""Which team should be respawned. (0 = both, 1 = T, 2 = CT)"_true0.0true2.0);
    
AutoExecConfig(true"repsawntime");
}

public 
OnMapStart()
{
    
CanRespawn false;
}

public 
Action:EndRespawn(Handle:timer)
{
    
CanRespawn false;
    
CPrintToChatAll("[{blue}Auto-Respawn{default}] Players will no longer be {green}autorespawned{default}.");
}

public 
Action:Event_RoundStart(Handle:event, const String:name[], bool:dontbroadcast)
{
    
CanRespawn true;
    
    new 
respawntime GetConVarInt(g_respawntime);
    
RespawnEndTimer CreateTimer(respawntime 1.0EndRespawn);
}
    
public 
Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontbroadcast)
{
    
CanRespawn false;
    
    
KillTimer(RespawnEndTimer);
    
RespawnEndTimer INVALID_HANDLE;
}

public 
Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontbroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
ShouldRespawn(client) == 1)
    {
        
CreateTimer(1.0RespawnClientclient);
    }
}

public 
EventJoinTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
ShouldRespawn(client) == 1)
    {
        
CreateTimer(1.0RespawnClientclient);
    }
}

int ShouldRespawn(client)
{
    
int value;
    
int g_Team GetConVarInt(g_respawnteam);
    new 
iTeam GetClientTeam(client);
    
    if (
g_Team == || g_Team == iTeam -1)
    {
        if (
CanRespawn)
        {
            if (
GetTeamClientCount(iTeam) >= GetConVarInt(g_minplayers))
            {
                
value 1;
            }
            else
            {
                
value = -1;
                
CPrintToChat(client"[{blue}Auto-Respawn{default}] The minimum ammount of players to {green}autorespawn{default} hasn't been reached.");
            }
        }
        else
        {
            
value = -1;
            
CPrintToChat(client"[{blue}Auto-Respawn{default}] It is too late to be {green}autorespawn{default}.");
        }
    }
    else
    {
        
value = -1;
        
CPrintToChat(client"[{blue}Auto-Respawn{default}] Your team is not set to {green}autorespawn{default}.");
    }
    return 
value;
}

public 
Action:RespawnClient(Handle:timeranydata)
{
    
CS_RespawnPlayer(data);

LOL much lines for little actions, You could do that in 5 lines.
__________________
SourcePawn, C# and C++ Programmer.

My plugin list

Last edited by TheUnderTaker; 09-02-2015 at 13:42.
TheUnderTaker is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-02-2015 , 13:45   Re: Auto-Respawn for some time.
Reply With Quote #10

Quote:
Originally Posted by Ardonicek View Post
@KissLick: I didn't see a request section for SourceMod, only for AMXX.
SourceMod Plugin/Gameplay Ideas and Requests
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 09-02-2015 at 13:45.
Powerlord 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:23.


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