Jump to content

Desaster

Members
  • Posts

    243
  • Joined

  • Last visited

Everything posted by Desaster

  1. 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
  2. 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 )
  3. Desaster

    Converter

    hi guys do you know a converter that transform .map files to .lua files with createObject ??
  4. 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 ?
  5. how to check if the row exist ?
  6. 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 )
  7. yup that's it but how it work then ??
  8. 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 )
  9. Desaster

    Dx button

    There is. You have to kinda make it yourself though with dxDrawRectangle and onClientClick. I think I'll do this . anyways thnx all for anwering when I have any other question I'll reply it here
  10. Desaster

    Dx button

    hello , I was thinking to make a DX button with a DX rectangle but how to get when a player clic on the dxrec and when the cursor is on the render to change it's color
  11. do you know when I use setAccountData where does it save I mean in wish file it saves example : SQLite save in registry.db
  12. but the ped is in a vehicle when he touches the marke
  13. 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
  14. 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
  15. I fully agree to you guys ! the compiling should be optinal
  16. Desaster

    functions

    I am planning to do something can you suggest me some function that get 5 random players every 3h thnx
  17. will be nice if you make a IG editor ^^
  18. Desaster

    useful func

    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
  19. 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 )
  20. Desaster

    Host needed

    my problem I can't pay . I have the money but I can't pay
  21. Desaster

    kill cam

    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 ?
×
×
  • Create New...