ColtCabana Posted April 3, 2012 Share Posted April 3, 2012 hi, i have a problem with buying next map. If any admin set next map by AP, anybody could buy map by panel, but he couldnt do that and get a text "A map is already set at the moment! Please try again later" --Panel function buyMap(thePlayer,mapName) if mapIsAlreadySet == false then if not (mapName == "") then local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) if playerCash >= mapCost then executeCommandHandler("donttrytobuymap",thePlayer,mapName) savePlayerData(thePlayer,"cash",playerCash-mapCost) outputChatBox("#ffffff"..getPlayerName(thePlayer).."#00ff00bought a next map!",getRootElement(),255,255,255,true) outputChatBox("#ffffffNext map is: #aaaaaa" ..mapName.."",getRootElement(),255,255,255,true) mapIsAlreadySet = thePlayer local oldmapbuys = loadPlayerData(thePlayer,"mapBuys") savePlayerData(thePlayer,"mapBuys", oldmapbuys + 1) CheckAchievement(thePlayer,13) scoreboardRefresh(thePlayer) else outputChatBox("You don't have enough money to set a map!",thePlayer,255,255,255,true) end else outputChatBox("Please select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("A map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) end end --racevoting addCommandHandler('donttrytobuymap', function( player, command, ... ) local query = #{...}>0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then outputRace( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) else outputRace( 'Next map is not set', player ) end return end local map, errormsg = findMap( query ) if not map then outputRace( errormsg, player ) return end if g_ForcedNextMap == map then outputRace( 'Next map is already set to ' .. getMapName( g_ForcedNextMap )..'', player ,255,255,255,true) return false end g_ForcedNextMap = map triggerClientEvent("setNextMap", getRootElement(), getMapName( g_ForcedNextMap )) end ) addCommandHandler('nextmap', function( player, command, ... ) local query = #{...}>0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then outputRace( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) else outputRace( 'Next map is not set', player ) end return end if not _TESTING and not isPlayerInACLGroup(player, g_GameOptions.admingroup) then return end local map, errormsg = findMap( query ) if not map then outputRace( errormsg, player ) return end if g_ForcedNextMap == map then outputRace( 'Next map is already set to ' .. getMapName( g_ForcedNextMap )..'', player ,255,255,255,true) return end g_ForcedNextMap = map outputChatBox('Next map set to ' .. getMapName( g_ForcedNextMap ) .. ' by ' .. getPlayerName(player), g_Root, 0, 255, 0,true) triggerClientEvent("setNextMap", getRootElement(), getMapName( g_ForcedNextMap )) end ) I'm waiting for help. Thanks. Link to comment
MIKI785 Posted April 3, 2012 Share Posted April 3, 2012 You didn't set the mapIsAlreadySet in the nextmap command.. And the panel is another resource? Or is it in the race? 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