Jump to content

Pls help


K4stic

Recommended Posts

Error line 2 : Database query failed: no such table : accounts

Error line 3 : attempt to get lenght of local 'serialCheck' (a boolean value)

function onPlayerRegister(user,pass) 
    local serialCheck = executeSQLQuery( "SELECT * FROM accounts WHERE serial = ?", getPlayerSerial( source ) ) 
    if ( #serialCheck < 3 ) then 
    if (user) and (pass) then 
        local account = getAccount(user,pass) 
        if (account == false) then 
            addAccount(user,pass) 
            local account = getAccount(user,pass) 
            logIn(source,account,pass) 
            triggerClientEvent(source,"Login:closeLoginPanel",source) 
            exports.SCGhelp:createNewHelpMessageForPlayer( source,"You have registered!", 0, 255, 0) 
            showPlayerHudComponent(source,'all',true) 
            showChat(source,true) 
            else 
            exports.SCGhelp:createNewHelpMessageForPlayer( source,"You can only register 2 accounts for each serial!", 225, 0, 0 ) 
        end 
        else 
            exports.SCGhelp:createNewHelpMessageForPlayer( source,"That account already exists.", 255, 0, 0) 
        end 
    else 
        exports.SCGhelp:createNewHelpMessageForPlayer( source,"Fatal Register Error ~ Server Side", 255, 0, 0) 
        return 
    end 
end 
addEvent("Login:onPlayerRegister",true) 
addEventHandler("Login:onPlayerRegister",root,onPlayerRegister) 

look here the database

http://i79.servimg.com/u/f79/17/22/60/79/tables10.jpg

Link to comment

-- # Server Side 
addEventHandler("onResourceStart",resourceRoot, 
 function ( ) 
        executeSQLQuery("CREATE TABLE IF NOT EXISTS 'SQLRegisterTable' ( serial )") 
 end 
) 
  
function onPlayerRegister(user,pass) 
    if (user) and (pass) then 
        local account = getAccount(user,pass) 
        if (account == false) then 
   local serial = getPlayerSerial(source) 
   local serialCheck = executeSQLQuery( "SELECT * FROM 'SQLRegisterTable' WHERE serial = ?",serial ) 
   if ( type ( serialCheck ) == "table" and #serialCheck == 0 ) or not serialCheck then 
    executeSQLQuery ( "INSERT INTO SQLRegisterTable ( serial ) VALUES ( ? )", serial )  
   elseif #serialCheck == 1 then 
    executeSQLQuery ( "INSERT INTO SQLRegisterTable ( serial ) VALUES ( ? )", serial )  
   else  
    return exports.SCGhelp:createNewHelpMessageForPlayer( source,"You can only register 2 accounts for each serial!", 225, 0, 0 ) 
   end    
            addAccount(user,pass) 
            local account = getAccount(user,pass) 
            logIn(source,account,pass) 
            exports.SCGhelp:createNewHelpMessageForPlayer( source,"You have registered!", 0, 255, 0) 
            showPlayerHudComponent(source,'all',true) 
            showChat(source,true) 
        else 
            exports.SCGhelp:createNewHelpMessageForPlayer( source,"That account already exists.", 255, 0, 0) 
        end 
    else 
        exports.SCGhelp:createNewHelpMessageForPlayer( source,"Fatal Register Error ~ Server Side", 255, 0, 0) 
        return 
    end 
end 
addEvent("Login:onPlayerRegister",true) 
addEventHandler("Login:onPlayerRegister",root,onPlayerRegister) 

Try it.

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...