mjau Posted March 14, 2012 Share Posted March 14, 2012 hi i have made a small sqlite script just to practice on it so i use the exported functions now my problem is im trying to save a skin id somone chooses from my skin selector my sql code so far function createSQLTableOnStart() executeSQLCreateTable("players", "accName, bankMoney, clothes, x, y, z") end addEventHandler("onPlayerJoin", getRootElement(), createSQLTableOnStart) function addPlayerToSQLDatabase(accountName) return executeSQLInsert("players", "'"..accountName.."', '20000', '0', '1644', '-2245', '14'") end function removePlayerFromSQLDatabase(accoutName) return executeSQLDelete("players", "accName = '"..accountName.."'") end function getCurrentClothes(accountName) local clothes = executeSQLSelect("players", "clothes", "accName = '"..accountName.."'") return clothes[1]['clothes'] end function newClothes(accountName, clothes) return executeSQLUpdate("players", "clothes = '"..clothes.."'", "accName = '"..accountName.."'") end function getSQLCordinates(accountName) local x, y, z = executeSQLSelect("players", "clothes", "accName = '"..accountName.."'") end function updateSQLCordinates(accountName, x, y, z) return executeSQLUpdate("players", "x = '"..x.."', y = '"..y.."', z = '"..z.."'", "accName = '"..accountName.."'") end function getBankMoney(acccountName) local money = executeSQLSelect("players", "bankMoney", "accName = '"..accountName.."'") return money[1]['money'] end function depositMoney(accountName, amount) local currentMoney = executeSQLSelect("players", "bankMoney", "accName = '"..accountName.."'") local realMoney = currentMoney[1]['currentMoney'] local newMoney = realMoney + amount return executeSQLUpdate("players", "bankMoney = '"..newMoney.."'", "accName = '"..accountName.."'") end function withdrawMoney(accountName, amount) local currentMoney = executeSQLSelect("players", "bankMoney", "accName = '"..accountName.."'") local realMoney = currentMoney[1]['currentMoney'] local newMoney = realMoney - amount return executeSQLUpdate("players", "bankMoney = '"..newMoney.."'", "accName = '"..accountName.."'") end now when i do this function skinSet(skin) local account = getPlayerAccount(source) local accountName = getAccountName(account) exports["SQL"]:newSkin(accountName, skin) spawnPlayer (source, -1977.9189453125, 292.9345703125, 35.171875, 270.21560668945, skin) setCameraTarget(source, source) triggerClientEvent ("hideSkinSelector", getRootElement()) end addEvent("setSkin", true) addEventHandler("setSkin", getRootElement(), skinSet) i get this error ERROR: call: failed to call 'SQL:newSkin' [string "?"] i open the database with sqlbrowser and the table is there and everything is as it should be exept the clothes collumn wich says its at 0 when the id i chose from skin selector was something else... Link to comment
Kenix Posted March 14, 2012 Share Posted March 14, 2012 You exported function newSkin in resource SQL?( did you add to meta.xml ? ) Link to comment
mjau Posted March 14, 2012 Author Share Posted March 14, 2012 <meta> <info author='Kimmis9' version='1.0.0' name='SQL' description='SQL' type='script' /> <script src='main_S.lua' /> <export function="addPlayerToSQLDatabase" type="server"/> <!--Arguments(accountName) --> <export function="removePlayerFromSQLDatabase" type="server"/> <!--Arguments(accountName) --> <export function="getCurrentClothes" type="server"/> <!--Arguments(accountName) --> <export function="newClothes" type="server"/> <!--Arguments(accountName, newClothes) --> <export function="getBankMoney" type="server"/> <!--Arguments(accountName) --> <export function="depositMoney" type="server"/> <!--Arguments(accountName, amount) --> <export function="withdrawMoney" type="server"/> <!--Arguments(accountName, amount) --> <export function="getSQLCordinates" type="server"/> <!--Arguments(accountName) --> <export function="updateSQLCordinates" type="server"/> <!--Arguments(accountName, x, y, z) --> </meta> Link to comment
Kenix Posted March 14, 2012 Share Posted March 14, 2012 You not exported function newSkin in meta.xml. Link to comment
mjau Posted March 14, 2012 Author Share Posted March 14, 2012 LOoool i mixed newSkin and newClothes tnx Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now