Jump to content

SQLite updating problems


Baseplate

Recommended Posts

addEventHandler ("onResourceStart", root, 
function() 
executeSQLQuery("CREATE TABLE IF NOT EXISTS players(account STRING, skin STRING, x STRING, y STRING, z STRING, int STRING, dim STRING, wanted STRING, money STRING, occupation STRING, team STRING)") 
executeSQLQuery("CREATE TABLE IF NOT EXISTS weapons(account STRING,playerWeaponID0 STRING,playerWeaponID1 STRING,playerWeaponID2 STRING,playerWeaponID3 STRING,playerWeaponID4 STRING,playerWeaponID5 STRING,playerWeaponID6 STRING,playerWeaponID7 STRING,playerWeaponID8 STRING,playerWeaponID9 STRING,playerWeaponID10 STRING,playerWeaponID11 STRING,playerWeaponID12 STRING,playerWeaponAmmo0 STRING,playerWeaponAmmo1 STRING,playerWeaponAmmo2 STRING,playerWeaponAmmo3 STRING,playerWeaponAmmo4 STRING,playerWeaponAmmo5 STRING,playerWeaponAmmo6 STRING,playerWeaponAmmo7 STRING,playerWeaponAmmo8 STRING,playerWeaponAmmo9 STRING,playerWeaponAmmo10 STRING,playerWeaponAmmo11 STRING,playerWeaponAmmo12 STRING,pistolstat STRING,silencedstat STRING,desertstat STRING,shotgunstat STRING,sawnoffstat STRING,spazstat STRING,microstat STRING,mp5stat STRING,akstat STRING,m4stat STRING,sniperstat STRING)") 
end 
) 
function saveThings() 
    local acc = getAccountName(getPlayerAccount(source)) 
    local x, y, z = getElementPosition(source) 
    --Weps 
    executeSQLQuery("UPDATE weapons SET playerWeaponID0=? WHERE account=?", getPedWeapon(source,0), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID1=? WHERE account=?", getPedWeapon(source,1), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID2=? WHERE account=?", getPedWeapon(source,2), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID3=? WHERE account=?", getPedWeapon(source,3), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID4=? WHERE account=?", getPedWeapon(source,4), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID5=? WHERE account=?", getPedWeapon(source,5), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID6=? WHERE account=?", getPedWeapon(source,6), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID7=? WHERE account=?", getPedWeapon(source,7), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID8=? WHERE account=?", getPedWeapon(source,8), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID9=? WHERE account=?", getPedWeapon(source,9), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID10=? WHERE account=?", getPedWeapon(source,10), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID11=? WHERE account=?", getPedWeapon(source,11), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponID12=? WHERE account=?", getPedWeapon(source,12), acc) 
    --Wep Ammo 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo0=? WHERE account=?", getPedTotalAmmo(source, 0), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo1=? WHERE account=?", getPedTotalAmmo(source, 1), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo2=? WHERE account=?", getPedTotalAmmo(source, 2), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo3=? WHERE account=?", getPedTotalAmmo(source, 3), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo4=? WHERE account=?", getPedTotalAmmo(source, 4), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo5=? WHERE account=?", getPedTotalAmmo(source, 5), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo6=? WHERE account=?", getPedTotalAmmo(source, 6), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo7=? WHERE account=?", getPedTotalAmmo(source, 7), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo8=? WHERE account=?", getPedTotalAmmo(source, -- s8) -->, acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo9=? WHERE account=?", getPedTotalAmmo(source, 9), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo10=? WHERE account=?", getPedTotalAmmo(source, 10), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo11=? WHERE account=?", getPedTotalAmmo(source, 11), acc) 
    executeSQLQuery("UPDATE weapons SET playerWeaponAmmo12=? WHERE account=?", getPedTotalAmmo(source, 12), acc) 
    --Wep Stats 
    executeSQLQuery("UPDATE weapons SET pistolstat=? WHERE account=?", getPedStat(source,69), acc) 
    executeSQLQuery("UPDATE weapons SET silencedstat=? WHERE account=?", getPedStat(source,70), acc) 
    executeSQLQuery("UPDATE weapons SET desertstat=? WHERE account=?", getPedStat(source,71), acc) 
    executeSQLQuery("UPDATE weapons SET shotgunstat=? WHERE account=?", getPedStat(source,72), acc) 
    executeSQLQuery("UPDATE weapons SET sawnoffstat=? WHERE account=?", getPedStat(source,73), acc) 
    executeSQLQuery("UPDATE weapons SET spazstat=? WHERE account=?", getPedStat(source,74), acc) 
    executeSQLQuery("UPDATE weapons SET microstat=? WHERE account=?", getPedStat(source,75), acc) 
    executeSQLQuery("UPDATE weapons SET mp5stat=? WHERE account=?", getPedStat(source,76), acc) 
    executeSQLQuery("UPDATE weapons SET akstat=? WHERE account=?", getPedStat(source,77), acc) 
    executeSQLQuery("UPDATE weapons SET m4stat=? WHERE account=?", getPedStat(source,78), acc) 
    executeSQLQuery("UPDATE weapons SET sniperstat=? WHERE account=?", getPedStat(source,79), acc) 
    --Players 
    executeSQLQuery("UPDATE players SET skin=? WHERE account=?", getElementModel(source), acc) 
    executeSQLQuery("UPDATE players SET x=? WHERE account=?", x, acc) 
    executeSQLQuery("UPDATE players SET y=? WHERE account=?", y, acc) 
    executeSQLQuery("UPDATE players SET z=? WHERE account=?", z, acc) 
    executeSQLQuery("UPDATE players SET int=? WHERE account=?", getElementInterior(source), acc) 
    executeSQLQuery("UPDATE players SET dim=? WHERE account=?", getElementDimension(source), acc) 
    executeSQLQuery("UPDATE players SET wanted=? WHERE account=?", getPlayerWantedLevel(source), acc) 
    executeSQLQuery("UPDATE players SET money=? WHERE account=?", getPlayerMoney(source), acc) 
    executeSQLQuery("UPDATE players SET occupation=? WHERE account=?", getElementData(source, "Occupation"), acc) 
    executeSQLQuery("UPDATE players SET team=? WHERE account=?", getTeamName(getPlayerTeam(source)), acc) 
