Jump to content

monday

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by monday

  1. Hmm, thanks. Btw is there any way to make it "_Data" instead of "playerData"? Something like: _data = dbPoll (queryHandle, 10) So later in the script I could add some stat for a specific player like: AntonioBanderas_data[1].Attack + 1
  2. Hi, my aim is to use SQLite to store+load the data for each player but i'm not sure about few things. The first one is: 1. Is it alright to save the data to .db file every time the value changes? Or it would be laggy and it's better to update the values in another table + save them to .db file only when the player is disconnecting? If the second option is better I have another question: 2. How can I convert SQLite table to a normal table with a custom name based on player's name? Something like: function Login(_thePreviousAccount, _theCurrentAccount) accountName = getAccountName(_theCurrentAccount) local connection = dbConnect ("sqlite" , "database.db") local queryHandle = dbQuery (connection , "SELECT * FROM '??'", accountName) playerData = dbPoll (queryHandle, -1) (string.format("%s", accountName.."_data")) = {playerData} addEventHandler("onPlayerLogin", getRootElement(), Login) My plan is to reach the data for specific player at any stage of the script by something like: AntonioBanderas_data.Attack + 1 Please let me know if there's any more simple way to do it or if I made any mistake other than the (string.format) thing in the script above, I'm at early-learning stage so any advice would be appreciated. Thanks in advance
  3. monday

    [TUT] SQLite

    By the way, what is more efficient, having one database file with a lot of tables/columns or having a lot of small database files with only few tables/columns? Or it doesn't make any big difference?
  4. monday

    [TUT] SQLite

    Hi, is it necessary to download something to use SQLite thing or it's somehow built in and all I have to do is to make the correct script?
  5. Thank you both, the code by ALw7sH works well
  6. Hi, my aim is to: -assign a ped to a specific player (so I could use a command like "/pedRemoveFromPlayer Antonio_Banderas") -be able to destroy/manipulate any ped from a bunch of them as if they had an ID I don't know if there's a simple way to do it so any advice would be appreciated. I tried to do it my own way by creating a ped with a name made of the Player's name + a number but it doesn't work. Here's the code I used: function AddPed(_thePlayer) local x, y, z = getElementPosition(_thePlayer); x = x + math.sin(math.rad(getElementRotation(_thePlayer))) * 2 y = y - math.cos(math.rad(getElementRotation(_thePlayer))) * 2 --thePed = createPed (math.random(10, 270), x, y, z) pedID = pedID + 1 string.format(getPlayerName(_thePlayer) .. pedID) = createPed (math.random(10, 270), x, y, z) --That's the line where the error occurs end addCommandHandler ("ped", AddPed) The error I received is: ERROR: Loading script failed: server.lua:68: unexpected symbol near '=' (68th line is the 7th line of the code posted above) Thanks in advance
  7. Oh, thanks, I used setPedAnimation instead:)
  8. Hi, I encountered a problem with setPedAnalogControlState while trying to make the ped walking forward. That's the code I used: function pedrespawn(pedID) if (isPedDead(pedID)) then destroyElement(pedID) ped1 = createPed (120, 2495.55, -1665.46, 14) setPedRotation(ped1, 270) setPedAnalogControlState(ped1, 'walk', 1) ----[b][u]This line displays the error message[/u][/b] end end function timerrespawn() --int totalAmmo, element killer, int killerWeapon, int bodypart, bool stealth setTimer(pedrespawn, 2000, 1, source) end addEventHandler ("onPedWasted", getRootElement(), timerrespawn) The ped is standing still and the error message is displayed The message is - ERROR: server.lua:35: attemt to call global 'setPedAnalogControlState' (35th line is the one marked as 7th in the code I posted) I was looking for a fix at mta's wiki, google and this forum but can't find a reason for this error and solution. Thanks in advance for any advice.
×
×
  • Create New...