AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Timeleft x and execute (https://forums.alliedmods.net/showthread.php?t=312618)

TrullSin 12-09-2018 16:10

Timeleft x and execute
 
What is the best away to when the timeleft is like 2 minutes, execute a ServerCommand?
For CS:GO

Mr.Freeman 12-09-2018 16:56

Re: Timeleft x and execute
 
Two minutes left on roundtime or maptime?

TrullSin 12-09-2018 17:09

Re: Timeleft x and execute
 
Roundtime

iskenderkebab33 12-09-2018 17:21

Re: Timeleft x and execute
 
maybe this can help you https://forums.alliedmods.net/showthread.php?p=2369937

Mr.Freeman 12-09-2018 18:32

Re: Timeleft x and execute
 
You can fetch the round time, OnRoundStart, start a timer equal too the (roundtime - freezetime - 60 seconds)?

TrullSin 12-14-2018 11:19

Re: Timeleft x and execute
 
PHP Code:

#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

float g_flNextTimeleft 0.0;
int g_flTimeleft 120;

public 
void OnPluginStart() {
  
ConVar hTimeleft CreateConVar("timeleft""120""When timeleft hit this time it will execute the command");
  if (
hTimeleft == INVALID_HANDLE) {
    
SetFailState("CreateConVar failed");
  }
  
AutoExecConfig(true);

  
g_flTimeleft GetConVarInt(hTimeleft);
  
delete hTimeleft;

  
HookEvent("round_start"OnRoundStartEventHookMode_Post);
}

public 
void OnRoundStart(Event event, const char[] namebool dontBroadcast) {
  
g_flNextTimeleft GetGameTime() + float(GameRules_GetProp("m_iRoundTime") - g_flTimeleft);
}

public 
Action Timeleft(int client) {
    if (
GetGameTime() < g_flNextTimeleft) {
      
ServerCommand("exec normal.cfg");
    } else {
    }


Cant figure it out why not executing.. Prob doing something wrong

Mr.Freeman 12-15-2018 14:12

Re: Timeleft x and execute
 
Quote:

Originally Posted by TrullSin (Post 2629006)
PHP Code:

#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

float g_flNextTimeleft 0.0;
int g_flTimeleft 120;

public 
void OnPluginStart() {
  
ConVar hTimeleft CreateConVar("timeleft""120""When timeleft hit this time it will execute the command");
  if (
hTimeleft == INVALID_HANDLE) {
    
SetFailState("CreateConVar failed");
  }
  
AutoExecConfig(true);

  
g_flTimeleft GetConVarInt(hTimeleft);
  
delete hTimeleft;

  
HookEvent("round_start"OnRoundStartEventHookMode_Post);
}

public 
void OnRoundStart(Event event, const char[] namebool dontBroadcast) {
  
g_flNextTimeleft GetGameTime() + float(GameRules_GetProp("m_iRoundTime") - g_flTimeleft);
}

public 
Action Timeleft(int client) {
    if (
GetGameTime() < g_flNextTimeleft) {
      
ServerCommand("exec normal.cfg");
    } else {
    }


Cant figure it out why not executing.. Prob doing something wrong


after a quick glance there is no timer creation not KillTimer function. all you have done on g_flNextTimeleft is assign it a value.


All times are GMT -4. The time now is 16:24.

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