View Single Post
TrullSin
Senior Member
Join Date: Jun 2018
Old 12-14-2018 , 11:19   Re: Timeleft x and execute
Reply With Quote #6

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
TrullSin is offline