Jump to content

Noki

Members
  • Posts

    850
  • Joined

  • Last visited

Everything posted by Noki

  1. http://bugs.mtasa.com/view.php?id=6479 It's been known for a long time. Edit: I forgot to mention, but it's not exclusive to any mode either.
  2. https://wiki.multitheftauto.com/wiki/He ... _Templates
  3. Noki

    [HELP] Color

    1LoL1, read my response and tell me if it works for you.
  4. You mentioned nothing about drivers at all. They're usually the culprit in issues like these.
  5. Objects & Classes - A class is, as it's name suggests, a class. Classes are used to organise functions and make things cleaner. Let's say we have a class called "Bank". When we create a new instance of Bank (using something like Bank() or Bank.create()), we have a Bank object. With this bank object, we can do many things with it (bank:balance(500), bank:interest(0.04), etc). MTA Classes - Player, Vehicle, Object (not to be confused with OOP objects like explained above), Light, Vector(2/3/4), Matrix, etc. These are in-built classes in MTA and contain methods (also known as functions) which can be used to do something with an instance of the object (vehicle:method()). Though, you don't always need an instance of that object to call a function from that class (Vehicle.method() - a static function). Table & Arrays - A table contains a key and a value. To access the value, you need to provide a key. t = {} t[1] = "one", -- print(t[1]) -> one t["one"] = 1, -- print(t["one"]) -> 1 t[1] = "one", t[2] = "two", t[3] = "three" for index, value in ipairs(t) do print(index.." - "..value) end --> 1 - one --> 2- two --> 3 - three Elements - An element is usually an instance of a certain class. It's just the procedural way of addressing it. There are vehicle, object, player elements and more. Children & Parents - Familiarize yourself with the element tree. If I create a gridlist within a GUI window, the window would be the parent of the gridlist and the gridlist would be the child of the parent. If I hid the window, the gridlist would also hide because it is a child of the window. The child does whatever their parent does (though there are exceptions and you can sometimes change this).
  6. It should be in /usr/lib
  7. When creating the gridlist, use guiGridListSetItemData to set that row's data to the corresponding vehicle element. That way, when you select the item you can get that selected item's data (which will be a vehicle element) using guiGridListGetItemData.
  8. Noki

    [HELP] Color

    Alright, I had a proper look through the resource. In dxscoreboard_clientsettings.lua, there is a table that contains all the defaults (called defaultSettings). The last index of that table is called 'content_color'. In there, there is another table which contains the default colours for the scoreboard's content (the colour of the text in the columns that aren't the name column). You can change the rgba values there and they will be the default colours. Line 78 to line 82. (https://github.com/multitheftauto/mtasa ... ttings.lua) Though remember a lot of servers use dxscoreboard and a lot of the time, the client settings are carried across servers (mine has no animation, for example). So not all players will see it as green 100% of the time unless you rename your scoreboard resource to something unique.
  9. Noki

    [HELP] Color

    The scoreboard is drawn with dx. Look in dxscoreboard_client.lua for dxDrawText. There should be an argument in there where you're able to modify the colour (in the form of r, g, b, a).
  10. Noki

    Staff Panel

    You don't need to make 999 rows. Just loop through players and create a row for each one and set their name accordingly. You also have a syntax error on line 28. Remove the two periods before getPlayerName.
  11. You're also able to pass parameters through the second set of parentheses.
  12. No, he doesn't. Check the original post. Change line 5 to the following and you'll be good to go. loadstring(luaCode)()
  13. I would use removeElementData instead.
  14. function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function changePedStats(thePlayer, _, name) local plr = getPlayerFromPartialName(name) if (not plr) then outputChatBox("There is no player with this name", thePlayer) return end local stat = setPedStat(plr, 75, 1000) if (stat) then outputChatBox("Congratulations! You have given "..getPlayerName(plr).." dual UZIs!", thePlayer) end end addCommandHandler("givestats", changePedStats, true) function onPlayerQuit() local playerAccount = getPlayerAccount(source) if (playerAccount) then local pedStats = getPedStat(source, 75) setAccountData(playerAccount, "zi.pedstats", pedStats) end end addEventHandler("onPlayerQuit", root, onPlayerQuit) addEventHandler("onPlayerWasted", root, onPlayerQuit) function onPlayerLogin() local playerAccount = getPlayerAccount(source) if (playerAccount) then local pedStats = getAccountData(playerAccount, "zi.pedstats") if (pedStats) then setPedStat(source, 75, pedStats) end end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) Give this a go.
  15. I don't understand why everyone wants support for different languages. Is it the better in-built libraries and flexibility that comes with a language like Python? Or the familiarity of syntax in the case of JS (curly braces, ++, etc)? Edit: I realized I answered my own question.
  16. There's no such function as "getPedStats". Use getPedStat to get the uzi stat, then save that. But besides that it looks pretty good. Give it a go and let me know how it turns out.
  17. setAccountData getAccountData Couple that with a few obvious events (onPlayerQuit, onPlayerWasted, onPlayerJoin etc) and that would be the simplest way to implement persistent skills.
  18. 2. No, you can't. 3. Yes. You can use downloadFile to download the models and replace them, then delete them from the client or set cache to false in meta.xml. However, clients will have to download these mods every time they connect.
  19. We don't write code for you here. AMARANT already gave you an example. You seem to have already wrote part of your desired code anyway in your previous posts.
  20. 'player' is not defined. Use 'thePlayer' instead as that's what's defined in your function. Oh, and the team part won't work. You're checking a team element, but it looks to me you want to compare two strings instead. local team = getTeamName(getPlayerTeam(thePlayer)) if (team == "Staff") then
  21. Noki

    /command test

    function onlineStaff(thePlayer, _, cmd) local admins = {} if (cmd == "staffs") then for _,player in ipairs(getElementsByType("player")) do if(exports.CSTadmin:isPlayerStaff(player)) then table.insert(admins,getPlayerName(player)) end end if(#admins > 0) then exports.CSTtexts:output("Online staff: "..table.concat(admins,", "),thePlayer, 0,255,0) else exports.CSTtexts:output("No Staff is currently online!",thePlayer,255,0,0) end end end addCommandHandler("online", onlineStaff)
  22. You could look for some sort of web API or hope that someone writes a module for MTA similar to bcrypt.
  23. outputChatBox("You have been given dual wield UZIs by "..getPlayerName(thePlayer), plr) That would only work in the case of the first code I gave.
  24. setPedStat/setPlayerStat (use setPedStat as setPlayerStat is deprecated) only work server-side. So make sure your script is set as server-sided in meta.xml. The first argument in a function with a command handler is the player who executed the command. If you want to specify the dual uzi skill for another player, you'll need to do something like this: function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function changePedStats(thePlayer, _, name) local plr = getPlayerFromPartialName(name) if (not plr) then outputChatBox("There is no player with this name", thePlayer) return end local stat = setPedStat(plr, 75, 1000) if (stat) then outputChatBox("Congratulations! You have given "..getPlayerName(plr).." dual UZIs!", thePlayer) end end addCommandHandler("givestats", changePedStats, true) If you just want it to be for the player who typed the command, do something like this: function changePedStats(thePlayer, _) local stat = setPedStat(thePlayer, 75, 1000) if (stat) then outputChatBox("Congratulations! You have got dual wield UZI stats!", thePlayer) end end addCommandHandler("givestats", changePedStats, true)
  25. If the player in question has runcode access, they might be able to. Otherwise, I'm pretty certain they wouldn't be able to.
×
×
  • Create New...