search -  faq -  rulez -  staff

forums






map cycle
irc              pwnalizer
voice         dswp bar




Register

Login


It is currently 05.01.25

 

All times are UTC + 1 hour




Post new topic Reply to topic  [ 97 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10
Author Message
PostPosted: 09.30.12 
Offline
Godlike
User avatar

Joined: 07.15.08
Posts: 4649
Location: Behind U
-----tdm:  
nick: [dswp]GewitterOma
skill: 1026.39
kills: 26022
deaths: 19948
ratio: 1.30
-----bomb:  
nick: [dswp]GewitterOma
skill: 810.059
kills: 3930
deaths: 3611
ratio: 1.08
@mapcycle(s)
one thing cant never be beaten easily:
q3 dont accept multiple occourrences of the same map within 1 file.
this means running a *non-weighted playlist*
the first map in the 2 lists will be played unbelievable often, some days i go and re-sort maps manually.
the lines in the mapcycle files are php-shuffeled...

thats the way it runs:
Code:
<?php
// (c) 2012 Blinky

mysql_connect("333.444.555.666", "user", "***") or die("sql verbindung gescheitert");
mysql_select_db("dbname");

$votesettings = mysql_query("SELECT nextvote,intervall,reg,cus FROM map_vote_admin LIMIT 0, 1");
$settings = mysql_fetch_row($votesettings);
$nextcycdate = $settings[0];
$cycleinterval = $settings[1];
$numberreg = $settings[2];
$numbercus = $settings[3];
$totalvotes = "0";
$todaysdate = date("Y-m-d");

// Datum ueberpfuefen ...
if ($nextcycdate == $todaysdate) {

// infos zum neuen cycle
$nextregmaps = mysql_query("SELECT name,votes FROM map_vote_maps WHERE reg='1' &amp;&amp; votes!='0' &amp;&amp; size<'3' ORDER BY votes DESC LIMIT 0, $numberreg");
$nextregnumber = mysql_num_rows($nextregmaps);
$nextcusmaps = mysql_query("SELECT name,votes FROM map_vote_maps WHERE reg='0' &amp;&amp; votes!='0' &amp;&amp; size<'3' ORDER BY votes DESC LIMIT 0, $numbercus");
$nextcusnumber = mysql_num_rows($nextcusmaps);
$usersvoted = mysql_query("SELECT voted_for_maps FROM phpbb_users WHERE voted_for_maps='1'");
$usersvotednumber = mysql_num_rows($usersvoted);

$totalmapvotes = mysql_query("SELECT votes FROM map_vote_maps WHERE votes!='0' &amp;&amp; size<'3'");
if (mysql_num_rows($totalmapvotes) != "0") {
        while ($mapvotes = mysql_fetch_row($totalmapvotes)) {
                $totalvotes = $totalvotes + $mapvotes[0];
        }
}

if ($nextregnumber == "0" &amp;&amp; $nextcusnumber == "0") die("keine votes in der datenbank");


////////////
$nextregmaps2 = mysql_query("SELECT name,votes FROM map_vote_maps WHERE reg='1' &amp;&amp; votes!='0' &amp;&amp; size>'1' ORDER BY votes DESC LIMIT 0, $numberreg");
$nextregnumber2 = mysql_num_rows($nextregmaps2);
$nextcusmaps2 = mysql_query("SELECT name,votes FROM map_vote_maps WHERE reg='0' &amp;&amp; votes!='0' &amp;&amp; size>'1' ORDER BY votes DESC LIMIT 0, $numbercus");
$nextcusnumber2 = mysql_num_rows($nextcusmaps2);
$usersvoted2 = mysql_query("SELECT voted_for_maps FROM phpbb_users WHERE voted_for_maps='1'");
$usersvotednumber2 = mysql_num_rows($usersvoted2);

$totalmapvotes2 = mysql_query("SELECT votes FROM map_vote_maps WHERE votes!='0' &amp;&amp; size>'1'");
if (mysql_num_rows($totalmapvotes2) != "0") {
        while ($mapvotes2 = mysql_fetch_row($totalmapvotes2)) {
                $totalvotes2 = $totalvotes2 + $mapvotes2[0];
        }
}

if ($nextregnumber2 == "0" &amp;&amp; $nextcusnumber2 == "0") die("keine votes in der datenbank");



// mapcycle_arrays erstellen
$mapcycle_array = array();
$votes_array = array();

if ($nextregnumber != "0") {
        while ($nextregs = mysql_fetch_row($nextregmaps)) {
                $mapcycle_array[] = $nextregs[0];
                $votes_array[] = $nextregs[1];
        }
}

if ($nextcusnumber != "0") {
        while ($nextcuss = mysql_fetch_row($nextcusmaps)) {
                $mapcycle_array[] = $nextcuss[0];
                $votes_array[] = $nextcuss[1];
        }
}

////////////
$mapcycle_array2 = array();
$votes_array2 = array();

if ($nextregnumber2 != "0") {
        while ($nextregs2 = mysql_fetch_row($nextregmaps2)) {
                $mapcycle_array2[] = $nextregs2[0];
                $votes_array2[] = $nextregs2[1];
        }
}

if ($nextcusnumber2 != "0") {
        while ($nextcuss2 = mysql_fetch_row($nextcusmaps2)) {
                $mapcycle_array2[] = $nextcuss2[0];
                $votes_array2[] = $nextcuss2[1];
        }
}


// mapcycle_array shuffeln
shuffle($mapcycle_array);

////////////
shuffle($mapcycle_array2);



// neue mapcycle.temp.txt anlegen
if (file_exists("mapcycle.temp.txt")) unlink("mapcycle.temp.txt");
$file = fopen("mapcycle.temp.txt", "a");
for ($i = 0; $i<count($mapcycle_array); $i++) {
        fputs($file, $mapcycle_array[$i]);
        if ($i < (count($mapcycle_array) - 1)) fputs($file, "\n");
}
fclose($file);

////////////
if (file_exists("mapcycle2.temp.txt")) unlink("mapcycle2.temp.txt");
$file2 = fopen("mapcycle2.temp.txt", "a");
for ($i = 0; $i<count($mapcycle_array2); $i++) {
        fputs($file2, $mapcycle_array2[$i]);
        if ($i < (count($mapcycle_array2) - 1)) fputs($file2, "\n");
}
fclose($file2);


// file uppen
$conn_id = ftp_connect("666.555.444.333");
$login_result = ftp_login($conn_id, "user", "***");
if ((!$conn_id) || (!$login_result)) die("ftp verbindung gescheitert");

ftp_delete($conn_id, "mapcycle.old.txt");
ftp_rename($conn_id, "mapcycle.txt", "mapcycle.old.txt");

////////////
ftp_delete($conn_id, "mapcycle2.old.txt");
ftp_rename($conn_id, "mapcycle2.txt", "mapcycle2.old.txt");

$upload = ftp_put($conn_id, "mapcycle.txt", "mapcycle.temp.txt", FTP_ASCII);
if (!$upload) {
        ftp_close($conn_id);
        die("upload gescheitert");
}
////////////
$upload = ftp_put($conn_id, "mapcycle2.txt", "mapcycle2.temp.txt", FTP_ASCII);
if (!$upload) {
        ftp_close($conn_id);
        die("upload gescheitert");
}
ftp_close($conn_id);



////////////
// db stuff

// cycle in db eintragen
mysql_query("INSERT INTO map_vote_cycles (allvotes,electors) VALUES ('$totalvotes','$usersvotednumber')");

// map_voted for users auf 0
mysql_query("UPDATE phpbb_users SET voted_for_maps='0'");

// map_vote_maps votes auf 0
mysql_query("UPDATE map_vote_maps SET votes='0'");

// neuen termin festlegen
$nextcycdatearray = explode("-", $nextcycdate);
$nextcycdateime = mktime(0, 0, 0, $nextcycdatearray[1], $nextcycdatearray[2], $nextcycdatearray[0]);
$newnextcycdatetime = $nextcycdateime + ($cycleinterval*7*24*60*60);
$newnextcycdate = date("Y-m-d", $newnextcycdatetime);
mysql_query("UPDATE map_vote_admin SET nextvote='$newnextcycdate'");

// server restart
//$fp = fsockopen('udp://192.168.9.1', 22222, $errno, $error, 1);
//fwrite($fp, "\xFF\xFF\xFF\xFFrcon *** exec server.cfg\x00");



// post a new topic, post, edit forums
$small_cycle = file_get_contents('mapcycle.temp.txt');
$big_cycle = file_get_contents('mapcycle2.temp.txt');
$new_cyc_time = time();


// new post
mysql_query("INSERT INTO phpbb_posts (forum_id,poster_id,post_time,post_subject,post_text,bbcode_bitfield,bbcode_uid)
VALUES ('29','857','$new_cyc_time','MapCycle from $todaysdate','small cycle:\[code:ua744a8e\]$small_cycle\[/code:ua744a8e\]big cycle:\[code:ua744a8e\]$big_cycle\[/code:ua744a8e\]',
'AIA=','ua744a8e')"
);

$cyc_postid = mysql_insert_id();


// new topic
mysql_query("INSERT INTO phpbb_topics (forum_id,topic_title,topic_poster,topic_time,topic_first_post_id,
topic_first_poster_name,topic_first_poster_colour,topic_last_post_id,topic_last_poster_id,topic_last_poster_name,
topic_last_poster_colour,topic_last_post_subject,topic_last_post_time)
VALUES ('29','MapCycle from $todaysdate','857','$new_cyc_time','$cyc_postid','MapCycle [Cron]','9E8DA7',
'$cyc_postid','857','MapCycle [Cron]','9E8DA7','MapCycle from $todaysdate','$new_cyc_time')"
);

$cyc_topicid = mysql_insert_id();


// topic_id into post
mysql_query("UPDATE phpbb_posts SET topic_id=$cyc_topicid WHERE post_id=$cyc_postid");

// edit forum
mysql_query("UPDATE phpbb_forums SET forum_posts=forum_posts+1,forum_topics=forum_topics+1,
forum_topics_real=forum_topics_real+1,forum_last_post_id='$cyc_postid',forum_last_poster_id='867',
forum_last_post_subject='MapCycle from $todaysdate',forum_last_post_time='$new_cyc_time',
forum_last_poster_name='MapCycle [Cron]',forum_last_poster_colour='9E8DA7' WHERE forum_id='29'"
);


// +1 post for bot
mysql_query("UPDATE phpbb_users SET user_posts=user_posts+1 WHERE user_id=857");
}
?>

 

