• Experiencing errors with hooks and functions
    0 replies, posted
so this is my code in the first file : require ("mysqloo") function connectToDatabase() databaseObject = mysqloo.connect(badthings.settings.sql.host, badthings.settings.sql.username, badthings.settings.sql.password, badthings.settings.sql.database, badthings.settings.sql.port) databaseObject.onConnected = function() print("Database linked!") end databaseObject.onConnectionFailed = function() print("Failed to connect to the database.") end databaseObject:connect() end   connectToDatabase()    function infractionSend(ply, text)     print(ply)     print(text)       local query2 = databaseObject:query("INSERT INTO logs( user, what ) VALUES( '"..ply.."', '"..text.."' )")     query2.onSuccess = function(q)  print("Infraction sended in databse") end     query2.onError = function(q,e) print("something went wrong : ",query2:error()) end     query2:start()    return badthings.settings.response end and in the other one : (badthings.settings.a and badthings.settings.b are jsut insult lists) local bad_numa = #badthings.settings.a --FR France,Canada,Belqium local bad_numb = #badthings.settings.b --EN Great Britain,United States of America,Uk badthings.settings.land = system.GetCountry() -- Detects the contry of the player that said something if badthings.settings.land == FR then -- France     function franalyze(ply, text, public)     for i = bad_numa, 1, -1 do local strText = string.Replace( text, ".", "" ) local strText2 = string.Replace( strText, " ", "" ) local strText3 = string.Replace( strText2, ",", "" ) local strText4 = string.Replace( strText3, ";", "" ) local strText5 = string.Replace( strText4, ":", "" ) local strText6 = string.Replace( strText5, "/", "" ) local strText7 = string.Replace( strText6, "|", "" ) local strText8 = string.Replace( strText7, "!", "" )      if string.find( strText8:lower(), badthings.settings.a[i]) then   return infractionSend(ply, text)     end local complicatedfr = string.Replace( badthings.settings.a[i], " ", "" )   if string.find( strText8:lower(), complicatedfr) then              return infractionSend(ply, text)     end local another_anti_bypass = string.Replace( complicatedfr, "à", "a" )   if string.find( strText8:lower(), another_anti_bypass) then            return infractionSend(ply, text)     end end end hook.Add("PlayerSay", "SayThatAgainfr", franalyze) end It doesnt send anything int the database it connects but nothing HELP ! Thanks, (Also if you speak french : any explanations in french are welcome)
Sorry, you need to Log In to post a reply to this thread.