boban88 Posted May 27, 2015 Posted May 27, 2015 Hello i have 2nd problem with my DB i have login and register system via MySql. Register: works perfect DB set all stats to 0 money to 500€ Login: works perfect DB load all stats on 0 and money on 500€ Save: don't work in spoiler is my code. function saveAccounts() local name = getPlayerName ( source ) local money = getPlayerMoney ( source ) local serial = getPlayerSerial ( source ) local points = getElementData(source,"Points") local wins = getElementData(source,"Wins") local second = getElementData(source,"Second") local third = getElementData(source,"Third") local hunters = getElementData(source,"Hunters") local level = getElementData(source,"Level") local kills = getElementData(source,"Kills") local deaths = getElementData(source,"Deaths") local score = getElementData(source,"Score") local playtime = getElementData(source,"PT") local matches = getElementData(source,"Matches") local days = getElementData(source,"Days") local hours = getElementData(source,"Hours") local minutes = getElementData(source,"Minutes") local pameti = getElementData(source,"pamet") local pasii = getElementData(source,"pasi") local hnup = mysql_connect( "localhost", "root", "pass", "mtadb", "3306" ) hmj = string.gsub(name, "#%x%x%x%x%x%x", "") mysql_query ( hnup, "UPDATE `accounts` SET `log`="..pameti..",`pass`="..pasii..",`name`="..hmj..",`serial`="..serial..",`points`="..points..",`wins`="..wins..",`second`="..second..",`third`="..third..",`hunters`="..hunters..",`level`="..level..",`kills`="..kills..",`deaths`="..deaths..",`score`="..score..",`matches`="..matches..",`playtime`="..playtime..",`days`="..days..",`hours`="..hours..",`minutes`="..minutes..",`money`="..money.." WHERE log="..pameti.."") end addEventHandler ( "onPlayerQuit", getRootElement(), saveAccounts ) Thank you for any ideas and solutions.
Tomas Posted May 28, 2015 Posted May 28, 2015 Hello i have 2nd problem with my DB i have login and register system via MySql.Register: works perfect DB set all stats to 0 money to 500€ Login: works perfect DB load all stats on 0 and money on 500€ Save: don't work in spoiler is my code. function saveAccounts() local name = getPlayerName ( source ) local money = getPlayerMoney ( source ) local serial = getPlayerSerial ( source ) local points = getElementData(source,"Points") local wins = getElementData(source,"Wins") local second = getElementData(source,"Second") local third = getElementData(source,"Third") local hunters = getElementData(source,"Hunters") local level = getElementData(source,"Level") local kills = getElementData(source,"Kills") local deaths = getElementData(source,"Deaths") local score = getElementData(source,"Score") local playtime = getElementData(source,"PT") local matches = getElementData(source,"Matches") local days = getElementData(source,"Days") local hours = getElementData(source,"Hours") local minutes = getElementData(source,"Minutes") local pameti = getElementData(source,"pamet") local pasii = getElementData(source,"pasi") local hnup = mysql_connect( "localhost", "root", "pass", "mtadb", "3306" ) hmj = string.gsub(name, "#%x%x%x%x%x%x", "") mysql_query ( hnup, "UPDATE `accounts` SET `log`="..pameti..",`pass`="..pasii..",`name`="..hmj..",`serial`="..serial..",`points`="..points..",`wins`="..wins..",`second`="..second..",`third`="..third..",`hunters`="..hunters..",`level`="..level..",`kills`="..kills..",`deaths`="..deaths..",`score`="..score..",`matches`="..matches..",`playtime`="..playtime..",`days`="..days..",`hours`="..hours..",`minutes`="..minutes..",`money`="..money.." WHERE log="..pameti.."") end addEventHandler ( "onPlayerQuit", getRootElement(), saveAccounts ) Thank you for any ideas and solutions. Any debug?
boban88 Posted May 28, 2015 Author Posted May 28, 2015 no i haven't any errors or warnings in logs or console. I dont know why this code not working when reg and log works perffect with same parameters...
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