View Single Post
Author Message
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 11-08-2018 , 14:34   Do something beetween 20:30 PM and 07:00 AM
Reply With Quote #1

This is supposed to give vip to players for free beetween 200 PM and 7:00 AM.
But I don't know how to check if it's (for example) 20:46 PM or 01:04 AM

Can someone help me?
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <vip_core>
char g_Group[12] = "silver"

#pragma newdecls required

bool bIsEvent;


public 
void OnPluginStart()
{
    
CreateTimer(1.0Timer_Check_TIMER_REPEAT);
    
    
bIsEvent false;
}

public 
Action Timer_Check(Handle pTimer)
{
    
int iCurTime GetTime();
    
char sTime[128];
    
FormatTime(sTimesizeof(sTime), "%I:%M %p"iCurTime);
    
    if(
StrContains(sTime"22:30"false))
    {
        
PrintCenterTextAll("FREE VIP EVENT ON. RECONNECT TO GET FREE VIP");
        
        
bIsEvent true;
        
        
CreateTimer(46800.0Time_RemoveBool);
        
        for(
int iClient 1iClient <= MaxClientsiClient++)
        {
            
VIP_GiveClientVIP(-1iClient14400g_Grouptrue);
        }
    }
}

public 
Action Time_RemoveBool(Handle _Timer)
{
    
bIsEvent false;
}

public 
void OnClientPutInServer(int iClient)
{
    if(
bIsEvent)
    {
        if(!
VIP_IsClientVIP(iClient))
        {
            
VIP_GiveClientVIP(-1iClient14400g_Group);
            
PrintToChat(iClient"[TEST] VIP EVENT ON! YOU HAVE FREE VIP SILVER!");
        }
    }

__________________
kratoss1812 is offline