Raised This Month: $71 Target: $400
 17% 

CS GO Respawn plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cosatzy
New Member
Join Date: Jun 2013
Old 07-15-2018 , 10:02   CS GO Respawn plugin
Reply With Quote #1

Hello guys
I've been looking for a respawn plugin for a long time.
I want that when the command "!respawn" is typed in chat I get respawn even if I'm dead or allive.
I need for my surf server.
Thx.

Last edited by cosatzy; 07-15-2018 at 10:10.
cosatzy is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Location: Not your business.
Old 07-15-2018 , 10:07   Re: CS GO Respawn plugin
Reply With Quote #2

There's tons of these plugins out there, use the search button top right corner

PHP Code:
#include <cstrike>

public void OnPluginStart()
{
    
RegConsoleCmd("sm_respawn"Cmd_Respawn);
}

public 
Action Cmd_Respawn(int iClientint iArgs)
{
    
CS_RespawnPlayer(iClient);

__________________
Taking requests, add me on Steam.

People make themselves understood in a way, others understand in another.
mug1wara is offline
cosatzy
New Member
Join Date: Jun 2013
Old 07-15-2018 , 10:24   Re: CS GO Respawn plugin
Reply With Quote #3

Can someone add 5 seconds delay until you can use the command again ?
Thx.

Last edited by cosatzy; 07-15-2018 at 10:25.
cosatzy is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Location: Not your business.
Old 07-15-2018 , 11:34   Re: CS GO Respawn plugin
Reply With Quote #4

Just say everything you want first, because doing what you're doing is just wasting time and it's very annoying.

PHP Code:
#include <cstrike>

bool g_bUse[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_respawn"Cmd_Respawn);
}

public 
Action Cmd_Respawn(int iClientint iArgs)
{
    
g_bUse[iClient] = !g_bUse[iClient];
    
    if (
g_bUse[iClient])
    {
        
CS_RespawnPlayer(iClient);
        
        
CreateTimer(5.0Timer_UseiClient);
    }
}

public 
Action Timer_Use(Handle hTimerint iClient)
{
    
g_bUse[iClient] = !g_bUse[iClient];

__________________
Taking requests, add me on Steam.

People make themselves understood in a way, others understand in another.
mug1wara is offline
cosatzy
New Member
Join Date: Jun 2013
Old 07-15-2018 , 15:38   Re: CS GO Respawn plugin
Reply With Quote #5

Sorry bro , thank you so mutch.
cosatzy is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Lazytown
Old 07-15-2018 , 21:47   Re: CS GO Respawn plugin
Reply With Quote #6

Quote:
Originally Posted by mug1wara View Post
Just say everything you want first, because doing what you're doing is just wasting time and it's very annoying.

PHP Code:
#include <cstrike>

bool g_bUse[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_respawn"Cmd_Respawn);
}

public 
Action Cmd_Respawn(int iClientint iArgs)
{
    
g_bUse[iClient] = !g_bUse[iClient];
    
    if (
g_bUse[iClient])
    {
        
CS_RespawnPlayer(iClient);
        
        
CreateTimer(5.0Timer_UseiClient);
    }
}

public 
Action Timer_Use(Handle hTimerint iClient)
{
    
g_bUse[iClient] = !g_bUse[iClient];

You should return handled for commands and use unix timestamps to delay the commands usage, it doesn't require a timer.
__________________
I sometimes do commissions.
Drixevel is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Location: Not your business.
Old 07-16-2018 , 08:02   Re: CS GO Respawn plugin
Reply With Quote #7

Yep, forgot to process the results, but unix timestamp, no I wouldn't?
__________________
Taking requests, add me on Steam.

People make themselves understood in a way, others understand in another.
mug1wara is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu.
Old 07-16-2018 , 08:11   Re: CS GO Respawn plugin
Reply With Quote #8

Better than using a timer.

PHP Code:
float gl_flTimeLastCommand[MAX_PLAYERS 1];

// ...
// In command callback:

float flGameTime GetGameTime();

if (
gl_flTimeLastCommand[iPlayer] + MIN_TIME_BETWEEN_COMMAND flGameTime)
{
    
gl_flTimeLastCommand[iPlayer] = flGameTime;

    
// Do stuff ...

__________________
micapat is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Location: Not your business.
Old 07-16-2018 , 08:18   Re: CS GO Respawn plugin
Reply With Quote #9

mhmmmm n1
__________________
Taking requests, add me on Steam.

People make themselves understood in a way, others understand in another.
mug1wara is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Lazytown
Old 07-16-2018 , 13:37   Re: CS GO Respawn plugin
Reply With Quote #10

Quote:
Originally Posted by mug1wara View Post
Yep, forgot to process the results, but unix timestamp, no I wouldn't?
Timers are good for doing something as soon as the timer ends where locking commands behind a time restriction is best used for timestamps or gametime as micapat coded it.
__________________
I sometimes do commissions.
Drixevel is offline
Reply


Thread Tools
Display Modes

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:20.


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