Criando Mice: Comando /meusmapas


Esse comando não foi eu que criei, mas é bem útil! Eu uso ele bastante então, tá ai.

 Código:

             elif event == "meusmapas":
                        if self.privilegeLevel>=1:
                            maplist = []
                            mapslist = ""
                            username = self.username
                            dbcur.execute('select * from mapeditor where name = ?', [username])
                            rrfRows = dbcur.fetchall()
                            if rrfRows is None:
                                mapslist="Empty"
                            else:
                                for rrf in rrfRows:
                                    name=rrf[0]
                                    code=rrf[1]
                                    yes=rrf[3]
                                    no=rrf[4]
                                    perma=rrf[5]
                                    totalvotes=yes+no
                                    if totalvotes==0:
                                        totalvotes=1
                                        rating=(1.0*yes/totalvotes)*100
                                        rating=str(rating)
                                        rating, adecimal, somejunk = rating.partition(".")
                                        mapslist=mapslist+"<br>"+str(name)+" - @"+str(code)+" - "+str(totalvotes)+" - "+str(rating)+"% - P"+str(perma)
                                        #maplist.append(rrf[0])
                                #maplist = str(json.dumps(maplist)).replace("[","").replace("]","").replace("\"","").replace(" ", "").replace(",",", ")
                                #if maplist=="":
                                #    maplist="Empty"
                            self.sendData("\x06" + "\x14",[mapslist])

Espero que gostem.



Postar um comentário

Tecnologia do Blogger.