User Tag List

Results 1 to 6 of 6

Thread: Top 5 PVP kills

  1. #1
    EOOQ <span style='color: #32CD32'><span class='glow_32CD32'>renatokeys</span></span>'s Avatar
    Join Date
    Jan 2014
    Location
    Brazil
    Posts
    191
    XP
    2,644,776
    Level
    311
    Thanks
    17
    Thanked 26 Times in 18 Posts

    Top 5 PVP kills

    Hello again...

    New script to share! Top 5 kills per Class


    THX Foereaper for optmize my code.










    Thanks to "philippovitch" for Top 5 Class c++
    Attached Images Attached Images
    Last edited by renatokeys; 03-20-2014 at 01:10 AM.
    Achievements:
    Shopper Member 1 year registered Referrer Level XL Level C
    Only two things are infinite: the universe and WINRAR test license

  2. The Following 3 Users Say Thank You to renatokeys For This Useful Post:


  3. #2
    Founder <span style='color: #FF4500'>Foereaper</span>'s Avatar
    Join Date
    Apr 2013
    Posts
    926
    XP
    38,862
    Level
    60
    Thanks
    125
    Thanked 329 Times in 156 Posts
    The only thing I could suggest is to use a prepared statement for the queries and variables for classes. That way you would cut down the amount of code to only one function handling everything :)

    I can make you an example of this later if you want me to :)

  4. #3
    Original Poster
    EOOQ <span style='color: #32CD32'><span class='glow_32CD32'>renatokeys</span></span>'s Avatar
    Join Date
    Jan 2014
    Location
    Brazil
    Posts
    191
    XP
    2,644,776
    Level
    311
    Thanks
    17
    Thanked 26 Times in 18 Posts
    Can you do this ? I think i know what u mean, but i don't know how to use this in lua , i started a few hours ago.
    Achievements:
    Shopper Member 1 year registered Referrer Level XL Level C
    Only two things are infinite: the universe and WINRAR test license

  5. #4
    Founder <span style='color: #FF4500'>Tommy</span>'s Avatar
    Join Date
    Apr 2013
    Posts
    7,391
    XP
    3,449,104
    Level
    378
    Thanks
    889
    Thanked 1,856 Times in 1,119 Posts
    Quote Originally Posted by Foereaper View Post
    The only thing I could suggest is to use a prepared statement for the queries and variables for classes. That way you would cut down the amount of code to only one function handling everything :)

    I can make you an example of this later if you want me to :)
    Thanks for sharing this!

    I do agree with Foereaper though. You could also update the table every 10-15 minutes (reload everything) so it will stay updated w/o a restart/reload. That will go along with the prepared statement.

  6. #5
    Founder <span style='color: #FF4500'>Foereaper</span>'s Avatar
    Join Date
    Apr 2013
    Posts
    926
    XP
    38,862
    Level
    60
    Thanks
    125
    Thanked 329 Times in 156 Posts
    Untested but should work :)

    Code:
    ----------------------------------------------
    -- TOP 5 per class                          //
    -- Script by Renatokeys(emudevs)            //
    -- http://emudevs.com                       //
    ----------------------------------------------
     
    local NPC_ID = 1
    
    local ClassLocale = { 
    	[1] = {"Warrior", "660000"},
    	[2] = {"Paladin", "FF0099"},
    	[3] = {"Hunter", "CC6611"},
    	[4] = {"Rogue", "CCFF00"},
    	[5] = {"Priest", "FFFFFF"},
    	[6] = {"Death Knight", "4D4D51"},
    	[7] = {"Shaman", "0000CC"},
    	[8] = {"Mage", "33FFFF"},
    	[9] = {"Warlock", "660099"},
    	[11] = {"Druid", "FF6600"}
    };
     
    function clica(event, plr, unit)
    	plr:GossipMenuAddItem(0, "Choose the class : ", 0, 0)
    	
    	for k, v in pairs(T) do
    		plr:GossipMenuAddItem(0, "TOP 5 |cff"..v[2]..v[1], 0, k)
    	end
    	
    	plr:GossipSendMenu(1, unit)
    end
     
    function seleciona(event, plr, unit, arg2, intid)
        if (intid > 0) then
            plr:SendBroadcastMessage("|cff"..T[intid][2]..T[intid][1])
    		
    		local resultado = CharDBQuery("SELECT name,totalKills FROM characters WHERE class='"..intid.."' ORDER BY totalKills DESC LIMIT 5")
            repeat
    			local playername = resultado:GetString(0);
    			local kills = resultado:GetUInt32(1);
    			plr:SendBroadcastMessage("|cFF33CCFFPlayer : |r ".. playername .." ,  |cFF33CCFFwith : |r" .. kills .. " Kills")
            until not resultado:NextRow()
        end
    end
    RegisterCreatureGossipEvent(NPC_ID, 1, clica)
    RegisterCreatureGossipEvent(NPC_ID, 2, seleciona)
    Decided to not use a prepared statement function and just go with a variable SQL query instead

  7. The Following User Says Thank You to Foereaper For This Useful Post:


  8. #6
    Enthusiast
    Join Date
    Nov 2014
    Posts
    73
    XP
    1,783
    Level
    11
    Thanks
    13
    Thanked 3 Times in 3 Posts
    Code:
    ----------------------------------------------
    -- TOP 5 per class                          //
    -- Script by Renatokeys(emudevs)            //
    -- http://emudevs.com                       //
    ----------------------------------------------
    
    local NPC_ID = 60096
    
    local ClassLocale = {
            [1] = {"Warrior", "660000"},
            [2] = {"Paladin", "FF0099"},
            [3] = {"Hunter", "CC6611"},
            [4] = {"Rogue", "CCFF00"},
            [5] = {"Priest", "FFFFFF"},
            [6] = {"Death Knight", "4D4D51"},
            [7] = {"Shaman", "0000CC"},
            [8] = {"Mage", "33FFFF"},
            [9] = {"Warlock", "660099"},
            [11] = {"Druid", "FF6600"}
    };
    
    function clica(event, plr, unit)
            plr:GossipMenuAddItem(0, "Choose the class : ", 0, 0)
    
            for k, v in pairs(ClassLocale) do
                    plr:GossipMenuAddItem(0, "TOP 5 |cff"..v[2]..v[1], 0, k)
            end
    
            plr:GossipSendMenu(1, unit)
    end
    
    function seleciona(event, plr, unit, arg2, intid)
        if (intid > 0) then
            plr:SendBroadcastMessage("|cff"..ClassLocale[intid][2]..ClassLocale[intid][1])
    
                    local resultado = CharDBQuery("SELECT name,totalKills FROM characters WHERE class='"..intid.."' ORDER BY totalKills DESC LIMIT 5")
            repeat
                            local playername = resultado:GetString(0);
                            local kills = resultado:GetUInt32(1);
                            plr:SendBroadcastMessage("|cFF33CCFFPlayer : |r ".. playername .." ,  |cFF33CCFFwith : |r" .. kills .. " Kills")
            until not resultado:NextRow()
            plr:GossipComplete()
        end
    end
    RegisterCreatureGossipEvent(NPC_ID, 1, clica)
    RegisterCreatureGossipEvent(NPC_ID, 2, seleciona)
    @Foereaper Here you are I fix some errors (name variables, simple stuff). Also close gossip windows when choose an option.

    A question: Anybody knows how not to show GMs players? A sql statment for not to show players which are in GM accounts?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •