ich möchte (immernoch) n befehl mit dem man die nextmap per admin befehl eingeben kann ich habs nu bestimmt schon seit über ner woche versucht aber das funzt einfach nich ich hab hier ma den aktuellen code. falls einer den fehler findet sach bescheid
Code:
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_CONSOLE 131072
new STRING_VERSION[MAX_DATA_LENGTH] = "1.2";
new checktime = 0;
new time = 0;
new GameCommencing = 0;
new origtimelimit = 0;
new nextmap2[MAX_NAME_LENGTH];
public execute_all(a[])
{
new userid = 0;
new wonid = 0;
new teamid = 0;
new username[200];
new i = 0;
new x = 0;
x = maxplayercount();
for (i = 1; i <= x; i = i + 1)
{
strinit(username);
if (playerinfo(i, username, 200, userid, wonid, teamid) == 1)
{
execclient(username, a);
}
}
}
public admin_nmap(HLCommand,HLData,HLUserName,UserIndex) {
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new User[MAX_NAME_LENGTH];
convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
if (valid_map(Data)==1) {
say_command(User,Command,Data);
nextmap2 == (Data,MAX_DATA_LENGTH);
} else {
selfmessage("Bad map name");
selfmessage(Data);
}
return PLUGIN_HANDLED;
}
public welt(HLCommand,HLData,HLUserName,UserIndex)
{
new Data [MAX_DATA_LENGTH];
new x [MAX_DATA_LENGTH];
convert_string( HLData, Data, MAX_DATA_LENGTH );
strsplit(Data,"# ",x,MAX_DATA_LENGTH);
if(strcmp(Data,"Game_Commencing")==0 && GameCommencing == 0)
{
GameCommencing = 1;
origtimelimit =getvar("mp_timelimit")*60+2;
checktime = systemtime();
set_timer("timecheck",1,99999);
}
else if(strcmp(x,"Restart_Round_")==0)
{
origtimelimit =getvar("mp_timelimit")*60+2;
checktime = systemtime();
}
return PLUGIN_HANDLED;
}
public timecheck(Timer,Repeat,HLUser,HLParam)
{
new checkthetime;
new Text[MAX_TEXT_LENGTH];
new Text2[MAX_TEXT_LENGTH];
nextmap(nextmap2,MAX_NAME_LENGTH);
if (getvar("mp_timelimit") == 0)
{
return PLUGIN_HANDLED;
}
if (getvar("mp_timelimit")*60+2 != origtimelimit)
{
checktime = systemtime()-(systemtime()- checktime);
origtimelimit= getvar("mp_timelimit")*60+2;
}
checkthetime = (origtimelimit-(systemtime()-checktime));
time = checkthetime;
if (time - 3600 == 0)
{
execute_all("speak ^"fvox/sixty minutes remaining^"");
centersay("60 Minuten bis zum Mapchange !",6,255,255,255);
}
if (time - 1800 == 0)
{
execute_all("speak ^"fvox/thirty minutes remaining^"");
centersay("30 Minuten bis zum Mapchange !",6,255,255,255);
}
if (time - 1500 == 0)
{
execute_all("speak ^"fvox/twenty five minutes remaining^"");
centersay("25 Minuten bis zum Mapchange !",6,255,255,255);
}
if (time - 1200 == 0)
{
execute_all("speak ^"fvox/twenty minutes remaining^"");
centersay("20 Minuten bis zum Mapchange !",6,255,255,255);
}
if (time - 900 == 0)
{
execute_all("speak ^"fvox/fifteen minutes remaining^"");
centersay("15 Minuten bis zum Mapchange !",6,255,255,255);
}
if (time - 600 == 0)
{
execute_all("speak ^"fvox/ten minutes remaining^"");
centersay("10 Minuten bis zum Mapchange !",6,255,255,255);
}
if (time - 300 == 0)
{
execute_all("speak ^"fvox/five minutes remaining^"");
centersay("5 Minuten bis zum Mapchange !",6,255,255,255);
}
if (time - 120 == 0)
{
execute_all("speak ^"fvox/two minutes remaining^"");
centersay("2 Minuten bis zum Mapchange !",6,255,255,255);
}
if (time - 60 == 0)
{
execute_all("speak ^"fvox/sixty seconds remaining^"");
centersay("60 Sekunden bis zum Mapchange !",6,255,0,0);
}
if (time - 30 == 0)
{
execute_all("speak ^"fvox/thirty seconds remaining^"");
centersay("30 Sekunden bis zum Mapchange !",6,255,0,0);
}
if (time - 10 == 0)
{
execute_all("speak ^"fvox/ten^"");
centersay("10 IIIIIIIIII",2,255,0,0);
}
if (time - 9 == 0)
{
execute_all("speak ^"fvox/nine^"");
centersay("09 IIIIIIIII",2,255,0,0);
}
if (time - 8 == 0)
{
execute_all("speak ^"fvox/eight^"");
centersay("08 IIIIIIII",2,255,0,0);
}
if (time - 7 == 0)
{
execute_all("speak ^"fvox/seven^"");
centersay("07 IIIIIII",2,255,0,0);
}
if (time - 6 == 0)
{
execute_all("speak ^"fvox/six^"");
centersay("06 IIIIII",2,255,0,0);
}
if (time - 5 == 0)
{
execute_all("speak ^"fvox/five^"");
centersay("05 IIIII",2,255,0,0);
}
if (time - 4 == 0)
{
execute_all("speak ^"fvox/four^"");
centersay("04 IIII",2,255,0,0);
}
if (time - 3 == 0)
{
execute_all("speak ^"fvox/three^"");
snprintf(Text, MAX_TEXT_LENGTH, "03 III^nDie naechste Map ist: %s",nextmap2);
centersay(Text,2,255,0,0);
}
if (time - 2 == 0)
{
execute_all("speak ^"fvox/two^"");
snprintf(Text, MAX_TEXT_LENGTH, "02 II^nDie naechste Map ist: %s",nextmap2);
centersay(Text,2,255,0,0);
}
if (time - 1 == 0)
{
execute_all("speak ^"fvox/one^"");
snprintf(Text, MAX_TEXT_LENGTH, "01 I^nDie naechste Map ist: %s",nextmap2);
centersay(Text,2,255,0,0);
}
if (time == 0)
{
execute_all("speak ^"misc/gameover^"");
snprintf(Text, MAX_TEXT_LENGTH, "GAME OVER !^n Die naechste Map ist: %s",nextmap2);
centersay(Text,2,255,0,0);
snprintf(Text2, MAX_TEXT_LENGTH, "Die naechste Map ist: %s",nextmap2);
say(Text2);
changelevel(nextmap2,5)
}
return PLUGIN_HANDLED;
}
public plugin_init()
{
plugin_registerinfo("Zeigt die verbleibende Zeit auf einer Map an","",STRING_VERSION);
plugin_registercmd("welt", "welt", ACCESS_CONSOLE);
plugin_registercmd("admin_nmap","admin_nmap",ACCESS_ALL,"admin_nmap: Edit the next map in cycle.");
exec( "logd_reg 62 admin_command welt" );
return PLUGIN_CONTINUE;
}