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

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 , 09: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 09:10.
cosatzy is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-15-2018 , 09: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);

mug1wara is offline
cosatzy
New Member
Join Date: Jun 2013
Old 07-15-2018 , 09: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 09:25.
cosatzy is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-15-2018 , 10: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];

mug1wara is offline
cosatzy
New Member
Join Date: Jun 2013
Old 07-15-2018 , 14: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: Somewhere headbangin'
Old 07-15-2018 , 20: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.
Drixevel is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-16-2018 , 07:02   Re: CS GO Respawn plugin
Reply With Quote #7

Yep, forgot to process the results, but unix timestamp, no I wouldn't?
mug1wara is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 07-16-2018 , 07: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
Old 07-16-2018 , 07:18   Re: CS GO Respawn plugin
Reply With Quote #9

mhmmmm n1
mug1wara is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 07-16-2018 , 12: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.
Drixevel 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 23:16.


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