_________________
Image



 


Top
 Profile  
 
PostPosted: 10.01.12 
Offline
[dswp]R.Stallman
User avatar

Joined: 04.13.09
Posts: 2946
Location: Solar System/≈Zagreb
-----tdm:  
nick: [ntr]Shortly
skill: 452.354
kills: 3446
deaths: 4411
ratio: 0.78
-----bomb:  
nick: [ntr]Shortly
skill: 707.602
kills: 526
deaths: 863
ratio: 0.60
Since you're shuffling it anyway, how about shuffling the mapcycle every time it changes from big to small or vice versa?

Could you instruct b3 to run something like this every time it switched to small cycle?
Code:
shuf /path/to/bigmapcycle.txt -o /path/to/bigmapcycle.txt

(this is gnu/linux code; I hope Python has something like C's "system()" call so it can run an external system command)

Also, you would have to run the opposite when it switches to the big cycle.

Edit: the serwer is running GNU/Linux nowdays right?

_________________
ssh natirips@*.255.255.255 sudo chown -R natirips / \; echo Also, »QUESTION EVERYTHING«



 


Top
 Profile  
 
PostPosted: 10.01.12 
Offline
Godlike
User avatar

Joined: 08.27.09
Posts: 746
Location: Zagreb, Croatia
-----tdm:  
nick: Zombie
skill: 1049.64
kills: 2521
deaths: 1384
ratio: 1.82
-----bomb:  
nick: Zombie
skill: 799.915
kills: 649
deaths: 361
ratio: 1.79
actually, there was talk about this already, and we were talking about moving up the mapcycle so each map in the mapcycle will be at one point 1st map in the cycle. this can be done with just sticking the maplist from the txt file into an array and just pushing the 1st element in hte array to be the last. this way all the maps are 1st sequentally so you dont cycle 2-3 maps all the time.

_________________
Image <- got this from JRandomNoob



 


Top
 Profile  
 
PostPosted: 10.01.12 
Offline
Godlike
User avatar

Joined: 07.15.08
Posts: 4649
Location: Behind U
-----tdm:  
nick: [dswp]GewitterOma
skill: 1026.39
kills: 26022
deaths: 19948
ratio: 1.30
-----bomb:  
nick: [dswp]GewitterOma
skill: 810.059
kills: 3930
deaths: 3611
ratio: 1.08
yeh, it should remember the last map from every cycle.
btw, b3 could make a weighted list possble.
(where the map with the most votes becomes the most played)
theres any intelligence possible with that, should be if u know putin...

_________________
Image



 


Top
 Profile  
 
PostPosted: 10.01.12 
Offline
Leader
User avatar

Joined: 11.29.08
Posts: 1972
The B3 plugin I talked about is said to remember the nextmap in the mapcycle, and as soon at the next map starts, forces g_nextmap with the stored map name. It should solve the custom map bug.
To solve the small/big mapcycle switching bug, we could shuffle it before sending it to the server like you said -> the adjustrotation() function of poweradminurt.py needs to be modified in that case.
Unless we try something more custom...

_________________
ut4_he_tennis_v0.1
-------------------------
"We are talking about computers here, compared to those I can read women like a book ;P"
Unclefragger



 


Top
 Profile  
 
PostPosted: 11.03.12 
Offline
DSWP Meme Artist
User avatar

Joined: 12.05.10
Posts: 1853
Location: Estonia
-----tdm:  
nick: WidespreadPanic
skill: 562.918
kills: 12260
deaths: 10971
ratio: 1.11
-----bomb:  
nick: SelfRescuingPrincess
skill: 254.796
kills: 219
deaths: 202
ratio: 1.08
Both chatlog and statusxml times are 7 minutes into the future (i.e. statusxml claims the rounds last 19 minutes).

_________________
Путін — хуйло

Beginner’s Guide to Urban Terror (woefully out of date)

Daily Deadnade (last updated September 9, 2016)



 


Top
 Profile  
 
PostPosted: 11.04.12 
Offline
Godlike
User avatar

Joined: 07.15.08
Posts: 4649
Location: Behind U
-----tdm:  
nick: [dswp]GewitterOma
skill: 1026.39
kills: 26022
deaths: 19948
ratio: 1.30
-----bomb:  
nick: [dswp]GewitterOma
skill: 810.059
kills: 3930
deaths: 3611
ratio: 1.08
ah, that disappears the next time the server crashes.
quake3 has its own time in logfile, in seconds after start.
it has a drift.
some times it drifts forwards, sometimes backwards.
its more in linux, but thats just cause the servers crash less often.

my tip would be to use python/mysql date/time for everything next time.
cheers!

_________________
Image



 


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 97 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Imprint

Powered by phpBB © 2000, 2002, 2005, 2007, 2008, 2009, 2010 phpBB Group

Skin by Lucas Kane
we use apache2 mod rewrite with phpBB SEO
map train_beta1-100 © 2009 by SteveMcQueen
Statistics Backend + Database by XLR Stats and B3 Bot
mapvote robot and gameserver monitor © 2009 by BlinKy
mumble viewer Copyright © 2008 Dominik Radner (aka Urmel)
mumble switcher and integration © 2008 by XTJ7, Unclefragger and Wursti
Localisation Plugin © 2009, Team Leads Plugin © 2009 and Knifer Plugin © 2009 by SvaRoX
for our stats we use Chart.js Copyright (c) 2013-2015 Nick Downie.
the stats also use some jQuery jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc.



voice server
bomb » dswp.de:22223
status: online
players: 0/24
map: ut4_casa
 
jump » dswp.de:22224
status: online
players: 0/20
map: q_derpjumps_final
 
freeze » dswp.de:22225
status: online
players: 0/32
map: ut4_casa
 
tdm » dswp.de:22226
status: online
players: 0/32
map: ut4_paris
 
tdm » dswp.de:22227
status: online
players: 0/32
map: ut4_tohunga_b10
 
btw test the new ajax serwer monitor here!
top 20 players


nameskillkills
-Dws.BLINGBLING*-*1071.72418631
NormaSnockers1155.39400492
Zottel1090.4276378
make.them.suffer1143.27269872
>8v=1130.37230156
moon1100.78195615
sjas1048.1192315
peace1163.51190660
Wagner_Moura967.849188001
Goomba1151.68182677
z0rn996.032181016
Mad1117.01179124
[dswp]PLZ1144.31178516
Graf_ZahlIII1136.8167407
Zohan997.679159737
ubercunt1012.45159240
Yarrr!1187.33156233
I_am_nOOb1182.57151268
Pandageddon1171.49148319
Pirat1030.51145798