Jump to content

SQL Table


Recommended Posts

آلسلام عليكم ورحة الله وبركاته

كيف حآلكم

لآهنتم انا عندي مشكلة في جدول قآعدة آلبيانات

سويت جدول , لكن لما يطلع ويكون معه الداتا "Banned"

يطلع لي خطاء بآلديبوق

يقول

[02:59:34] ERROR: xAdminmsg\s.lua:17: Database query failed: no such column: CC4 
193688D1DBA488EC8A309EE1A52E3 

طبعاً هذآ سيريآلي , لكن مآدري وش فيه مو رآضي يضبط , وهذا الكود !

addEventHandler('onResourceStart',resourceRoot, 
        function (      ) 
        local CreateNewTable = executeSQLQuery("CREATE TABLE IF NOT EXISTS blcser (serial,ban)") 
           if ( CreateNewTable ) then 
           outputDebugString('Create [ Black List Table ] Table done .') 
     end 
 end 
) 
  
    addEventHandler('onPlayerQuit',root, 
        function (  ) 
        local blc = getElementData ( source, "Banned" ) 
        if ( blc ) == Yes then 
        outputDebugString('get data done.') 
        local Results = executeSQLQuery("SELECT * FROM blcser WHERE serial=?",getPlayerSerial ( source ) ) 
        if ( type ( Results ) == "table" and #Results == 0 or not Results ) then 
        executeSQLQuery ( "INSERT INTO blcser (serial,ban) VALUES(?,?)", getPlayerSerial ( source ), blc ) 
        else 
        executeSQLQuery('UPDATE blcser SET ban =? WHERE serial =?',blc,getPlayerSerial ( source ) ) 
            end 
        end 
    end 
    ) 
      

Link to comment

addEventHandler ("onResourceStart", resourceRoot, 
  function () 
    local CreateNewTable = executeSQLQuery ("CREATE TABLE IF NOT EXISTS blcser (serial, ban)") 
    if ( CreateNewTable ) then 
      outputDebugString ("Create [ Black List Table ] Table done .") 
    end 
  end 
) 
  
addEventHandler ("onPlayerQuit", root, 
  function () 
    local blc = getElementData ( source, "Banned" ) 
    if ( blc ) == Yes then 
      outputDebugString ("get data done.") 
      local Results = executeSQLQuery ("SELECT * FROM blcser WHERE serial=?", tostring (getPlayerSerial (source)) ) 
      if ( type ( Results ) == "table" and #Results == 0 or not Results ) then 
        executeSQLQuery( "INSERT INTO blcser (serial, ban) VALUES (?, ?)", tostring (getPlayerSerial (source)), tostring (blc)) 
      else 
        executeSQLQuery ("UPDATE blcser SET ban =? WHERE serial =?", tostring (blc), tostring (getPlayerSerial (source)) ) 
      end 
    end 
  end 
) 
Link to comment
متغير Yes?

هذي آلقيمه حقت الداتا "Banned"

-- The Killer

يعطيكك آلعافيه لكن فيه مشكله

لما يدخل ماترجع له الداتا

    addEventHandler ("onResourceStart", resourceRoot, 
      function () 
        local CreateNewTable = executeSQLQuery ("CREATE TABLE IF NOT EXISTS blcser (serial, ban)") 
        if ( CreateNewTable ) then 
          outputDebugString ("Create [ Black List Table ] Table done .") 
        end 
      end 
    ) 
      
    addEventHandler ("onPlayerQuit", root, 
      function () 
        local blc = getElementData ( source, "Banned" ) 
        if ( blc ) == Yes then 
          outputDebugString ("get data done.") 
          local Results = executeSQLQuery ("SELECT * FROM blcser WHERE serial=?", tostring (getPlayerSerial (source)) ) 
          if ( type ( Results ) == "table" and #Results == 0 or not Results ) then 
            executeSQLQuery( "INSERT INTO blcser (serial, ban) VALUES (?, ?)", tostring (getPlayerSerial (source)), tostring (blc)) 
          else 
            executeSQLQuery ("UPDATE blcser SET ban =? WHERE serial =?", tostring (blc), tostring (getPlayerSerial (source)) ) 
          end 
        end 
      end 
    ) 
      
    addEventHandler('onPlayerJogin',root, 
        function (  ) 
        local Results = executeSQLQuery("SELECT * FROM blcser WHERE serial=?",tostring (getPlayerSerial ( source )) ) 
            if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end 
            outputChatBox ("load Data Done.", source, 255,0,0 ) 
            setElementData ( source,"Banned", Results[1]['ban'] )  
        end 
    ) 

Edited by Guest
Link to comment

اذا سويت

setElementData(player,"Banned",Yes) 
  

ماكانت معرفه Yes و

nil الالمنت داتا بتكون

Edit:

ومو متاكد لو ذا يأثر او لا

بس انت وانت تصنع التيبل

الكولمنز ماحددت اذا TEXT - INT etc..

Link to comment
متغير Yes?

هذي آلقيمه حقت الداتا "Banned"

-- The Killer

يعطيكك آلعافيه لكن فيه مشكله

الله يعافيك .. بس زي ما قال الوحش فوق

setElementData (source, "Banned", Yes) 

كذا ما يصلح لأنها بتطلع لك فراغ الي هو

nil

فعشان كذا سو لها سترنق زي كذا

setElementData (source, "Banned", "Yes") 
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...