spoty Posted September 28, 2014 Posted September 28, 2014 (edited) fixed now Edited October 1, 2014 by Guest
mustang Posted September 28, 2014 Posted September 28, 2014 hello i need some helpi know you can make databse in xml and lua so i am trying to make one in lua beqause i dont have sql ( running server from home pc) and its based on p50 drift script You CAN create a database on your PC , Search for XAMPP
Anubhav Posted September 28, 2014 Posted September 28, 2014 hello i need some helpi know you can make databse in xml and lua so i am trying to make one in lua beqause i dont have sql ( running server from home pc) and its based on p50 drift script You CAN create a database on your PC , Search for XAMPP Did you read his post, He said 'SQL' not 'MySQL'. Use executeSQLQuery or db functions with "sqlite" connection.
spoty Posted September 28, 2014 Author Posted September 28, 2014 and can you guys mayby make a small start for me because i am pretty noob in database scripting
spoty Posted September 30, 2014 Author Posted September 30, 2014 still no fix.... can anybody help me?
spoty Posted September 30, 2014 Author Posted September 30, 2014 ok so i have installed xampp could anybody help me now?
Moderators IIYAMA Posted October 1, 2014 Moderators Posted October 1, 2014 what is wrong with account data? https://wiki.multitheftauto.com/wiki/SetAccountData If you haven't 1000+ of players in your server, accountdata will do the job.
spoty Posted October 1, 2014 Author Posted October 1, 2014 what is wrong with account data? https://wiki.multitheftauto.com/wiki/SetAccountData If you haven't 1000+ of players in your server, accountdata will do the job. ye i wanne do it with account data but i cant see what i did wrong but i gonna rescript it mayby will work then i am also trying to work it with mySQL but still not working...
Moderators IIYAMA Posted October 1, 2014 Moderators Posted October 1, 2014 (edited) afaik, you haven't tried to store anything at the accounts, only set/get elementdata. Leave mySQL for later, no need to learn first the basic, like: local accountData = getAccountData (theCurrentAccount, "arizonadrift") if (accountData) then local getElementData(player, "Last Drift", anterior) local getElementData(player, "Total Drift", total) local getElementData(player, "Best Drift", mejor) setElementData(player, "Last Drift", anterior) setElementData(player, "Total Drift", total) setElementData(player, "Best Drift", mejor) end local anterior = getElementData(source, "Last Drift") local total = getElementData(source, "Total Drift") local mejor = getElementData(source, "Best Drift") setAccountData (theCurrentAccount,"Last_Drift") setAccountData (theCurrentAccount,"Total_Drift",total) setAccountData (theCurrentAccount,"Best_Drift",mejor) Repost when you are done fixing. Edited October 1, 2014 by Guest
spoty Posted October 1, 2014 Author Posted October 1, 2014 hmm ok i tryed that now and this is what i currently have function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "arizonadrift") if (accountData) then local anterior = getElementData(source, "Last Drift", anterior) local total = getElementData(source, "Total Drift", total) local mejor = getElementData(source, "Best Drift", mejor) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", getRootElement(), onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then setElementData(source, "Last Drift", anterior) setElementData(source, "Total Drift", total) setElementData(source, "Best Drift", mejor) end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) 0 error's but it wont save / set the score
Moderators IIYAMA Posted October 1, 2014 Moderators Posted October 1, 2014 addEventHandler ("onPlayerLogin",root, function (thePreviousAccount, theCurrentAccount, autoLogin) local anterior = getAccountData (theCurrentAccount,"Last_Drift") local total = getAccountData (theCurrentAccount,"Total_Drift") local mejor = getAccountData (theCurrentAccount,"Best_Drift") setElementData(source, "Last Drift", anterior) setElementData(source, "Total Drift", total) setElementData(source, "Best Drift", mejor) end) addEventHandler ("onPlayerLogout", root, function() if not kickPlayer (source, nil, "Logging out is disallowed.") then -- if the player doesn't get kicked(no admin rights) setElementData(source, "Last Drift", false) setElementData(source, "Total Drift", false) setElementData(source, "Best Drift", false) end end) addEventHandler ("onPlayerQuit", root, function (quitType, reason, responsibleElement) local account = getPlayerAccount (source) if not isGuestAccount (account) then local anterior = getElementData(source, "Last Drift") local total = getElementData(source, "Total Drift") local mejor = getElementData(source, "Best Drift") setAccountData (account,"Last_Drift",anterior) setAccountData (account,"Total_Drift",total) setAccountData (account,"Best_Drift",mejor) end end)
spoty Posted October 1, 2014 Author Posted October 1, 2014 addEventHandler ("onPlayerLogin",root, function (thePreviousAccount, theCurrentAccount, autoLogin) local anterior = getAccountData (theCurrentAccount,"Last_Drift") local total = getAccountData (theCurrentAccount,"Total_Drift") local mejor = getAccountData (theCurrentAccount,"Best_Drift") setElementData(source, "Last Drift", anterior) setElementData(source, "Total Drift", total) setElementData(source, "Best Drift", mejor) end) addEventHandler ("onPlayerLogout", root, function() if not kickPlayer (source, nil, "Logging out is disallowed.") then -- if the player doesn't get kicked(no admin rights) setElementData(source, "Last Drift", false) setElementData(source, "Total Drift", false) setElementData(source, "Best Drift", false) end end) addEventHandler ("onPlayerQuit", root, function (quitType, reason, responsibleElement) local account = getPlayerAccount (source) if not isGuestAccount (account) then local anterior = getElementData(source, "Last Drift") local total = getElementData(source, "Total Drift") local mejor = getElementData(source, "Best Drift") setAccountData (account,"Last_Drift",anterior) setAccountData (account,"Total_Drift",total) setAccountData (account,"Best_Drift",mejor) end end) awesome!!!! you are the best
Recommended Posts