-
Posts
243 -
Joined
-
Last visited
Everything posted by Desaster
-
hmmm so this what I made but won't work again ... the problem is that it can't find the row I think pls check it and tell me what's the problem addEventHandler ( 'onPlayerLogin', root, function ( ) --[[setElementData ( source, 'Balance', 0 ) local account = getAccountName(getPlayerAccount ( source )) local TBSTable = executeSQLQuery ( 'SELECT * FROM banking' ) if #TBSTable > 0 then for i = 1, #TBSTable do local TBS = { TBSTable[i]['account'], TBSTable[i]['balance'] } if account == tostring( TBS[1] ) then setElementData ( source, 'Balance', tonumber( TBS[2] ) ) else return end end end]] local account = getAccountName(getPlayerAccount ( source )) local balanceCheck = executeSQLQuery( "SELECT balance FROM banking WHERE account = ?", account ) setElementData ( source, 'Balance', tonumber( balanceCheck ) ) end ) ps : that thing between --[[ ]] won't work because idk why it work just with 1 acc if you create more it won't work then
-
that seems logic thnx but idk why the row won't be created when the player presses a deposit button for the first time can you help me the code that gave me Courtez ( the update work but when I try an other acc it won't work ) I tryed this but it won't work too check it may you find the error addEvent ( 'onBalanceDeposit', true ) addEventHandler ( 'onBalanceDeposit', root, function ( amount ) local balance = getElementData ( source, 'Balance' ) local account = getAccountName(getPlayerAccount ( source )) takePlayerMoney ( source, amount ) setElementData ( source, 'Balance', balance + amount ) if executeSQLQuery( "SELECT balance FROM banking WHERE account = ?", account ) then executeSQLQuery ( "UPDATE banking SET balance = ? WHERE account = ?", balance + amount, account ) else executeSQLQuery("INSERT INTO banking SET account = ?", account) exports["TopBarChat"]:sendClientMessage ( "Seems you didn't had a back account, we created one for you!",source,255,0,0,TopBar, 5 ) end end )
-
ah and what is INTENGER PRIMERY KEY I know it's a type to give each row a number but how to use it and what is it useful ?
-
how to check if the row exist ?
-
hello I have tryed on a bank system but my problem is that every time the player quits a new row with his name get created I want to create just 1 one and just update the ammount of money pls help me Image: server Side: getPlayers = getElementsByType ( 'player' ) addEventHandler ( 'onResourceStart', resourceRoot, function ( ) for _,p in next, getPlayers do setElementData ( p, 'Balance', 0 ) end executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS banking ( account, balance )' ) startTBS ( ) end ) function startTBS ( ) local TBSTable = executeSQLQuery ( 'SELECT * FROM banking' ) if #TBSTable > 0 then for i = 1, #TBSTable do local TBS = { TBSTable[i]['account'], TBSTable[i]['balance'] } for _,p in next, getPlayers do local account = getAccountName(getPlayerAccount ( p )) if account == tostring( TBS[1] ) then setElementData ( p, 'Balance', tonumber( TBS[2] ) ) end end end end addEventHandler ( 'onPlayerJoin', root, function ( ) setElementData ( source, 'Balance', 0 ) local account = getAccountName(getPlayerAccount ( source )) local TBSTable = executeSQLQuery ( 'SELECT * FROM banking' ) if #TBSTable > 0 then for i = 1, #TBSTable do local TBS = { TBSTable[i]['account'], TBSTable[i]['balance'] } if account == tostring( TBS[1] ) then setElementData ( source, 'Balance', tonumber( TBS[2] ) ) else return end end end end ) addEvent ( 'onBalanceWithdraw', true ) addEventHandler ( 'onBalanceWithdraw', root, function ( amount ) local balance = getElementData ( source, 'Balance' ) givePlayerMoney ( source, amount ) setElementData ( source, 'Balance', balance - amount ) end ) addEvent ( 'onBalanceDeposit', true ) addEventHandler ( 'onBalanceDeposit', root, function ( amount ) local balance = getElementData ( source, 'Balance' ) takePlayerMoney ( source, amount ) setElementData ( source, 'Balance', balance + amount ) end ) addEventHandler ( 'onPlayerQuit', root, function ( ) local account = getAccountName(getPlayerAccount ( source )) local balance = getElementData ( source, 'Balance' ) executeSQLQuery ( 'INSERT INTO banking ( account, balance ) VALUES ( ?, ? )', account, balance ) end )
-
yup that's it but how it work then ??
-
well idk how to make it I tryed sth but it won't work here is my code help me function guiClick1 ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if (source == withraw) then local r, g, b = 0, 255, 0 removeEventHandler("onClientRender", getRootElement(), chadi) guiSetVisible ( edit, false ) showCursor ( false ) end end addEventHandler ( "onClientClick", getRootElement(), guiClick1 )
-
do you know when I use setAccountData where does it save I mean in wish file it saves example : SQLite save in registry.db
-
but the ped is in a vehicle when he touches the marke
-
First , I removed the hud and the most of the stealed resources I made my own check if you want Second , I mean when you compile your resources with any compile methode except mta one you get a WARNING that it may not work in future versions and I think MTA team should remove it
-
well I am not pro in error tanslating so what mean these following errors ??? [2013-11-04 01:39:46] WARNING: test\s.lua:62: Bad 'ped' pointer @ 'getPedOccupiedVehicle'(1) [2013-11-04 01:39:46] WARNING: test\s.lua:63: Bad argument @ 'getElementHealth' [Expected element at argument 1, got boolean] [2013-11-04 01:39:46] ERROR: test\s.lua:63: attempt to perform arithmetic on a boolean value especially the last one !! thnx for reading
-
I fully agree to you guys ! the compiling should be optinal
-
will be nice if you make a IG editor ^^
-
hello, I saw this and IDK how to use it is it a MTA function or I must write the code written there https://wiki.multitheftauto.com/wiki/On ... WeaponFire thnx for support
-
lol I was so tired that I thought one time I am in server and one Time I was in client lol (in real it's client )
-
my problem I can't pay . I have the money but I can't pay
-
yup I did that but still not work I see the dancing camera the problem is that it set the camera matrix correct then I see that dancing camera got it ?
