Jump to content

krYshuT

Members
  • Posts

    27
  • Joined

  • Last visited

krYshuT's Achievements

Advanced Member

Advanced Member (8/54)

0

Reputation

  1. Hello, So I have this code that should remove the option "Play again" from vote, when one map was played 3 times in a row. But it doesn't work correct and I have no clue how to make it working. It removes "Play again" every third map, no matter if it was played more times than once. Example: Map 1 (people voted for Play again) > Map 1 (people voted for Play again) > Map 1 (Play again option disappeared) This is okay, it works. But when people vote each time for different map: Map 1 (people voted for Map 2) > Map 2 (people voted for Map 3) > Map 3 (Play Again option disappeared, but it shouldn't, cause they played it just once) Please help g_maxPlayAgain = 2 function startNextMapVote() exports.votemanager:stopPoll() -- Handle forced nextmap setting if maybeApplyForcedNextMap() then return end -- Get all maps local compatibleMaps = exports.mapmanager:getMapsCompatibleWithGamemode(getThisResource()) -- limit it to eight random maps if #compatibleMaps > 8 then math.randomseed(getTickCount()) repeat table.remove(compatibleMaps, math.random(1, #compatibleMaps)) until #compatibleMaps == 8 elseif #compatibleMaps < 2 then return false, errorCode.onlyOneCompatibleMap end -- mix up the list order for i,map in ipairs(compatibleMaps) do local swapWith = math.random(1, #compatibleMaps) local temp = compatibleMaps[i] compatibleMaps[i] = compatibleMaps[swapWith] compatibleMaps[swapWith] = temp end local poll = { title="Choose the next map:", visibleTo=getRootElement(), percentage=51, timeout=15, allowchange=true; } for index, map in ipairs(compatibleMaps) do local mapName = getResourceInfo(map, "name") or getResourceName(map) table.insert(poll, {mapName, 'nextMapVoteResult', getRootElement(), map}) end local currentMap = exports.mapmanager:getRunningGamemodeMap() if currentMap then if g_maxPlayAgain >= 2 then --table.insert(poll, {"Reached max play again times, chossing a random map.", 'nextMapVoteResult', getRootElement()}) g_maxPlayAgain = 0 else g_maxPlayAgain = g_maxPlayAgain + 1 table.insert(poll, {"Play again", 'nextMapVoteResult', getRootElement(), currentMap}) end end -- Allow addons to modify the poll g_Poll = poll triggerEvent('onPollStarting', g_Root, poll ) poll = g_Poll g_Poll = nil local pollDidStart = exports.votemanager:startPoll(poll) if pollDidStart then gotoState('NextMapVote') addEventHandler("onPollEnd", getRootElement(), chooseRandomMap) end return pollDidStart end
  2. krYshuT

    Song in map

    I already found another way, but thanks I just added "setSoundVolume(sound, 0)" and it works the same way.
  3. krYshuT

    Song in map

    Hello, So I saw this map with MP3 song in it. I wonder, if there is a way to set it to not-play on beginning of the map. It can be turned off with M, but it's boring for most people hearing it again on each start, so I'd like to set it to never play on start, but people can turn it on back with M. Here's the script: local sound addEventHandler('onClientResourceStart', resourceRoot, function () outputChatBox("Press M to toggle between music / radio") sound = playSound("song.mp3",false) end ) local toggle = false bindKey("m","down", function() if toggle then setSoundVolume(sound,0) toggle = false else setSoundVolume(sound,1) toggle = true end end ) The line "local toggle = false" was originally with true value and I thought it might fix it, but it didn't. The song still plays on start.
  4. Hello I want to destroy the HEX codes from player's nicknames in outputs, when someone is mute, kicked, etc. It's placed in the messages.xml file, so i don't think it works the same way as in the LUA scripting. Example: <group action="ban" r="255" g="0" b="0"> <all>$player has been banned$by_admin_4all. $data2</all> <log>ADMIN: $admin has banned $player $data $data2</log> </group> <group action="kick" r="255" g="0" b="0"> <all>$player has been kicked$by_admin_4all.</all> <log>ADMIN: $admin has kicked $player $data</log> </group> <group action="mute" r="255" g="0" b="0"> <all>$player has been muted$by_admin_4all. $data2</all> <log>ADMIN: $admin has muted $player $data $data2</log> </group> What shall I add to destroy the hex codes in game?
  5. Hello MTA! Is there any hunter toptimes resource free to download? Because I only saw it on some "bigger" servers and they probably coded it themselves. And I couldn't find it anywhere on the forum, or resources site. Thanks.
  6. krYshuT

    Hex codes

    Thanks varez, it took me like 2 hours to make it working, but it works
  7. krYshuT

    Hex codes

    Ingame it looks like this: Lua file: local messagesList = { "19.11.: ESE #00ff0013:3 TPT", "ingame cycling text shows here", "ingame cycling text shows here", "ingame cycling text shows here", "ingame cycling text shows here", "ingame cycling text shows here", } local currentMessage = 0 addEventHandler("onClientPreRender", getRootElement(), function() local screenWidth, screenHeight = guiGetScreenSize() -- Draw the news sticker. dxDrawRectangle(screenWidth - 249, 4, 0, 20, tocolor(0, 0, 0, 192), false) -- Draw all strings. dxDrawText(messagesList[currentMessage + 1], screenWidth - 246, 6, screenWidth - 6, 16, tocolor(255, 255, 255, 255), 1, "default-bold", "center", "top", false, false, false) end ) function updateMessage() if (currentMessage == 5) then currentMessage = 0 else currentMessage = currentMessage + 1 end end setTimer(updateMessage, 5000, 0)
  8. krYshuT

    Hex codes

    Works perfect, thanks much. Just one more question. Is there a way to make color text else then in the chatbox? I've got one resources which generates text elsewhere.
  9. Got it finally!! Admin from this revision 643 works. What's odd, that I'm pretty sure that i tried this version already, but whatever. Then the problem must be in admin resource from r655. Anyway, thanks for help.
  10. krYshuT

    Hex codes

    Well, there is this line in delay indicator resource: delayDisplayBehind:text("+"..msToTimeStr(delayTime).." "..cps..getPlayerName(source)) I have no experience in coding, so I don't know how to make it work fine. I tried to edit it like: delayDisplayBehind:text("+"..msToTimeStr(delayTime).." "..cps..string.gsub(playerName, '#%x%x%x%x%x%x', '')) But it didn't work. How it's correct? Else in the killmessages resource I have no idea where to paste it to make it work. Can you help me with this?
  11. krYshuT

    Hex codes

    Is there any way to hide hex codes in player's names? Nobody want it look like this: But what is odd - when you finish the race, the killmessages resource shows it without the hex code as "ESE|krYshuT". However, when i kill myself it shows as "ESE|#ff00ffkrYshuT
  12. Ok, I reinstalled my server, left there default resources and files only. And it doesn't work. Same problem. Admin panel is all okay expect Maps panel. My hosting: http://www.gta-multi.com
  13. Already tried around 5 versions of admin and everytime it's the same. And I tried the one from resources revision 655
  14. I don't think so, it does all the admins on my server.
  15. Hello, I've just got this bug today, it worked the whole time before. The "maps" tab doesn't seem to work. All the buttons are faded and I can't scroll through the list. Using the /changemap is pretty boring. Everything other works normal, no signs of other unfunctionality. I tried to reinstall server to new clean folder, tried older and newer versions of admin. Every time the same issue.
×
×
  • Create New...