AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   By time (https://forums.alliedmods.net/showthread.php?t=76681)

LostSkill 08-28-2008 15:28

By time
 
Hello all how i can do somethink like this if 23:00 run map de_dust2 if 00:00 run de_inferno??

Silencer123 08-28-2008 16:14

Re: By time
 
The command you are looking for is get_time.
Check the time every 50 seconds or so using set_task.

LostSkill 08-28-2008 16:36

Re: By time
 
I need more info about this so it must look somethink like this
PHP Code:

public task(id) {
set_task(60.0 "mapc",id,_,_,"a")
}
public 
mapc() {
 new 
CurrentTime[9
 
get_time("%H:%M:%S",CurrentTime,8) {
  if(
time 12hour,00minute,00second){
   
changelevel de_dust2
  
}
  else if(
time 13hours:00minute:00second){
   
changelevel de_inferno
  
}
 }



LostSkill 09-07-2008 15:29

Re: By time
 
Somebody? ;/

Iwon 09-07-2008 18:36

Re: By time
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Changemap on time"
#define VERSION "1.0"
#define AUTHOR "LostSkill/Iwon"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
set_task(0.5"task"0""0"b"
}

public 
task(id) {
    
set_task(60.0 "mapc",id,_,_,"a")
}
public 
mapc() {
    new 
CurrentTime[9]
    
get_time("%H:%M:%S",CurrentTime,8)
    
    if(
time 12:00:00) {
        
server_cmd("amx_map de_dust2")
    }
    
    else if(
time 13:00:00) {
        
server_cmd("amx_map de_inferno")
    }


Fixed

EvolDay 09-07-2008 18:54

Re: By time
 
would this work if the set_task checks at like (time 12:00:10)

LostSkill 09-08-2008 02:03

Re: By time
 
Quote:

Originally Posted by Iwon (Post 682786)
PHP Code:

#include <amxmodx>
#include <amxmisc>
 
#define PLUGIN "Changemap on time"
#define VERSION "1.0"
#define AUTHOR "LostSkill/Iwon"
 
 
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
 
    
set_task(0.5"task"0""0"b"
}
 
public 
task(id) {
    
set_task(60.0 "mapc",id,_,_,"a")
}
public 
mapc() {
    new 
CurrentTime[9]
    
get_time("%H:%M:%S",CurrentTime,8)
 
    if(
time 12:00:00) {
        
server_cmd("amx_map de_dust2")
    }
 
    else if(
time 13:00:00) {
        
server_cmd("amx_map de_inferno")
    }


Fixed

I get error on 22 line
PHP Code:

if(time 12:00:00

and i dunno how to fix it :(

Alka 09-08-2008 02:32

Re: By time
 
What the fuck ?

Code:
#include <amxmodx>   #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Alka" public plugin_init() {    register_plugin(PLUGIN, VERSION, AUTHOR);    set_task(1.0, "taskCheckTime", 0, "", 0, "b", 0); }   public taskCheckTime() {  static szTime[10];  get_time("%H:%M:%S", szTime, sizeof szTime - 1);    static szTemp[3][2];  str_piece(szTime, szTemp, sizeof szTemp, sizeof szTemp[] - 1, ':');    if((str_to_num(szTemp[0]) == 12) && !str_to_num(szTemp[1]) && !str_to_num(szTemp[2]))  {   //The time is 12:0:0  }  else if((str_to_num(szTemp[0]) == 13) && !str_to_num(szTemp[1]) && !str_to_num(szTemp[2]))  {   //The time is 13:0:0  } }   stock str_piece(const input[], output[][], outputsize, piecelen, token = '|') {  new i = -1, pieces, len = -1 ;    while ( input[++i] != 0 )  {   if ( input[i] != token )   {    if ( ++len < piecelen )     output[pieces][len] = input[i] ;   }   else   {    output[pieces++][++len] = 0 ;    len = -1 ;        if ( pieces == outputsize )     return pieces ;   }  }  return pieces + 1; }

LostSkill 09-09-2008 11:04

Re: By time
 
It not works Alka :( maybe becouse i did more then 2 maps i mean and 14:00 i add'ed ofc i change "szTemp [0] == 13 to 14)" but no luck and i add'ed 14:30 so i did 14.5 and no luck whats wrong?

Alka 09-09-2008 15:58

Re: By time
 
Replace
Code:

static szTemp[3][2];
->
Code:

static szTemp[3][6];
Then will work, i just tested it.


All times are GMT -4. The time now is 03:06.

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