Jump to content

Fixed now


spoty

Recommended Posts

hello i need some help

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

Link to comment
  • Moderators

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 by Guest
Link to comment

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

Link to comment
  • Moderators
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) 
  

Link to comment
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 :D

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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