Jump to content

koragg

Members
  • Posts

    730
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by koragg

  1. Well I did this: function :~(player) local currentMap = exports.mapmanager:getRunningGamemodeMap() local mapName = getResourceName(currentMap) local sql = executeSQLQuery("SELECT * FROM mapinterims WHERE mapname = ?", mapName) myDisplay = textCreateDisplay() textDisplayAddObserver(myDisplay, player) myTextItem = textCreateTextItem(inspect(sql), 0.5, 0.30, "high", 230, 0, 0, 255, 4.0, "center", "center" ) textDisplayAddText(myDisplay, myTextItem) end addCommandHandler(":~", :~) And all I got were one pair of curly brackets {} on my screen. No table, no nothing :\
  2. First of all, stop spamming with the same topic more than once. Second, really?? This is a scripting forum. You make something but it doesn't work, you can ask for help. If you're searching for a mta mod i suggest you look on the community site. Note: keep in mind that single player SA uses the cleo scripting language while mta uses lua - nothing in common between the two. What's possible in single player is not always possible in multilayer due to cleo being a deeper language compared to lua.
  3. I should first use fileOpen(registry.db) and then use inspect with that^ ? Or just inspect("mapinterims") ?
  4. koragg

    Team System

    Best way to learn is by trying, not watching Sure you can post here but I'm pretty sure that I won't be able to help you with it I've had a look and it's a lot of work plus I'm really bad with SQLite and MySQL.
  5. koragg

    Team System

    I don't think that there's a resource like that already made. However you can research this one and try to edit some parts so that the /invite nick system works. https://github.com/JarnoVgr/Mr.Green-MTA-Resources/tree/master/resources/[gameplay]/gcshop/teams It also has a panel from which you can see all teams, people in your team, who created the team and who is the leader (leader can change via command). But you'd need to edit it a lot as it's made for another server and won't just work for you as it is. Nevertheless i guess it's better than nothing so good luck
  6. There are 3 more folders in that folder: - global - other - system And there is a registry.db file in both 'global' and 'other'. And idk how to open db files
  7. I have no idea how to even see tables... But the code you did works, I just need to make a condition that if a toptime made by the specified player is not a top1 then it won't delete that map's delay. And idk how to make this condition*
  8. It works but is a bit bugged. If I have a toptime at position other than 1 on some maps and I delete all of my toptimes it still deletes the delays on those maps, although they weren't made by me :\ How to check if each and every one of my toptimes is a top1? If it is, delete delays on those maps, otherwise do nothing regarding delays.
  9. Yep [2017-04-27 10:36:39] Delay times for [SiK]Megas deleted! But I'm not even sure if I'm doing it the right way, as I wanna delete the delays only on maps on which the nickname (in this case me) has a top1, if not - don't touch as that would delete another player's delay times.
  10. I actually did this right before reading your reply Worked, but now I got other stuff that need deleting along with this. When a player makes a toptime at position 1 his time gets recorded in 'mapinterims'. So the next time the map is played, whoever is first sees text like +0:00:34 for example, which shows how far away he is from beating the top1 time. I need to delete this delay text along with the toptimes ONLY IF the toptime is a top1. I tried something like this but didn't work (line 30 until 34): function delAllTopsOfPlayer(player, command, name) local accountName = getAccountName(getPlayerAccount(player)) if isGuestAccount (getPlayerAccount(player)) or not (isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) or isObjectInACLGroup("user."..accountName, aclGetGroup("SuperModerator"))) then return end if not name then outputChatBox("You must specify a player name in order to delete all of their toptimes!", player, 255, 0, 0, true) return end local otherPlayer = string.lower(name) local otherPlayerName local rname local map_names = {} for k, v in ipairs(exports.mapmanager:getMapsCompatibleWithGamemode(getResourceFromName('race'))) do rname = getResourceName(v) local mode = 'Sprint' map_names['race maptimes '..mode..' ' .. (getResourceInfo(v, 'name' ) or getResourceName(v))] = v end local maps_table = executeSQLQuery("SELECT tbl_name FROM sqlite_master WHERE tbl_name LIKE 'race maptimes %' ") for k, v in ipairs(maps_table) do local mapTable = v.tbl_name if map_names[mapTable] then local mapTimes = executeSQLQuery("SELECT playerName FROM ?", mapTable) for i, t in ipairs(mapTimes) do if getAccount(t.playerName) then if string.lower(getAccountData(getAccount(t.playerName), "currentPlayerName"):gsub( '#%x%x%x%x%x%x', '' )) == otherPlayer:gsub( '#%x%x%x%x%x%x', '' ) then otherPlayerName = getAccountData(getAccount(t.playerName), "currentPlayerName") executeSQLQuery("DELETE FROM ? WHERE playerName=?", mapTable, t.playerName) outputServerLog("Toptimes of "..otherPlayerName:gsub( '#%x%x%x%x%x%x', '' ).." deleted!") local delays = executeSQLQuery("SELECT * FROM mapinterims WHERE mapname = ?", rname) if #delays > 0 then executeSQLQuery("DELETE FROM mapinterims WHERE mapname=?", rname) outputServerLog("Delay times for "..otherPlayerName:gsub( '#%x%x%x%x%x%x', '' ).." deleted!") end end end end end end if otherPlayerName then outputChatBox("#FF0000All of #FFFFFF"..otherPlayerName.."#FF0000's toptimes were deleted!" , root, 255, 0, 0, true) else outputChatBox("No such player name found in toptimes database.", p, 255, 0, 0, true) end end addCommandHandler("deletealltimes", delAllTopsOfPlayer) addCommandHandler("deletealltops", delAllTopsOfPlayer) addCommandHandler("delalltimes", delAllTopsOfPlayer) addCommandHandler("delalltops", delAllTopsOfPlayer) PS: This is how I made it work for current map only with the command /deletedelay which I trigger with the /deletetime 1 command. I tried using it as an example but since I'm not sure what I'm doing I decided to post here function deleteTimeDelay(player) local currentMap = exports.mapmanager:getRunningGamemodeMap() local mapName = getResourceName(currentMap) local sql = executeSQLQuery("SELECT * FROM mapinterims WHERE mapname = ?", mapName) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) or isObjectInACLGroup("user."..accName, aclGetGroup("SuperModerator")) then if #sql > 0 then executeSQLQuery("DELETE FROM mapinterims WHERE mapname=?", mapName) outputServerLog("Delay time for "..mapName.." deleted!") end end end addCommandHandler("deletedelay", deleteTimeDelay)
  11. I saved the account name and i made it display the player's most current nickname saved as account data. And when i write /delalltops nick it would have to search for his nickname, not account. So if there's a player with account name "Brian" and nickname "Racer45", when i write /deletealltops Racer45 it would delete all toptimes of the player. But if for example he changes his nickname to "Drifter58" then I'd have to type /delalltops Drifter58 in order to delete his toptimes.
  12. Hey fellas, I kinda need a script which would delete all of a specified player's toptimes with the command "/deletealltops nickname" but I'm having some trouble getting it to work. function delAllTopsOfPlayer(player, command, name) if isGuestAccount (getPlayerAccount(player)) then return end if not name then outputChatBox("You must specify a player name in order to delete all of their toptimes!", player, 255, 0, 0, true) return end local otherPlayer = string.lower(name) local otherPlayerName local map_names = {} for k, v in ipairs(exports.mapmanager:getMapsCompatibleWithGamemode(getResourceFromName('race'))) do local rname = getResourceName(v) local mode = 'Sprint' map_names['race maptimes '..mode..' ' .. (getResourceInfo(v, 'name' ) or getResourceName(v))] = v end local maps_table = executeSQLQuery("SELECT tbl_name FROM sqlite_master WHERE tbl_name LIKE 'race maptimes %' ") for k, v in ipairs(maps_table) do local mapTable = v.tbl_name if map_names[mapTable] then local mapTimes = executeSQLQuery("SELECT playerName FROM ?", mapTable) for i, t in ipairs(mapTimes) do if getAccount(t.playerName) then if string.lower(getAccountData(getAccount(t.playerName), "currentPlayerName"):gsub( '#%x%x%x%x%x%x', '' )) == otherPlayer:gsub( '#%x%x%x%x%x%x', '' ) then otherPlayerName = getAccountData(getAccount(t.playerName), "currentPlayerName") executeSQLQuery("DELETE FROM ? WHERE playerName=?", mapTable, otherPlayer) end end end end end if otherPlayerName then outputChatBox("#FF0000All of #FFFFFF"..otherPlayerName.."#FF0000's toptimes were deleted!" , root, 255, 0, 0, true) end end addCommandHandler("deletealltimes", delAllTopsOfPlayer) addCommandHandler("deletealltops", delAllTopsOfPlayer) addCommandHandler("delalltimes", delAllTopsOfPlayer) addCommandHandler("delalltops", delAllTopsOfPlayer) I tried adding an "outputChatBox("1")" right after the line: "executeSQLQuery("DELETE FROM ? WHERE playerName=?", mapTable, otherPlayer)" and indeed it showed as many 1s as all of my toptimes were (I have a show toptimes script, that's how I know how many tops I have, then I copied the 1s in MS Word and used Word Count to get their number.). So, there are no errors in debug, everything else works as it should and the final chatbox message displays that all of the player's tops were deleted, yet they remain untouched. Any help with this? I guess I'm using the 'DELETE' parameter wrong or maybe some table, don't know really...
  13. I have a question about updating my Linux server as I'm a bit confused. To my knowledge Linux uses .so files and Windows uses .dll for MTA's libraries. My server is hosted on a 32-bit Linux machine but the only .so file is the ml_sockets.so. Everything else is .dll as you will see in the screenshot below. So, should I update as if my server is on Windows or what?
  14. For my server I still prefer IRC over Discord bots but for general stuff Discord is better.
  15. It's best if you create a custom handling for each vehicle that you want to change it on because as @Dutchman101 already said: each vehicle reacts differently to the same value of acceleration.
  16. According to wiki using the 'refresh' command only searches for new resources to add or deletes ones which aren't there anymore. Using the 'refresh all' command restarts changed resources and also does everything that the 'refresh' command does. https://wiki.multitheftauto.com/wiki/Server_Commands#refresh But i always restart each resource manually after changing something in it just to be sure + some resources actually require to be restarted manually for changes to apply.
  17. Well it's not private (anymore) but I got just 3 admins, out of which 2 helped me with fixing bugs (they needed /debugscript 3) and aren't active at all and another is a friend of mine who just wanted to be able to set maps and a bit more. I've given moderator access to a bunch of people but my ACL allows mods to only /redo, /random and /votemap so I guess I shouldn't really worry for now. Thanks for the info though, as if there come more players maybe I'd need to secure it further. Note: When I say 'admins' above I mean SuperModerators with all access an admin has except that to the Server and Resources tabs in the admin panel.
  18. Is this really necessary on a race server? I just use element data to sync the vehicle's speed, gears, nitro level, etc with all players (while spectating a player it will show his values instead of yours or 0s).
  19. Why don't you just use the outputChatBox client side? It's totally pointless to use triggers for this
  20. I can say from personal experience that using element data the correct way doesn't make any noticeable lag. I use it whenever i need to sync small pieces of data with other players. I've also used it with onClientRender a few times and it works flawlessly. It's fine to use element data as long as you store small data in it, but if you want to store huge amounts of data then tables is the way to go.
  21. Nevermind, my first approach was totally wrong. I fixed it with the code below, just had to see how it was deleted in another function in that resource. function deleteTimeDelay(player) local currentMap = exports.mapmanager:getRunningGamemodeMap() local mapName = getResourceName(currentMap) local sql = executeSQLQuery("SELECT * FROM mapinterims WHERE mapname = ?", mapName) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) or isObjectInACLGroup("user."..accName, aclGetGroup("SuperModerator")) then if #sql > 0 then executeSQLQuery("DELETE FROM mapinterims WHERE mapname=?", mapName) outputServerLog("Delay time for "..mapName.." deleted!") end end end addCommandHandler("deletedelay", deleteTimeDelay) Guess MySQL isn't that hard after all
  22. It is defined in the file i mentioned. Can't i use it like that if it's defined and used in other places in the script?
  23. Hey everyone, I need a bit of help with deleting the delay time from top1 on a map shown by the race_delay_indicator with a simple command. I tried putting this in the 'delayindicator_server.lua' file but it said that 'allCpTimes' is nil or something. function deleteTimeDelay(player) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) or isObjectInACLGroup("user."..accName, aclGetGroup("SuperModerator")) then local sql = executeSQLQuery("SELECT * FROM mapinterims WHERE mapname = ?", mapName) local interims = table.concat(allCpTimes[source], ",") if #sql > 0 then executeSQLQuery("DELETE FROM mapinterims WHERE interims=?", interims) end end end addCommandHandler("deletedelay", deleteTimeDelay) Can someone edit that^ function so that when I do the command the top1 delay time would get deleted? MySQL is really confusing to me and I'm kind of scared to try things as I may completely bug my server if I don't know what I'm doing So, please, someone help
  24. setElementData is used for "storing" little insignificant to the server data temporarily. An example: You want people to be able to buy a map only after they win one first. You set element data when they win and then check if it's true. If so they can buy a map. And when someone else wins you set the element data for theprevious winner to nil. I don't care about security and I'm sure that there are a thousand better ways to do the above but for me if it works it's fine. Just a quick example. And about sql idk anything but it's used for storing data like total wins, map starts, coins etc. Has similar effect to setAccountData and it's better on security but harder to use it.
×
×
  • Create New...