Jump to content

pa3ck

Members
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by pa3ck

  1. Data normalization is all about one thing, no duplicate data allowed. If you don't have duplicates and the tables are indexed properly, you're not querying useless information thus saving time and resources. "SELECT * FROM characters WHERE account_id = 2" -> returns all characters created by account number 2. You can also use join if you want to get data from both tables: "SELECT * FROM characters INNER JOIN accounts ON characters.accountID = accounts.accountID WHERE accounts.accountID = 2"
  2. 2 tables, account and character. Use primary key in account table that will reference the account a character is created from. Look at the term "1 to many relationship" to better understand. Account table should look something like this: accountID, username, password Character: characterID, accountID, health, skin, whatever Vehicles: vehicleID, characterID, model etc. That's the best way, this way your data is normalized.
  3. How far do you go? Do you go far enough to stream out the pickup?
  4. I don't think this event causes that issue, I mean why would onClientVehicleCollision interfere with other, onClientPedDamage or w/e events? Also you're checking if source ~= collider, that just doesn't make sense since before that you already checked if collider is a player, so how would a player ever be a vehicle?
  5. I see there's a 'LookNFeel' property for the CEGUI (from the wiki link) so I googled what it is actually and I found out that the design of the GUI elements can be changed with an XML file, although I'm not sure if this is possible in MTA, since I know there's an image file in the client which has all the GUI elements in one big image. Is it something that could/would be implemented in the future or is it available already? This would be such a huge improvement, we wouldn't need to use DX functions.. Source: http://static.cegui.org.uk/docs/0.8.0/fal_tut1.html
  6. I wouldn't use CEF for everything, it's all right for panels like login/registration, rules / help window etc.. but not for something that would actually get updated in onClientRender like hud elements etc..
  7. local timers = {} addEventHandler("onPlayerWasted",root,function() local thePlayer = source if isElement(thePlayer) then exports["rc_core"]:takeMoney(thePlayer,5000) skin = getElementModel(thePlayer) or 0 if isTimer(timers[thePlayer]) then killTimer(timers[thePlayer]) end timers[thePlayer] = setTimer(function() respawn(thePlayer) setElementModel(thePlayer, skin) end, 3000, 1) end end) addEventHandler("onPlayerQuit", root, function() if isTimer(timers[source]) then killTimer(timers[source]) end end)
  8. You're welcome. The problem was that you treated menuPlayers[ i ] as if it was a table already, but it wasn't.
  9. If it says isElementStreamedIn is nil, the script is deffo not set to client side
  10. Why do you have 2 onClientResourceStart events and have both of them replace the models at the same time? Did you try to put them all in just one single onClientResourceStart and loop through the tables (if you have multiple) after each other?
  11. I just looked at getRealTime(), there's a parameter called "local timezone", try to set it to true to see if that works for you: https://wiki.multitheftauto.com/wiki/GetRealTime
  12. That is why you are getting different results, the server is probably in a different timezone. If it's a VPS you're renting yourself, you can just change the timezone, if it's a game server you're renting, you'd need to manually add/remove hours every single time you use the getRealTime function.
  13. menuPlayers = {} for i = 1, #memberUsernames do menuPlayers[i] = {} menuPlayers[i].name = memberUsernames[i] menuPlayers[i].rank = memberRanks[i] menuPlayers[i].status = memberOnline[i] menuPlayers[i].lastlogin = memberLastLogin[i] menuPlayers[i].active = 0 end Try this
  14. Is it running on a hosted server or on your own local machine?
  15. ipairs loops through indexed tables only (in order), pairs loops through everything (random order.). Indexed table is when the key is a number ie. myTable[1] = "something" or there's no key (well, the key is a number by default..), non indexed when the key is not a number myTable["smt"] = "something".
  16. function destroyVIPHydra (veh) local accName = getAccountName ( getPlayerAccount ( source ) ) if accName and isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) and getElementModel(veh) == 520 then destroyElement(veh) outputChatBox("Your VIP Hydra has been destroyed..", source) end end addEventHandler("onPlayerVehicleExit", root, destroyVIPHydra) Try this, it should destroy the hydra when VIP players leave them.
  17. I don't see your triggerClientEvent which sends over the data, so I'll quickly write a piece of code to help you with it a little bit better, although I think I explained everything above.. local myGuiWindow, myGuiGrid function openGUI() myGuiWindow = guiCreateWindow() myGuiGrid = guiCreateGridlist(..., myGuiWindow) guiGridListAddColumn(myGuiGrid, "ID", 0.2) guiGridListAddColumn(myGuiGrid, "Name", 0.2) guiGridListAddColumn(myGuiGrid, "Rank", 0.2) guiGridListAddColumn(myGuiGrid, "IP Address", 0.2) triggerServerEvent("onClientRequestMyData", localPlayer, "fly") end addCommandHandler("open", openGUI) addEvent("onClientSendMyData", true) addEventHandler("onClientSendMyData", root, function(myData) if not guiGetVisible(myGuiWindow) then return end -- make sure it is open guiGridListClear(myGuiGrid) -- might need to clear it first for k, rows in ipairs(myData) do local row = guiGridListAddRow(myGuiGrid) guiGridListSetItemText(myGuiGrid, row, 1, rows["someId"], false, false) guiGridListSetItemText(myGuiGrid, row, 2, rows["someName"], false, false) guiGridListSetItemText(myGuiGrid, row, 3, rows["someRank"], false, false) guiGridListSetItemText(myGuiGrid, row, 4, rows["someIP"], false, false) end end) -- server addEvent("onClientRequestMyData", true) addEventHandler("onClientRequestMyData", root, function(someInfo) local q = dbQuery(connection, "SELECT * FROM somewhere-over-the-rainbow WHERE blue-birds = ?", someInfo) local r = dbPoll(q, -1) triggerClientEvent(client, "onClientSendMyData", client, r) end) Not tested, not a fully functional code (probably), should give you a brief idea. As I mentioned earlier, you might be better of binding the open command server side and only trigger once. But if you need some info from the client (as it is in the code), you can leave it client side, since you'd need to trigger from c to s anyway..
  18. pa3ck

    Download

    I quickly took a look at it, it uses XML to save which mod should be downloaded. Override the function that load's the XML to always have it enabled - cMods.lua btw.
  19. Save the timers in a table and set the key to be the player element. When onPlayerQuit fires, check if there's a timer in the table using the source as the key, if so, use killTimer()
  20. It does not work, you can use setPedAnalogControlState with stuff like movement etc, but not for enter_exit. I had to create myself the animations then warpPedIntoVehicle, 2 animations afaik because there's one to open the door and then one to actually enter the car.. Also this:
  21. No, it's not like a while true do loop, it is a repeat until true - as soon as it's true, it will end. I think the player element was the problem as well, when the setTimer fired, the source was no longer available, so declaring thePlayer as source should work.
  22. What are you on about like..? How would that be infinite loop, spawnPlayer returns true, so as soon as it spawns the player, it will be terminated, but actually it's not needed anyway, since there's nothing between repeat and until - which is basically the body of the repeat function... You should look up how stuff work before educating others, setTimer(setElementModel, 5000, 1, source, 200) is perfectly valid, since after the '1' (number of times the timer should run) you can pass arguments into the setElementModel function...
  23. Can you please also include code, because I'm pretty sure you can't use that, I assume you tried it and it worked?
  24. If you mean with animation and all, no, you can only use removePedFromVehicle
×
×
  • Create New...