K4stic Posted May 14, 2013 Posted May 14, 2013 how i can make to one serial can make max 2 accounts ?
iPrestege Posted May 14, 2013 Posted May 14, 2013 Exactly and when player trying to register next time get the 'SQL' Results and check !
K4stic Posted May 14, 2013 Author Posted May 14, 2013 local serialCheck = executeSQLQuery( "SELECT * FROM accounts WHERE serial = ?", getPlayerSerial( source ) ) i think this is ok
iPrestege Posted May 14, 2013 Posted May 14, 2013 Yes that's right but do you have a 'accounts' sql table?
iPrestege Posted May 14, 2013 Posted May 14, 2013 Ah,Ok Did you try it?When player trying to register add the serial to the sql table?!
K4stic Posted May 15, 2013 Author Posted May 15, 2013 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
iPrestege Posted May 15, 2013 Posted May 15, 2013 I mean create a new table for you're register system .
K4stic Posted May 15, 2013 Author Posted May 15, 2013 maybe i use wrong the ExecuteSQLQuery i see how use it wiki the SELECT so how make it? https://wiki.multitheftauto.com/wiki/ExecuteSQLQuery
iPrestege Posted May 15, 2013 Posted May 15, 2013 -- # 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.
K4stic Posted May 15, 2013 Author Posted May 15, 2013 one ask i wonna make to it each serial can register max 2 accounts
iPrestege Posted May 15, 2013 Posted May 15, 2013 Will i just test it and work's fine make sure it's server side and copy it again -.-
K4stic Posted May 15, 2013 Author Posted May 15, 2013 i know then one script is server or Client side
iPrestege Posted May 15, 2013 Posted May 15, 2013 -.- I Just test it and work's fine what the 'debugscript 3' Say?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now