end 
addEventHandler("onPlayerLogout", root, saveThings) 

I'm currently experiencing some problems with this script, it does update the weapons and weapons stats, but it doesn't update the players table...

Please note, that this is only a part of the script, I didn't want to post the full code and there is no errors on debugscript.

Link to comment
executeSQLQuery("UPDATE players SET skin=?, x=?, y=?, z=?, int=?, dim=?, wanted=?, money=?, occupation=?, team=? WHERE account=?", getElementModel(source), x, y, z, getElementInterior(source), getElementDimension(source), getPlayerWantedLevel(source), getPlayerMoney(source), getElementData(source, "Occupation"), getTeamName(getPlayerTeam(source)), acc) 

Nothing happens..

Link to comment
executeSQLQuery("UPDATE players SET skin=?, x=?, y=?, z=?, int=?, dim=?, wanted=?, money=?, occupation=?, team=? WHERE account=?", getElementModel(source), x, y, z, getElementInterior(source), getElementDimension(source), getPlayerWantedLevel(source), getPlayerMoney(source), getElementData(source, "Occupation"), getTeamName(getPlayerTeam(source)), acc) 

Nothing happens..

What does that mean?

Link to comment
executeSQLQuery("UPDATE players SET skin=?, x=?, y=?, z=?, int=?, dim=?, wanted=?, money=?, occupation=?, team=? WHERE account=?", getElementModel(source), x, y, z, getElementInterior(source), getElementDimension(source), getPlayerWantedLevel(source), getPlayerMoney(source), getElementData(source, "Occupation"), getTeamName(getPlayerTeam(source)), acc) 

Nothing happens..

What does that mean?

I didn't get your point...

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