just remove LIMIT if you want all players
Printable View
just remove LIMIT if you want all players
need to find the nearest kills and swap places with him, notifying this(print new pos by player)
2column:
pos and kills
SELECT MIN(kills)+1 FROM TABLEHERE WHERE player_id != YOUROWNPLAYER_ID AND kills >= YOUROWNKILLS
SELECT player_id FROM TABLEHERE WHERE player_id != YOUROWNPLAYER_ID AND kills >= YOUROWNOLDKILLS AND kills < YOUROWNNEWKILLS
these?
First one to check how much to next pos++, second one to find all players that you passed by doing a kill
thanks, i will test this.
I will try, At the moment my sketch:
PHP Code:
sql = "SELECT COUNT(killszom) FROM Accounts WHERE login != '" + self.stats["loginname"] + "' AND killszom >= '" + self.lastkillplayers + "' AND killszom < '" + self.killplayers + "'";
mysql_query(level.mysql, sql);
result = mysql_store_result(level.mysql);
row = mysql_fetch_row(result);
countstrings = int(row[0]);//number of players in the interval killings
if(countstrings>=1)//continue to execute queries if there are ahead
{
sql = "SELECT `login` FROM Accounts WHERE `login` != '" + self.stats["loginname"] + "' AND killszom >= '" + self.lastkillplayers + "' AND killszom < '" + self.killplayers + "'";//this query displays logins players below us in a position, then you can give one to each array, thereby relegating them
mysql_query(level.mysql, sql);
result = mysql_store_result(level.mysql);
row = mysql_fetch_row(result);
list=[];
for(i=0;i<countstrings;i++)
{
list[i]=row[0];
sql = "UPDATE `Accounts` SET toppos=toppos+1 WHERE login='" + list[i] + "'";
mysql_query(level.mysql, sql);
}
sql = "SELECT MAX(toppos) FROM Accounts WHERE `login` != '" + self.stats["loginname"] + "' AND killszom = '" + self.lastkillplayers + "'";
mysql_query(level.mysql, sql);
result = mysql_store_result(level.mysql);
row = mysql_fetch_row(result);
max=row[0];
sql = "SELECT MIN(toppos) FROM Accounts WHERE `login` != '" + self.stats["loginname"] + "' AND killszom = '" + self.lastkillplayers + "'";
mysql_query(level.mysql, sql);
result = mysql_store_result(level.mysql);
row = mysql_fetch_row(result);
min=row[0];
sql = "UPDATE `Accounts` SET toppos=toppos-'"+(max-min+1)+"' WHERE login='" + self.stats["loginname"] + "'";
mysql_query(level.mysql, sql);
}
Please dont store ranknumbers in your mysql. Select them when retrieving the data.
Else your mysql database might become corrupt + it requires a LOT of IO to update all 1k+ players below you whenever you pass someone.
can be more? mysql_free_result(result) after store?
I still have no idea what you are trying to accomplish EXACTLY.
Tell me what you want to do. More details. Better explanations.
Metastas!S:
Attachment 1102
In my mod:
Menu is working, but when switching players between positions - position(toppos in database) is broken
Attachment 1104