Snoop.Cat Posted March 5, 2013 Share Posted March 5, 2013 hey i have a problem , i downloaded minimapshop from the mta comunity and when i start it its says me thata map is already buyed yet and dont let me set a new map. i added it to acl and dont know what can be , a friend told me to send the racevoting_server.lua from race and it worked fine but then my server timedout and the script stop working and dont know how to fix. there is my racevoting_server.lua -- -- racemidvote_server.lua -- -- Mid-race random map vote and -- NextMapVote handled in this file -- local lastVoteStarterName = '' local lastVoteStarterCount = 0 local nextmapbought = false ---------------------------------------------------------------------------- -- displayHilariarseMessage -- -- Comedy gold ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -- displayKillerPunchLine -- -- Sewing kits available in the foyer ---------------------------------------------------------------------------- function displayKillerPunchLine( player ) if lastVoteStarterName ~= '' then outputRace( 'Offical news: Everybody hates ' .. lastVoteStarterName ) end end ---------------------------------------------------------------------------- -- startMidMapVoteForRandomMap -- -- Start the vote menu if during a race and more than 30 seconds from the end -- No messages if this was not started by a player ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -- event midMapVoteResult -- -- Called from the votemanager when the poll has completed ---------------------------------------------------------------------------- addEvent('midMapVoteResult') addEventHandler('midMapVoteResult', getRootElement(), function( votedYes,map ) -- Change state back gotoState('Running') if votedYes then local query = votemapnext local map, errormsg = findMap( query ) g_ForcedNextMap = map else displayKillerPunchLine() end end ) ---------------------------------------------------------------------------- -- startRandomMap -- -- Changes the current map to a random race map ---------------------------------------------------------------------------- function startRandomMap() -- Handle forced nextmap setting if maybeApplyForcedNextMap() then return end -- Get a random map chosen from the 10% of least recently player maps, with enough spawn points for all the players (if required) local map = getRandomMapCompatibleWithGamemode( getThisResource(), 100, g_GameOptions.ghostmode and 0 or getTotalPlayerCount() ) if map then g_IgnoreSpawnCountProblems = map -- Uber hack 4000 if not exports.mapmanager:changeGamemodeMap ( map, nil, true ) then problemChangingMap() end else outputWarning( 'startRandomMap failed' ) end end ---------------------------------------------------------------------------- -- outputRace -- -- Race color is defined in the settings ---------------------------------------------------------------------------- function outputRace(message, toElement) toElement = toElement or g_Root local r, g, b = getColorFromString(string.upper(get("color"))) if getElementType(toElement) == 'console' then outputServerLog(message) else if toElement == rootElement then outputServerLog(message) end if getElementType(toElement) == 'player' then message = '[PM] ' .. message end outputChatBox(message, toElement, r, g, b) end end ---------------------------------------------------------------------------- -- problemChangingMap -- -- Sort it ---------------------------------------------------------------------------- function problemChangingMap() outputRace( 'Changing to random map in 5 seconds' ) local currentMap = exports.mapmanager:getRunningGamemodeMap() TimerManager.createTimerFor("resource","mapproblem"):setTimer( function() -- Check that something else hasn't already changed the map if currentMap == exports.mapmanager:getRunningGamemodeMap() then startRandomMap() end end, math.random(4500,5500), 1 ) end -- -- -- NextMapVote 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 table.insert(poll, {"^^", 'nextMapVoteResult', getRootElement(), currentMap}) 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 -- -- -- local g_Poll ---------------------------------------------------------------------------- -- startNextMapVote -- -- Start a votemap for the next map. Should only be called during the -- race state 'NextMapSelect' ---------------------------------------------------------------------------- function nextmapsetauto () local map = getRandomMapCompatibleWithGamemode( getThisResource(), 100, 1 ) local currentMap = exports.mapmanager:getRunningGamemodeMap() if map == currentMap then --nothink else g_ForcedNextMap = map nextmapbought = false end end addEvent("onMapStarting",true) addEventHandler ( "onMapStarting", getRootElement(), nextmapsetauto ) -- Used by addons in response to onPollStarting addEvent('onPollModified') addEventHandler('onPollModified', getRootElement(), function( poll ) g_Poll = poll end ) function chooseRandomMap (chosen) if not chosen then cancelEvent() math.randomseed(getTickCount()) exports.votemanager:finishPoll(1) end removeEventHandler("onPollEnd", getRootElement(), chooseRandomMap) end ---------------------------------------------------------------------------- -- event nextMapVoteResult -- -- Called from the votemanager when the poll has completed ---------------------------------------------------------------------------- addEvent('nextMapVoteResult') addEventHandler('nextMapVoteResult', getRootElement(), function( map ) if stateAllowsNextMapVoteResult() then if not exports.mapmanager:changeGamemodeMap ( map, Link to comment
Anony# Posted March 6, 2013 Share Posted March 6, 2013 add this in "racevoting_server" addCommandHandler ( 'afshdjsksleyfgdhsjsiekfchjdksla', function ( player, command, ... ) local query = #{...} > 0 and table.concat ( {...}, ' ' ) or nil if not query then if g_ForcedNextMap then outputDebugString ( 'Next map is ' .. getMapName ( g_ForcedNextMap ) ); else outputDebugString ( 'Next map is not set' ); end return end local map, errormsg = findMap ( query ); if not map then outputRace ( errormsg, player ); return end local account = getPlayerAccount ( player ); if ( isGuestAccount ( account ) == false ) then g_ForcedNextMap = map; triggerClientEvent ( "setNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) outputChatBox ( '#ffffff* ' .. getPlayerName( player ) .. ' #00ff00has bought as next map - #ffffff' .. getMapName ( g_ForcedNextMap ), getRootElement(), 255, 255, 255, true ); takePlayerMoney ( player, 5000 ); if account then setAccountData ( account, "money", tostring ( getPlayerMoney ( player ) ) ); end else outputChatBox ( '* #abcdefPlease #ff0000Login #abcdeffor Open your User Panel', player, 255, 255, 255, true ); end end ) addCommandHandler ( ' Command Name ' , Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now