Jump to content

where is the error


ahmedo01

Recommended Posts

function saveonlogout(prevA) 
local player = getAccountPlayer(prevA) 
    local money = getPlayerMoney( source ) 
    local occupation = getElementData( source, "Occupation") 
    local team = getPlayerTeam( source ) 
    local teamname = getTeamName( team ) 
    local x,y,z = getElementPosition( source ) 
    local dimension = getElementDimension( source ) 
    local interior = getElementInterior( source ) 
    local skin = getElementModel( source ) 
    local account = getPlayerAccount( source ) 
    local accountname = getAccountName( account ) 
    outputChatBox("You are logged out") 
    if money and occupation and team and x and y and z and dimension and interior and skin and teamname then 
        local savelocation = mysql_query(moduledb, "UPDATE 'playerlocations' SET x = '"..x.."', y = '"..y.."', z = '"..z.."' WHERE accountname = '"..accountname.."'") 
        local saveothers = mysql_query(moduledb, "UPDATE 'playerinfo' SET money = '"..money.."', occupation = '"..occupation.."', team = '"..teamname.."', dimension = '"..dimension.."', interior = '"..interior.."', skin = '"..skin.."' WHERE accountname = '"..accountname.."'") 
        --mysql_free_result(savelocation) 
        --mysql_free_result(saveothers) 
    else 
        outputChatBox("Error! Cannot save informations!") 
         
    end 
end 
addEventHandler("onPlayerLogout",getRootElement(),saveonlogout) 

i cant get source

source gives boolean why?

Link to comment
function saveonlogout(prevA) 
    local player = getAccountPlayer(prevA) 
    local money = getPlayerMoney( player ) 
    local occupation = getElementData( player, "Occupation") 
    local team = getPlayerTeam( player ) 
    local teamname = getTeamName( team ) 
    local x,y,z = getElementPosition( player ) 
    local dimension = getElementDimension( player ) 
    local interior = getElementInterior( player ) 
    local skin = getElementModel( player ) 
    outputChatBox("You are logged out") 
    if money and occupation and team and x and y and z and dimension and interior and skin and teamname then 
        local savelocation = mysql_query(moduledb, "UPDATE 'playerlocations' SET x = '"..x.."', y = '"..y.."', z = '"..z.."' WHERE accountname = '"..prevA.."'") 
        local saveothers = mysql_query(moduledb, "UPDATE 'playerinfo' SET money = '"..money.."', occupation = '"..occupation.."', team = '"..teamname.."', dimension = '"..dimension.."', interior = '"..interior.."', skin = '"..skin.."' WHERE accountname = '"..prevA.."'") 
        --mysql_free_result(savelocation) 
        --mysql_free_result(saveothers) 
    else 
        outputChatBox("Error! Cannot save informations!") 
        
    end 
end 
addEventHandler("onPlayerLogout",getRootElement(),saveonlogout) 

Link to comment
function Save () 
    if not ( isGuestAccount(getPlayerAccount( source ) ) ) then 
    local money = getPlayerMoney( source ) 
    local occupation = getElementData( source, "Occupation") 
    local team = getPlayerTeam( source ) 
    local teamname = getTeamName( team ) 
    local x,y,z = getElementPosition( source ) 
    local dimension = getElementDimension( source ) 
    local interior = getElementInterior( source ) 
    local skin = getElementModel( source ) 
    local account = getPlayerAccount( source ) 
    local accountname = getAccountName( account ) 
    local save = mysql_query(moduledb,"UPDATE playerinfo SET money=?, occupation=?, team=?, wanted=?, x=?, y=?, z=?, interior=?, dimension=?, skin=?, account=?, accountName=?" 
                        ,money 
                        ,occupation 
                        ,team 
                        ,wanted 
                        ,x 
                        ,y 
                        ,z 
                        ,interior 
                        ,dimension 
                        ,skin 
                        ,account 
                        ,accountname 
            ) 
         
    end 
end 
addEventHandler ( "onPlayerQuit", root, Save ) 

Edited by Guest
Link to comment
function saveonlogout(prevA) 
local player = getAccountPlayer(prevA) 
    local money = getPlayerMoney(prevA) 
    local occupation = getElementData(prevA, "Occupation") 
    local team = getPlayerTeam(prevA) 
    local teamname = getTeamName(prevA) 
    local x,y,z = getElementPosition(prevA) 
    local dimension = getElementDimension(prevA) 
    local interior = getElementInterior(prevA) 
    local skin = getElementModel(prevA) 
    local account = getPlayerAccount(prevA) 
    local accountname = getAccountName(prevA) 
    outputChatBox("You are logged out", prevA) 
    if money and occupation and team and x and y and z and dimension and interior and skin and teamname then 
        local savelocation = mysql_query(moduledb, "UPDATE 'playerlocations' SET x = '"..x.."', y = '"..y.."', z = '"..z.."' WHERE accountname = '"..accountname.."'") 
        local saveothers = mysql_query(moduledb, "UPDATE 'playerinfo' SET money = '"..money.."', occupation = '"..occupation.."', team = '"..teamname.."', dimension = '"..dimension.."', interior = '"..interior.."', skin = '"..skin.."' WHERE accountname = '"..accountname.."'") 
        --mysql_free_result(savelocation) 
        --mysql_free_result(saveothers) 
    else 
        outputChatBox("Error! Cannot save informations!", prevA)    
    end 
end 
addEventHandler("onPlayerLogout",getRootElement(),saveonlogout) 

Link to comment

What's that? prevA give's the account name lmfao. And Bilal you are getting it's account name? :o

  
function saveonlogout(prevA) 
    local player = source 
    local money = getPlayerMoney(player) 
    local occupation = getElementData(player, "Occupation") 
    local team = getPlayerTeam(player) 
    local teamname = getTeamName(player) 
    local x,y,z = getElementPosition(player) 
    local dimension = getElementDimension(player) 
    local interior = getElementInterior(player) 
    local skin = getElementModel(player) 
    local account = getAccount(prevA) 
    local accountname = getAccountName(account) 
    outputChatBox("You are logged out", player) 
    if money and occupation and team and x and y and z and dimension and interior and skin and teamname then 
        local savelocation = mysql_query(moduledb, "UPDATE 'playerlocations' SET x = '"..x.."', y = '"..y.."', z = '"..z.."' WHERE accountname = '"..accountname.."'") 
        local saveothers = mysql_query(moduledb, "UPDATE 'playerinfo' SET money = '"..money.."', occupation = '"..occupation.."', team = '"..teamname.."', dimension = '"..dimension.."', interior = '"..interior.."', skin = '"..skin.."' WHERE accountname = '"..accountname.."'") 
        --mysql_free_result(savelocation) 
        --mysql_free_result(saveothers) 
    else 
        outputChatBox("Error! Cannot save informations!", player)    
    end 
end 
addEventHandler("onPlayerLogout",getRootElement(),saveonlogout) 
  

Edited by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...