jo, hatte das hier:
aber die centersay-anzeige funzt nicht...
Code:
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_CONSOLE 131072
new STRING_VERSION[MAX_DATA_LENGTH] = "1.6";
new GameCommencing=0;
new checktime;
new origtimelimit;
new timer;
public timerem2_welt(HLCommand,HLData,HLUserName,UserIndex){
new Data [MAX_DATA_LENGTH];
new x [MAX_DATA_LENGTH];
new dummy[MAX_DATA_LENGTH];
convert_string( HLData, Data, MAX_DATA_LENGTH );
strsplit(Data,"_",x,MAX_DATA_LENGTH,dummy,MAX_DATA_LENGTH);
if(strcmp(x,"Game")==0 && GameCommencing == 0){
GameCommencing = 1;
checktime =systemtime();
origtimelimit = getvar("mp_timelimit")*60+2;
kill_timer(timer);
timer=set_timer("warn",1, 0);
}
else if(strcmp(x,"Restart")==0){
origtimelimit =getvar("mp_timelimit")*60+2;
checktime = systemtime();
kill_timer(timer);
timer=set_timer("warn",1,0);
}
else if(strcmp(x,"Round")==0){
if (getvar("mp_timelimit")*60+2 != origtimelimit){
checktime = systemtime()-(systemtime()- checktime);
origtimelimit= getvar("mp_timelimit")*60+2;
kill_timer(timer);
timer=set_timer("warn",1,0);
}
}
return PLUGIN_CONTINUE;
}
public warn(Timer,Repeat,HLUser,HLParam)
{
new a;
new time;
if (getvar("mp_timelimit")*60+2 != origtimelimit){
checktime = systemtime()-(systemtime()- checktime);
origtimelimit= getvar("mp_timelimit")*60+2;
}
time = (origtimelimit-(systemtime()-checktime));
switch(time){
case 1800:{
execclient_all("speak ^"thirty minutes remaining^"");
typesay("30 Minuten noch...",6,0,255,0);
a = 300;
}
case 1500:{
execclient_all("speak ^"twenty five minutes remaining^"");
typesay("25 Minuten noch...",6,0,255,0);
a = 300;
}
case 1200:{
execclient_all("speak ^"twenty minutes remaining^"");
centersay("20 Minuten noch...",6,0,255,0);
a = 300;
}
case 900:{
execclient_all("speak ^"fifteen minutes remaining^"");
centersay("15 Minuten noch...",6,0,255,0);
a = 300;
}
case 600:{
execclient_all("speak ^"ten minutes remaining^"");
centersay("10 Minuten noch...",6,0,255,0);
a = 300;
}
case 300:{
execclient_all("speak ^"5minutesw^"");
centersay("5 Minuten noch...",6,0,255,0);
a = 180;
}
case 120:{
execclient_all("speak ^"2minutesw^"");
centersay("2 Minuten noch...",6,0,255,0);
a = 60;
}
case 60:{
execclient_all("speak ^"1minutesw^"");
centersay("60 Sekunden noch...",6,255,0,0);
a = 30;
}
case 30:{
execclient_all("speak ^"30secondsw^"");
centersay("30 Sekunden noch...",6,255,0,0);
a = 10;
}
case 20:{
execclient_all("speak ^"twenty seconds remaining^"");
centersay("20 Sekunden noch...",6,255,0,0);
a = 10;
}
case 10:{
execclient_all("speak ^"ten seconds remaining^"");
centersay("10 Sekunden noch...",5,255,0,0);
a = 5;
}
case 5:{
execclient_all("speak ^"five^"");
centersay("Five",1,255,0,0);
a = 1;
}
case 4:{
execclient_all("speak ^"four^"");
centersay("Four",1,255,0,0);
a = 1;
}
case 3:{
execclient_all("speak ^"three^"");
centersay("Three",1,255,0,0);
a = 1;
}
case 2:{
execclient_all("speak ^"two^"");
centersay("Two",1,255,0,0);
a = 1;
}
case 1:{
execclient_all("speak ^"one^"");
centersay("One",1,255,0,0);
a = 1;
}
case 0:{
new ExecCommand[MAX_DATA_LENGTH];
new Timelimit = 0;
Timelimit = getvar("mp_timelimit") - 1;
snprintf(ExecCommand, MAX_DATA_LENGTH, "mp_timelimit %i", Timelimit);
exec(ExecCommand);
execclient_all("speak ^"this round is over^"");
}
default:{
if(time>1800){
a = time-1800;
}else if(time<1800 && time>1500){
a = time - 1500;
}else if(time<1500 && time>1200){
a = time - 1200;
}else if(time<1200 && time>900){
a = time - 900;
}else if(time<900 && time>600){
a = time - 600;
}else if(time<600 && time>300){
a = time - 300;
}else if(time<300 && time>120){
a = time - 120;
}else if(time<120 && time>60){
a = time - 60;
}else if(time<60 && time>30){
a = time - 30;
}else{
a=1;
}
}
}
timer=set_timer("warn",a, 0);
return PLUGIN_CONTINUE;
}
public plugin_init(){
plugin_registerinfo("Time Remaining Counter","Just a countdown until the Map over.",STRING_VERSION);
plugin_registercmd("timerem2_welt", "timerem2_welt", ACCESS_CONSOLE);
exec("logd_reg 62 admin_command timerem2_welt");
checktime =systemtime();
origtimelimit = getvar("mp_timelimit")*60+2;
timer=set_timer("warn",1, 0);
return PLUGIN_CONTINUE;
}