Jump to content

[Help]Mysql problem


--DELI16--

Recommended Posts

Posted

Help Please--Login mysql fix please

function asd()

local playerID = exports.server:playerID( source )

local weed = getElementData(source,"Weed")

local god = getElementData(source,"God")

local speed = getElementData(source,"Speed")

local lsd = getElementData(source,"Lsd")

local steroids = getElementData(source,"Steroids")

local heroin = getElementData(source,"Heroin")

local updateDatabase = exports.mysql:exec( "UPDATE drugs SET weed=?, god=?, speed=?, lsd=?, steroids=?, heroin=? WHERE id=?"

,weed

,god

,speed

,lsd

,steroids

,heroin

,playerID

)

end

addEventHandler ( "onPlayerQuit", root, asd )

addEventHandler ( "onPlayerWasted", root, asd )

addEventHandler ( "onPlayerLogout", root, asd )

function asd1()

local playerID = exports.server:playerID( source )

local weed = getAccountData(sourceAccount, "Weed")

local god = getElementData(source,"God")

local speed = getElementData(source,"Speed")

local lsd = getElementData(source,"Lsd")

local steroids = getElementData(source,"Steroids")

local heroin = getElementData(source,"Heroin")

local drugs = exports.mysql:querySingle( "SELECT * FROM drugs WHERE weed = ? AND god = ? AND speed = ? AND lsd = ? AND steroids = ? AND heroin = ? AND id = ?", weed, god, speed, lsd, steroids, heroin, playerID)

end

addEventHandler ( "onPlayerLogin", root, asd1 )

addEventHandler("onPlayerLogin", root,

function()

local playerID = exports.server:playerID( source )

local theDrug = exports.mysql:querySingle( "SELECT * FROM drugs WHERE id = '" .. playerID .. "'" )

if ( theDrug ) then

local weed = getAccountData(sourceAccount, "Weed")

getAccountData(sourceAccount, "Weed")

end

Posted

If its yours, why are you getting account data from the XML files out of the built-in user system? You are getting the userID out of a mysql database, and saving it into it. but you are retrieving unsaved data out of an XML?

You sir, have no idea of what you're doing.

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

Posted

Okee so this is realy yours? Let me point you some things out;

local playerID = exports.server:playerID( source ) -- gets information out of a MySQL database 
local weed = getAccountData(sourceAccount, "Weed") -- getAccountData -> gets information from the built-in account system, plus you haven't defined the sourceAccount. Which has to be an account element. 
  
addEventHandler ( "onPlayerLogin", root, asd1 ) -> local steroids = getElementData(source,"Steroids") -- how the hell can you get data of an element that hasn't received any data yet or has any information cause its not an element yet... 
  
local theDrug = exports.mysql:querySingle( "SELECT * FROM drugs WHERE id = '" .. playerID .. "'" ) -- the fck is this? ID's dont need qoutes around them, its an Interger and not a string. 
  
addEventHandler("onPlayerLogin", root, -- you have no idea what you're doing. You got a duplicated function... 

So to say it once again, or you have no idea what you're doing or its a leaked script that has been modified by someone without basic programmings knowledge.

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

Posted

Help please :

addEventHandler("onPlayerLogin", root,  
function() 
    local playerID = exports.server:playerID( source ) 
    local theStats = exports.DENmysql:query( "SELECT * FROM drugs WHERE id = '" .. playerID .. "'" ) 
    local result, numrows = dbPoll(second, -1) 
    if (result and numrows > 0) then 
    for index, row in pairs(result) do 
    local weed = setAccountData(sourceAccount, "Weed") 
    local god = setElementData(source,"God")  
    local speed = setElementData(source,"Speed") 
    local lsd = setElementData(source,"Lsd") 
    local steroids = setElementData(source,"Steroids") 
    local heroin = setElementData(source,"Heroin")   
end 
end 
end 
) 

Posted

Help please :

addEventHandler("onPlayerLogin", root,  
function() 
    local playerID = exports.server:playerID( source ) 
    local theStats = exports.mysql:query( "SELECT * FROM drugs WHERE id = '" .. playerID .. "'" ) 
    local result, numrows = dbPoll(second, -1) 
    if (result and numrows > 0) then 
    for index, row in pairs(result) do 
    local weed = setAccountData(sourceAccount, "Weed") 
    local god = setElementData(source,"God")  
    local speed = setElementData(source,"Speed") 
    local lsd = setElementData(source,"Lsd") 
    local steroids = setElementData(source,"Steroids") 
    local heroin = setElementData(source,"Heroin")   
end 
end 
end 
) 

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

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