Jump to content

toby

Miembro
  • Contador contenido

    6
  • Ingreso

  • Última visita

Actividad de reputación

  1. Me Gusta
    toby reacted to darksirk in Ranking PVP   
    Hola chavos hoy les traigo un pequeño ranking pvp ingame, seguro a alguno le sirve, esta es la quest

    quest rankingpvp begin state start begin when 20095.chat."Ranking PVP" begin local consultatop = mysql_query("SELECT * FROM player.KillsTop ORDER BY KillsTop.Puntos DESC") say("#: Nombre // Eliminados ") say_gold("1: "..consultatop.name[1].." // "..consultatop.Puntos[1].." ") say_red("2: "..consultatop.name[2].." // "..consultatop.Puntos[2].." ") say_blue2("3: "..consultatop.name[3].." // "..consultatop.Puntos[3].." ") say_white("4: "..consultatop.name[4].." // "..consultatop.Puntos[4].." ") say_white("5: "..consultatop.name[5].." // "..consultatop.Puntos[5].." ") say_white("6: "..consultatop.name[6].." // "..consultatop.Puntos[6].." ") say_white("7: "..consultatop.name[7].." // "..consultatop.Puntos[7].." ") say_white("8: "..consultatop.name[8].." // "..consultatop.Puntos[8].." ") say_white("9: "..consultatop.name[9].." // "..consultatop.Puntos[9].." ") say_white("10: "..consultatop.name[10].." // "..consultatop.Puntos[10].." ") end when kill with npc.is_pc() begin if pc.getqf("bienvenidoaltop_Sssss") == 0 then pc.setqf("bienvenidoaltop_Sssss",1) mysql_query("INSERT INTO player.KillsTop (name, Puntos) VALUES('"..pc.getname().."','1')") chat("Has ingresado al TOPKill.") else mysql_query("UPDATE player.KillsTop SET KillsTop.Puntos= Puntos + 1 WHERE name='"..pc.get_name().."'") end end end end en caso de que les pida las funciones deben añadir esto al quest lib mysql_query = function(query) if not pre then local rt = io.open('CONFIG','r'):read('*all') pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4') end math.randomseed(os.time()) local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{} os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- für MySQL55 for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'\t')) end; os.remove(fi); for i = 2, table.getn(t) do table.foreach(t[i],function(a,b) out[i-1] = out[i-1] or {} out[i-1][a] = tonumber(b) or b or 'NULL' out[t[1][a]] = out[t[1][a]] or {} out[t[1][a]][i-1] = tonumber(b) or b or 'NULL' end) end return out end function split(str, delim, maxNb) if str == nil then return str end if string.find(str, delim) == nil then return { str } end if maxNb == nil or maxNb < 1 then maxNb = 0 end local result = {} local pat = "(.-)" .. delim .. "()" local nb = 0 local lastPos for part, pos in string.gfind(str, pat) do nb = nb + 1 result[nb] = part lastPos = pos if nb == maxNb then break end end if nb ~= maxNb then result[nb + 1] = string.sub(str, lastPos) end return result end function say_blue ( name ) say ( color256 ( 0 , 0 , 255 ).. name .. color256 ( 0 , 0 , 255 )) end function say_red ( name ) say ( color256 ( 255 , 0 , 0 ).. name .. color256 ( 255 , 0 , 0 )) end function say_green ( name ) say ( color256 ( 0 , 238 , 0 ).. name .. color256 ( 0 , 238 , 0 )) end function say_gold ( name ) say ( color256 ( 255 , 215 , 0 ).. name .. color256 ( 255 , 215 , 0 )) end function say_black ( name ) say ( color256 ( 0 , 0 , 0 ).. name .. color256 ( 0 , 0 , 0 )) end function say_white ( name ) say ( color256 ( 255 , 255 , 255 ).. name .. color256 ( 255 , 255 , 255 )) end function say_yellow ( name ) say ( color256 ( 255 , 255 , 0 ).. name .. color256 ( 255 , 255 , 0 )) end function say_blue2 ( name ) say ( color256 ( 0 , 206 , 209 ).. name .. color256 ( 0 , 206 , 209 )) end function say_grey ( name ) say ( color256 ( 196 , 196 , 196 ).. name .. color256 ( 196 , 196 , 196 )) end function say_color(color, text) local rgb = rawget(colors_data, color) say(color256(rgb[1],rgb[2],rgb[3])..text..color256(colors_data.default[1], colors_data.default[2], colors_data.default[3])) end function set_text_color(color) local rgb = rawget(colors_data, color) raw_script(color256(rgb[1],rgb[2],rgb[3])) end colors_data = { ['verde'] = {0,190,0}, ['verde chiaro'] = {0,255,0}, ['verde scuro'] = {0,120,0}, ['verde leggero'] = {144,238,144}, ['verde acqua'] = {102,205,170}, ['rosso'] = {240,0,0}, ['rosso leggero'] = {255,69,51}, ['rosa'] = {255,64,160}, ['rosa scuro'] = {255,0,128}, ['rosa chiaro'] = {255,182,193}, ['corallo'] = {255,127,80}, ['arancione'] = {255,130,0}, ['arancione scuro'] = {255,90,0}, ['fucsia'] = {255,0,255}, ['viola'] = {224,129,255}, ['viola scuro'] = {148,0,148}, ['lilla'] = {200,162,200}, ['marrone'] = {161,63,0}, ['marrone scuro'] = {120,66,0}, ['marrone chiaro'] = {200,164,115}, ['giallo'] = {255,255,53}, ['giallo chiaro'] = {255,255,128}, ['oro'] = {255,191,24}, ['blu'] = {0,0,250}, ['blu scuro'] = {0,0,150}, ['azzurro'] = {128,255,255}, ['azzurro chiaro'] = {193,255,255}, ['turchese'] = {0,255,255}, ['bianco'] = {255,255,225}, ['grigio'] = {128,128,128}, ['nero'] = {0,0,0}, ['default'] = {196,196,196} } QuestFolder = get_locale_base_path().."/quest/" function say_light_yellow(str) say(color256(255,255,128)..str..color256(196, 196, 196)) end function say_yellow(str) say(color256(255,255,53)..str..color256(196, 196, 196)) end function say_orange(str) say(color256(255,191,24)..str..color256(196, 196, 196)) end function say_light_blue(str) say(color256(130, 192, 255)..str..color256(196, 196, 196)) end function say_bonus(str) say(color256(167, 255, 212)..str..color256(196, 196, 196)) end function pc.change_coins(value) mysql_query("UPDATE account.account SET coins=coins +"..value.." WHERE ID='"..pc.get_account_id.."' LIMIT 1") end y esto al quest function say_blue say_blue2 say_red say_green say_gold say_black say_white say_yellow say_grey
    y por ultimo deben crear una tabla en player llamada "KillsTop", con las siguientes caracterisiticas

    creditos por mi y hellraiser, y a rafa23alzira(la idea de la quest fueron sacadas de los files necon y fue reesctructurado)
    foto "ingame"

×
×
  • Crear nuevo...