AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   CS GO Respawn plugin (https://forums.alliedmods.net/showthread.php?t=309153)

cosatzy 07-15-2018 09:02

CS GO Respawn plugin
 
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.

mug1wara 07-15-2018 09:07

Re: CS GO Respawn plugin
 
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);



cosatzy 07-15-2018 09:24

Re: CS GO Respawn plugin
 
Can someone add 5 seconds delay until you can use the command again ?
Thx.

mug1wara 07-15-2018 10:34

Re: CS GO Respawn plugin
 
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];



cosatzy 07-15-2018 14:38

Re: CS GO Respawn plugin
 
Sorry bro , thank you so mutch.

Drixevel 07-15-2018 20:47

Re: CS GO Respawn plugin
 
Quote:

Originally Posted by mug1wara (Post 2603820)
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.

mug1wara 07-16-2018 07:02

Re: CS GO Respawn plugin
 
Yep, forgot to process the results, but unix timestamp, no I wouldn't?

micapat 07-16-2018 07:11

Re: CS GO Respawn plugin
 
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 ...



mug1wara 07-16-2018 07:18

Re: CS GO Respawn plugin
 
mhmmmm n1

Drixevel 07-16-2018 12:37

Re: CS GO Respawn plugin
 
Quote:

Originally Posted by mug1wara (Post 2603972)
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.


All times are GMT -4. The time now is 01:23.

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