Management Karbust 4884 Posted December 20, 2014 Management Share Posted December 20, 2014 Hi Today I was starting the pvm event on my server, and the NPC where is the teleport doesn't appears nothing, just the "OK" button. Start the event: if evento == 1 then game.set_event_flag("evento_pvm", 1) game.set_event_flag("lvl_pvm", lvl) notice_all("Evento PvM está agora ativo!") notice_all("Entradas pelo "..mob_name(10674).."") notice_all("Nível Mínimo: "..lvl.."") mysql_query("INSERT INTO log.log_eventos (id, gm, tipo, x, y, lvl, data) VALUES ('', '"..name.."', 'pvm', '"..x.."', '"..y.."', '"..lvl.."', '"..data1.."');") mysql_query("INSERT INTO player.eventos (id, gm, tipo, x, y, lvl, data) VALUES ('', '"..name.."', 'pvm', '"..x.."', '"..y.."', '"..lvl.."', '"..data1.."');") elseif evento == 2 then return end This appears on virtual box: (a couple of lines like those) mysql: not found mysql: not found mysql: not found mysql: not found Entrance: if game.get_event_flag("evento_pvm") == 1 then local x = mysql_query("SELECT x FROM player.eventos WHERE tipo='pvm'") local y = mysql_query("SELECT y FROM player.eventos WHERE tipo='pvm'") local pvm = select ("Participar PvM", "Cancelar") if pvm == 1 then if pc.get_level() >= game.get_event_flag("lvl_pvm") then pc.warp(x.x[1], y.y[1]) else setbgimage('level_bg.tga') say_color("black", " Não tens nível suficiente!") end elseif pvm == 2 then return end end This was working the last time I started the server, but now isn't... Someone nows why? Thanks King Regards P.S.: If the event is deactivated appears the line saying "Não tens nível suficiente"... Link to comment Share on other sites More sharing options...
Premium MrLibya 554 Posted December 20, 2014 Premium Share Posted December 20, 2014 Try To Use mysql_direct_query functon [ Credit to : lollo_9_1 // epvp ] 1 1 If you're going to do something, then do it right. Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 20, 2014 Author Management Share Posted December 20, 2014 the sintaxe is the same form the mysql_query? EDIT: I saw that topic, but has a little problem, I'm not using source, I use game 2089M Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 21, 2014 Author Management Share Posted December 21, 2014 BUMP This isn't happening with this quest is happening with all the quest who use the mysql_query function... Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 22, 2014 Author Management Share Posted December 22, 2014 BUMP Link to comment Share on other sites More sharing options...
Active Member Exygo 1091 Posted December 22, 2014 Active Member Share Posted December 22, 2014 Try to put a say("test") in front of local x = mysql_query("SELECT x FROM player.eventos WHERE tipo='pvm'") local y = mysql_query("SELECT y FROM player.eventos WHERE tipo='pvm'") if this doesn't work then the quest is stuck at local x = mysql_query("SELECT x FROM player.eventos WHERE tipo='pvm'") local y = mysql_query("SELECT y FROM player.eventos WHERE tipo='pvm'") Also try local x = mysql_query("SELECT x FROM player.eventos WHERE tipo="pvm"") local y = mysql_query("SELECT y FROM player.eventos WHERE tipo="pvm"") or local x = mysql_query('SELECT x FROM player.eventos WHERE tipo="pvm"') local y = mysql_query('SELECT y FROM player.eventos WHERE tipo="pvm"') 1 https://www.youtube.com/channel/UCQ8mAeda9TWq6SsTzB53emw/videos Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 22, 2014 Author Management Share Posted December 22, 2014 I saw another quest (vouchers) who don't use mysql_query, uses os.execute to execute a query on db, and doesn't work too... I think its problem with the quests communicating with the db... Link to comment Share on other sites More sharing options...
Active Member Exygo 1091 Posted December 23, 2014 Active Member Share Posted December 23, 2014 or the function itself, i had issues with that function too and i aborted the project what i was working to... 1 https://www.youtube.com/channel/UCQ8mAeda9TWq6SsTzB53emw/videos Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 23, 2014 Author Management Share Posted December 23, 2014 So what can I do if I can't use mysql querys on quests??? Even with os.executes works, nothing with mysql in quests works :S Link to comment Share on other sites More sharing options...
Premium Shogun 4588 Posted December 23, 2014 Premium Share Posted December 23, 2014 Can you show your syserr? Both from core and db, and /var/db/mysql/hostname.err as well Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 23, 2014 Author Management Share Posted December 23, 2014 syserr db is clean mysql syserr: http://pastebin.com/JjV1b30e syserr channel1/core1 (where are the maps where I use the quests): lots of lines like those: http://pastebin.com/Pav61J2i Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 24, 2014 Author Management Share Posted December 24, 2014 BUMP Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 25, 2014 Author Management Share Posted December 25, 2014 BUMP Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 26, 2014 Author Management Share Posted December 26, 2014 BUMP Please someone help me... Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 29, 2014 Author Management Share Posted December 29, 2014 BUMP Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 30, 2014 Author Management Share Posted December 30, 2014 BUMP Link to comment Share on other sites More sharing options...
Isolation 54 Posted December 30, 2014 Share Posted December 30, 2014 .. Ask the right question. mysql: not found mysql: not found mysql: not found mysql: not found I guess that's pretty clear. At least for me. Just execute the following command: pkg_info if you're using the new version of pkg then just do: pkg info Post the results. I guess the mysql-client package is missing therefore it's no surprise that your server is unable to find the mysql command. 1 what would you do in a battle of survival? It's coming soon Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7178 Posted December 30, 2014 Honorable Member Share Posted December 30, 2014 (edited) This appears on virtual box: (a couple of lines like those) mysql: not found mysql: not found mysql: not found mysql: not found Find the definition of the mysql_query function and, inside the io.execute, change "mysql" with "/usr/local/bin/mysql". # find /usr/local/bin -name mysql /usr/local/bin/mysql Usually, you should have that file if you installed mysql correctly.If yes: Probably, the shell doesn't have the relative path successfully bound: # echo $PATH /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin In this case, you can decide to use an absolute path or add the missing folder in the relative environment variable. NB: This is a common issue when you use crontab. Edited December 30, 2014 by martysama0134 1 Check out my GitHub Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 30, 2014 Author Management Share Posted December 30, 2014 os.execute('/usr/local/bin/mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) os.execute("/usr/local/bin/mysql -u mt2 --password='mt2!@#' account --execute='UPDATE account SET coins = coins + ".. mycash .." WHERE id = ".. pc.get_account_id() ..";'") like this? Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7178 Posted December 30, 2014 Honorable Member Share Posted December 30, 2014 os.execute('/usr/local/bin/mysql ...the-rest-of-the-command...') like this? Yes, but you should also check whether you have this file or not: # ls -l /usr/local/bin/mysql -rwxr-xr-x 1 root wheel 3333736 Nov 16 03:49 /usr/local/bin/mysql 1 Check out my GitHub Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 30, 2014 Author Management Share Posted December 30, 2014 That part is now working right, thanks! But the mysql_query function isn't working :S 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 MySQL51 --os.execute('/usr/local/bin/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, out[i-1] = out[i-1] or {} out[i-1][a] = tonumber( or b or 'NULL' out[t[1][a]] = out[t[1][a]] or {} out[t[1][a]][i-1] = tonumber( or b or 'NULL' end) end return out end I have FreeBSD 8.2, I guess is MySQL 5.1, but I tried with the two and doesnt' work... My old mysql_query function: function mysql_query(query,user,pw,db,ip) -- Gibt ALLE Werte als STR zurück. local var = {} var.pre = '' if ip ~= nil then var.pre = var.pre..' -h'..ip end if user ~= nil then var.pre = var.pre..' -u'..user end if pw ~= nil then var.pre = var.pre..' -p'..pw end if db ~= nil then var.pre = var.pre..' -D'..db end var.scriptfile = 'sc_'..pc.get_name() var.outputfile = 'op_'..pc.get_name() query= string.gsub(query,'"',"'") var.str = "/usr/local/bin/mysql "..var.pre.." < "..var.scriptfile.." > "..var.outputfile script = io.open(var.scriptfile,"w") script:write(query) script:close() os.execute(var.str) local g = {} local f = io.open(var.outputfile) g.i = 0 g.li={} g.out= {} g.count = 0 for line in f:lines() do g.i = g.i+1 g.li[g.i] = line end -- TESTDEBUG if g.li[1] == nil then return "ERROR" end if string.len(g.li[1]) == 0 then return "ERROR" end -- TESTDEBUG ENDE -- Abfrage später : if out == "ERROR" then return end << Beispiel!! g.fields = split(g.li[1],' ') table.foreachi(g.fields, function(lb,ln) g.out[ln] = {} end) table.foreachi(g.li, function(ou1,ou2) if ou1 > 1 then local la = split(ou2,' ') g.count = g.count+1 table.foreachi(g.fields, function(lb,ln) g.out[ln][(ou1-1)] = la[lb] end) end end ) f:close() -- Alle Strings, die nur Zahlen beinhalten, in Zahlen umwandeln -- Zeigt gleichzeitig die Nutzungsmöglichkeit vom von mir modifizierten tonumber() table.foreach(g.out, function(i,l) table.foreach(l, function(i2,l2) local d,e = tonumber(l2) if e then g.out[i][i2] = d end end ) end ) g.out.__data = {} -- Zur Ausgabe Queryspezifischer Daten g.out.__data.fields = g.fields g.out.__data.lines = g.count g.out.__data.user = user g.out.__data.pass = pw g.out.__data.host = ip g.out.__data.db = db g.out.__data.query = query os.execute("rm "..var.scriptfile) os.execute("rm "..var.outputfile) return g.out end Link to comment Share on other sites More sharing options...
MagicianPT 1 Posted December 31, 2014 Share Posted December 31, 2014 Hello, your code line os.execute need full path to mysql file. This is also common to happen on scripts in fbsd. Change this: os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) -- für MySQL51 to os.execute('/usr/local/bin/mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) -- für MySQL51 it will work. Good 2015 to all. many edits.. -> rusty English.. eheh! EDIT2: You may also change: os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) -- für MySQL51 --os.execute('/usr/local/bin/mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- für MySQL55 to --os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) -- für MySQL51 os.execute('/usr/local/bin/mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- für MySQL55 If you're using mysql 5.5... 1 Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 31, 2014 Author Management Share Posted December 31, 2014 Thanks Dave But has I said to you on private, on function give_dm (vouchers) who use is.execute I changed mysql to the complete directory, and worked by on the function mysql_query isn't working... Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted December 31, 2014 Author Management Share Posted December 31, 2014 Tanks to all Problem solved! Happy New Year to all the members and their families... Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now